diff options
Diffstat (limited to 'Source/WebKit2/WebProcess/Authentication/AuthenticationManager.cpp')
-rw-r--r-- | Source/WebKit2/WebProcess/Authentication/AuthenticationManager.cpp | 50 |
1 files changed, 36 insertions, 14 deletions
diff --git a/Source/WebKit2/WebProcess/Authentication/AuthenticationManager.cpp b/Source/WebKit2/WebProcess/Authentication/AuthenticationManager.cpp index af35f75..e7550d0 100644 --- a/Source/WebKit2/WebProcess/Authentication/AuthenticationManager.cpp +++ b/Source/WebKit2/WebProcess/Authentication/AuthenticationManager.cpp @@ -26,6 +26,8 @@ #include "config.h" #include "AuthenticationManager.h" +#include "Download.h" +#include "DownloadProxyMessages.h" #include "MessageID.h" #include "WebCoreArgumentCoders.h" #include "WebFrame.h" @@ -35,6 +37,8 @@ #include <WebCore/AuthenticationChallenge.h> #include <WebCore/AuthenticationClient.h> +using namespace WebCore; + namespace WebKit { static uint64_t generateAuthenticationChallengeID() @@ -58,46 +62,64 @@ void AuthenticationManager::didReceiveMessage(CoreIPC::Connection* connection, C didReceiveAuthenticationManagerMessage(connection, messageID, arguments); } -void AuthenticationManager::didReceiveAuthenticationChallenge(WebFrame* frame, const WebCore::AuthenticationChallenge& authenticationChallenge) +void AuthenticationManager::didReceiveAuthenticationChallenge(WebFrame* frame, const AuthenticationChallenge& authenticationChallenge) { ASSERT(frame); ASSERT(frame->page()); - uint64_t id = generateAuthenticationChallengeID(); - m_challenges.set(id, authenticationChallenge); + uint64_t challengeID = generateAuthenticationChallengeID(); + m_challenges.set(challengeID, authenticationChallenge); - WebProcess::shared().connection()->send(Messages::WebPageProxy::DidReceiveAuthenticationChallenge(frame->frameID(), authenticationChallenge, id), frame->page()->pageID()); + WebProcess::shared().connection()->send(Messages::WebPageProxy::DidReceiveAuthenticationChallenge(frame->frameID(), authenticationChallenge, challengeID), frame->page()->pageID()); +} + +void AuthenticationManager::didReceiveAuthenticationChallenge(Download* download, const AuthenticationChallenge& authenticationChallenge) +{ + uint64_t challengeID = generateAuthenticationChallengeID(); + m_challenges.set(challengeID, authenticationChallenge); + + download->send(Messages::DownloadProxy::DidReceiveAuthenticationChallenge(authenticationChallenge, challengeID)); } -void AuthenticationManager::useCredentialForChallenge(uint64_t challengeID, const WebCore::Credential& credential) +void AuthenticationManager::useCredentialForChallenge(uint64_t challengeID, const Credential& credential) { - WebCore::AuthenticationChallenge challenge = m_challenges.take(challengeID); + AuthenticationChallenge challenge = m_challenges.take(challengeID); ASSERT(!challenge.isNull()); - WebCore::AuthenticationClient* coreClient = challenge.authenticationClient(); - if (!coreClient) + AuthenticationClient* coreClient = challenge.authenticationClient(); + if (!coreClient) { + // This authentication challenge comes from a download. + Download::receivedCredential(challenge, credential); return; + + } coreClient->receivedCredential(challenge, credential); } void AuthenticationManager::continueWithoutCredentialForChallenge(uint64_t challengeID) { - WebCore::AuthenticationChallenge challenge = m_challenges.take(challengeID); + AuthenticationChallenge challenge = m_challenges.take(challengeID); ASSERT(!challenge.isNull()); - WebCore::AuthenticationClient* coreClient = challenge.authenticationClient(); - if (!coreClient) + AuthenticationClient* coreClient = challenge.authenticationClient(); + if (!coreClient) { + // This authentication challenge comes from a download. + Download::receivedRequestToContinueWithoutCredential(challenge); return; + } coreClient->receivedRequestToContinueWithoutCredential(challenge); } void AuthenticationManager::cancelChallenge(uint64_t challengeID) { - WebCore::AuthenticationChallenge challenge = m_challenges.take(challengeID); + AuthenticationChallenge challenge = m_challenges.take(challengeID); ASSERT(!challenge.isNull()); - WebCore::AuthenticationClient* coreClient = challenge.authenticationClient(); - if (!coreClient) + AuthenticationClient* coreClient = challenge.authenticationClient(); + if (!coreClient) { + // This authentication challenge comes from a download. + Download::receivedCancellation(challenge); return; + } coreClient->receivedCancellation(challenge); } |