Need to support authentication for downloads in WebKit2 on Windows
authorjhoneycutt@apple.com <jhoneycutt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 22 Apr 2011 07:40:51 +0000 (07:40 +0000)
committerjhoneycutt@apple.com <jhoneycutt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 22 Apr 2011 07:40:51 +0000 (07:40 +0000)
commit33f098afb6cb1efbe6cb2386ec94e56aa3a4d9bd
treef356daf86aeb1effc7bc202ab95ab08bee45060b
parentc15dc8037028eb828b4043dbf86303aabc8fe184
Need to support authentication for downloads in WebKit2 on Windows
https://bugs.webkit.org/show_bug.cgi?id=59175
<rdar://problem/9206151>
<rdar://problem/8958280>

Reviewed by Maciej Stachowiak.

* WebProcess/Downloads/Download.cpp:
Include DownloadAuthenticationClient.h.

* WebProcess/Downloads/Download.h:
Declare a function to get or create the authentication client, a member
var to hold it, and functions that the client can call to use a
credential, continue without a credential, or cancel an auth challenge.

* WebProcess/Downloads/DownloadAuthenticationClient.cpp: Added.
(WebKit::DownloadAuthenticationClient::DownloadAuthenticationClient):
(WebKit::DownloadAuthenticationClient::receivedCredential):
Tell the Download to use the credential.
(WebKit::DownloadAuthenticationClient::receivedRequestToContinueWithoutCredential):
Tell the Download to continue with credentials.
(WebKit::DownloadAuthenticationClient::receivedCancellation):
Tell the Download to cancel the challenge.

* WebProcess/Downloads/DownloadAuthenticationClient.h: Added.
(WebKit::DownloadAuthenticationClient::create):
Return a new DownloadAuthenticationClient.
(WebKit::DownloadAuthenticationClient::detach):
Clear the Download.
(WebKit::DownloadAuthenticationClient::refAuthenticationClient):
(WebKit::DownloadAuthenticationClient::derefAuthenticationClient):

* WebProcess/Downloads/cfnet/DownloadCFNet.cpp:
(WebKit::Download::useCredential):
Create a CFURLCredentialRef from the WebCore credential, and tell
CFNetwork to use it for the auth challenge.
(WebKit::Download::continueWithoutCredential):
Call CFURLDownloadUseCredential with a null credential.
(WebKit::Download::cancelAuthenticationChallenge):
Cancel the download, and clear m_download.
(WebKit::Download::authenticationClient):
Create if needed and return a DownloadAuthenticationClient.
(WebKit::Download::platformInvalidate):
Detach the DownloadAuthenticationClient.
(WebKit::didReceiveAuthenticationChallengeCallback):
Call Download::didReceiveAuthenticationChallenge(), passing a
WebCore::AuthenticationChallenge with our DownloadAuthenticationClient.
(WebKit::Download::receivedCredential):
Get the client from the auth challenge, and call through to it.
(WebKit::Download::receivedRequestToContinueWithoutCredential):
Ditto.
(WebKit::Download::receivedCancellation):
Ditto.

* win/WebKit2.vcproj:
Add new files to project.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@84610 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/Downloads/Download.cpp
Source/WebKit2/WebProcess/Downloads/Download.h
Source/WebKit2/WebProcess/Downloads/DownloadAuthenticationClient.cpp [new file with mode: 0644]
Source/WebKit2/WebProcess/Downloads/DownloadAuthenticationClient.h [new file with mode: 0644]
Source/WebKit2/WebProcess/Downloads/cfnet/DownloadCFNet.cpp
Source/WebKit2/win/WebKit2.vcproj