summaryrefslogtreecommitdiffstats
path: root/Source/WebKit2/WebProcess/Downloads
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebKit2/WebProcess/Downloads')
-rw-r--r--Source/WebKit2/WebProcess/Downloads/Download.cpp6
-rw-r--r--Source/WebKit2/WebProcess/Downloads/Download.h10
-rw-r--r--Source/WebKit2/WebProcess/Downloads/cf/win/DownloadCFWin.cpp (renamed from Source/WebKit2/WebProcess/Downloads/cf/win/DownloadCFNetWin.cpp)0
-rw-r--r--Source/WebKit2/WebProcess/Downloads/cfnet/DownloadCFNet.cpp (renamed from Source/WebKit2/WebProcess/Downloads/cf/DownloadCFNet.cpp)17
-rw-r--r--Source/WebKit2/WebProcess/Downloads/curl/DownloadCurl.cpp12
-rw-r--r--Source/WebKit2/WebProcess/Downloads/mac/DownloadMac.mm24
-rw-r--r--Source/WebKit2/WebProcess/Downloads/qt/DownloadQt.cpp15
-rw-r--r--Source/WebKit2/WebProcess/Downloads/soup/DownloadSoup.cpp81
8 files changed, 158 insertions, 7 deletions
diff --git a/Source/WebKit2/WebProcess/Downloads/Download.cpp b/Source/WebKit2/WebProcess/Downloads/Download.cpp
index 1c36df2..3fc87d9 100644
--- a/Source/WebKit2/WebProcess/Downloads/Download.cpp
+++ b/Source/WebKit2/WebProcess/Downloads/Download.cpp
@@ -26,6 +26,7 @@
#include "config.h"
#include "Download.h"
+#include "AuthenticationManager.h"
#include "Connection.h"
#include "DataReference.h"
#include "DownloadProxyMessages.h"
@@ -68,6 +69,11 @@ void Download::didStart()
send(Messages::DownloadProxy::DidStart(m_request));
}
+void Download::didReceiveAuthenticationChallenge(const AuthenticationChallenge& authenticationChallenge)
+{
+ AuthenticationManager::shared().didReceiveAuthenticationChallenge(this, authenticationChallenge);
+}
+
void Download::didReceiveResponse(const ResourceResponse& response)
{
send(Messages::DownloadProxy::DidReceiveResponse(response));
diff --git a/Source/WebKit2/WebProcess/Downloads/Download.h b/Source/WebKit2/WebProcess/Downloads/Download.h
index 26d8f3d..780e8c2 100644
--- a/Source/WebKit2/WebProcess/Downloads/Download.h
+++ b/Source/WebKit2/WebProcess/Downloads/Download.h
@@ -47,6 +47,8 @@ namespace CoreIPC {
}
namespace WebCore {
+ class AuthenticationChallenge;
+ class Credential;
class ResourceError;
class ResourceHandle;
class ResourceResponse;
@@ -74,6 +76,7 @@ public:
uint64_t downloadID() const { return m_downloadID; }
void didStart();
+ void didReceiveAuthenticationChallenge(const WebCore::AuthenticationChallenge&);
void didReceiveResponse(const WebCore::ResourceResponse&);
void didReceiveData(uint64_t length);
bool shouldDecodeSourceDataOfMIMEType(const String& mimeType);
@@ -89,6 +92,11 @@ public:
const String& destination() const { return m_destination; }
#endif
+ // Authentication
+ static void receivedCredential(const WebCore::AuthenticationChallenge&, const WebCore::Credential&);
+ static void receivedRequestToContinueWithoutCredential(const WebCore::AuthenticationChallenge&);
+ static void receivedCancellation(const WebCore::AuthenticationChallenge&);
+
private:
Download(uint64_t downloadID, const WebCore::ResourceRequest&);
@@ -105,10 +113,10 @@ private:
RetainPtr<NSURLDownload> m_nsURLDownload;
RetainPtr<WKDownloadAsDelegate> m_delegate;
#endif
-#if USE(CFNETWORK)
bool m_allowOverwrite;
String m_destination;
String m_bundlePath;
+#if USE(CFNETWORK)
RetainPtr<CFURLDownloadRef> m_download;
#endif
};
diff --git a/Source/WebKit2/WebProcess/Downloads/cf/win/DownloadCFNetWin.cpp b/Source/WebKit2/WebProcess/Downloads/cf/win/DownloadCFWin.cpp
index 0dd6508..0dd6508 100644
--- a/Source/WebKit2/WebProcess/Downloads/cf/win/DownloadCFNetWin.cpp
+++ b/Source/WebKit2/WebProcess/Downloads/cf/win/DownloadCFWin.cpp
diff --git a/Source/WebKit2/WebProcess/Downloads/cf/DownloadCFNet.cpp b/Source/WebKit2/WebProcess/Downloads/cfnet/DownloadCFNet.cpp
index 3215039..170c6aa 100644
--- a/Source/WebKit2/WebProcess/Downloads/cf/DownloadCFNet.cpp
+++ b/Source/WebKit2/WebProcess/Downloads/cfnet/DownloadCFNet.cpp
@@ -70,6 +70,8 @@ void Download::start(WebPage*)
CFURLDownloadScheduleWithCurrentMessageQueue(m_download.get());
CFURLDownloadScheduleDownloadWithRunLoop(m_download.get(), loaderRunLoop(), kCFRunLoopDefaultMode);
+
+ CFURLDownloadStart(m_download.get());
}
void Download::startWithHandle(WebPage*, ResourceHandle* handle, const ResourceRequest& initialRequest, const ResourceResponse& response)
@@ -206,4 +208,19 @@ void didFailCallback(CFURLDownloadRef, CFErrorRef error, const void* clientInfo)
downloadFromClientInfo(clientInfo)->didFail(ResourceError(error), dataReference);
}
+void Download::receivedCredential(const AuthenticationChallenge& authenticationChallenge, const Credential& credential)
+{
+ notImplemented();
+}
+
+void Download::receivedRequestToContinueWithoutCredential(const AuthenticationChallenge& authenticationChallenge)
+{
+ notImplemented();
+}
+
+void Download::receivedCancellation(const AuthenticationChallenge& authenticationChallenge)
+{
+ notImplemented();
+}
+
} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/Downloads/curl/DownloadCurl.cpp b/Source/WebKit2/WebProcess/Downloads/curl/DownloadCurl.cpp
index 6ebce01..0466e7c 100644
--- a/Source/WebKit2/WebProcess/Downloads/curl/DownloadCurl.cpp
+++ b/Source/WebKit2/WebProcess/Downloads/curl/DownloadCurl.cpp
@@ -58,7 +58,17 @@ void Download::didDecideDestination(const String& destination, bool allowOverwri
notImplemented();
}
-void Download::platformDidFinish()
+void Download::receivedCredential(const AuthenticationChallenge& authenticationChallenge, const Credential& credential)
+{
+ notImplemented();
+}
+
+void Download::receivedRequestToContinueWithoutCredential(const AuthenticationChallenge& authenticationChallenge)
+{
+ notImplemented();
+}
+
+void Download::receivedCancellation(const AuthenticationChallenge& authenticationChallenge)
{
notImplemented();
}
diff --git a/Source/WebKit2/WebProcess/Downloads/mac/DownloadMac.mm b/Source/WebKit2/WebProcess/Downloads/mac/DownloadMac.mm
index f7fe8dc..2d09612 100644
--- a/Source/WebKit2/WebProcess/Downloads/mac/DownloadMac.mm
+++ b/Source/WebKit2/WebProcess/Downloads/mac/DownloadMac.mm
@@ -26,6 +26,7 @@
#import "config.h"
#import "Download.h"
+#import <WebCore/AuthenticationMac.h>
#import <WebCore/BackForwardController.h>
#import <WebCore/HistoryItem.h>
#import <WebCore/NotImplemented.h>
@@ -177,6 +178,21 @@ void Download::platformDidFinish()
{
}
+void Download::receivedCredential(const AuthenticationChallenge& authenticationChallenge, const Credential& credential)
+{
+ [authenticationChallenge.sender() useCredential:mac(credential) forAuthenticationChallenge:authenticationChallenge.nsURLAuthenticationChallenge()];
+}
+
+void Download::receivedRequestToContinueWithoutCredential(const AuthenticationChallenge& authenticationChallenge)
+{
+ [authenticationChallenge.sender() continueWithoutCredentialForAuthenticationChallenge:authenticationChallenge.nsURLAuthenticationChallenge()];
+}
+
+void Download::receivedCancellation(const AuthenticationChallenge& authenticationChallenge)
+{
+ [authenticationChallenge.sender() cancelAuthenticationChallenge:authenticationChallenge.nsURLAuthenticationChallenge()];
+}
+
} // namespace WebKit
@implementation WKDownloadAsDelegate
@@ -216,8 +232,8 @@ void Download::platformDidFinish()
- (void)download:(NSURLDownload *)download didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
{
- // FIXME: Implement.
- notImplemented();
+ if (_download)
+ _download->didReceiveAuthenticationChallenge(core(challenge));
}
- (void)download:(NSURLDownload *)download didCancelAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
@@ -228,9 +244,7 @@ void Download::platformDidFinish()
- (BOOL)downloadShouldUseCredentialStorage:(NSURLDownload *)download
{
- // FIXME: Implement.
- notImplemented();
- return YES;
+ return NO;
}
- (void)download:(NSURLDownload *)download didReceiveResponse:(NSURLResponse *)response
diff --git a/Source/WebKit2/WebProcess/Downloads/qt/DownloadQt.cpp b/Source/WebKit2/WebProcess/Downloads/qt/DownloadQt.cpp
index 19b86f0..ad5e7de 100644
--- a/Source/WebKit2/WebProcess/Downloads/qt/DownloadQt.cpp
+++ b/Source/WebKit2/WebProcess/Downloads/qt/DownloadQt.cpp
@@ -62,4 +62,19 @@ void Download::platformDidFinish()
notImplemented();
}
+void Download::receivedCredential(const AuthenticationChallenge& authenticationChallenge, const Credential& credential)
+{
+ notImplemented();
+}
+
+void Download::receivedRequestToContinueWithoutCredential(const AuthenticationChallenge& authenticationChallenge)
+{
+ notImplemented();
+}
+
+void Download::receivedCancellation(const AuthenticationChallenge& authenticationChallenge)
+{
+ notImplemented();
+}
+
} // namespace WebKit
diff --git a/Source/WebKit2/WebProcess/Downloads/soup/DownloadSoup.cpp b/Source/WebKit2/WebProcess/Downloads/soup/DownloadSoup.cpp
new file mode 100644
index 0000000..a228916
--- /dev/null
+++ b/Source/WebKit2/WebProcess/Downloads/soup/DownloadSoup.cpp
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2010 Brent Fulgham <bfulgham@webkit.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "Download.h"
+
+#include <WebCore/NotImplemented.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+void Download::start(WebPage* initiatingWebPage)
+{
+ notImplemented();
+}
+
+void Download::startWithHandle(WebPage* initiatingPage, ResourceHandle*, const ResourceRequest& initialRequest, const ResourceResponse&)
+{
+ notImplemented();
+}
+
+void Download::cancel()
+{
+ notImplemented();
+}
+
+void Download::platformInvalidate()
+{
+ notImplemented();
+}
+
+void Download::didDecideDestination(const String& destination, bool allowOverwrite)
+{
+ notImplemented();
+}
+
+void Download::platformDidFinish()
+{
+ notImplemented();
+}
+
+void Download::receivedCredential(const AuthenticationChallenge& authenticationChallenge, const Credential& credential)
+{
+ notImplemented();
+}
+
+void Download::receivedRequestToContinueWithoutCredential(const AuthenticationChallenge& authenticationChallenge)
+{
+ notImplemented();
+}
+
+void Download::receivedCancellation(const AuthenticationChallenge& authenticationChallenge)
+{
+ notImplemented();
+}
+
+} // namespace WebKit