diff options
author | Iain Merrick <husky@google.com> | 2010-08-23 17:35:30 +0100 |
---|---|---|
committer | Iain Merrick <husky@google.com> | 2010-09-20 12:14:03 +0100 |
commit | d4ff0cc91b5eb975d563f355f9f4c7358e0e2c06 (patch) | |
tree | 69dda182d1890032def251c6888fcfb97d4d5135 /WebKit/android/WebCoreSupport/WebRequest.cpp | |
parent | f8230805249e7f0956d00204d2e610208efe5ad9 (diff) | |
download | external_webkit-d4ff0cc91b5eb975d563f355f9f4c7358e0e2c06.zip external_webkit-d4ff0cc91b5eb975d563f355f9f4c7358e0e2c06.tar.gz external_webkit-d4ff0cc91b5eb975d563f355f9f4c7358e0e2c06.tar.bz2 |
HTTP auth for Chromium HTTP stack (C++ side)
On receiving an auth request:
- WebRequest (on the IO thread) sends a message to WebUrlLoaderClient
- WebUrlLoaderClient (webkit thread) calls WebCoreFrameBridge.
- WebCoreFrameBridge makes a JNI call to BrowserFrame.java.
Each JNI call has a WebUrlLoaderClient pointer, cast to an int.
We use this to recover the context when we're called back, and
dispatch a message back to WebRequest.
Corresponding Java change: https://android-git.corp.google.com/g/63762
Change-Id: Ieb72f2eaa996a55916c987859f47f6dacf92e06c
Diffstat (limited to 'WebKit/android/WebCoreSupport/WebRequest.cpp')
-rw-r--r-- | WebKit/android/WebCoreSupport/WebRequest.cpp | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/WebKit/android/WebCoreSupport/WebRequest.cpp b/WebKit/android/WebCoreSupport/WebRequest.cpp index 10b0cc7..e440181 100644 --- a/WebKit/android/WebCoreSupport/WebRequest.cpp +++ b/WebKit/android/WebCoreSupport/WebRequest.cpp @@ -295,9 +295,11 @@ void WebRequest::OnReceivedRedirect(URLRequest* newRequest, const GURL& newUrl, // of On* callbacks. void WebRequest::OnAuthRequired(URLRequest* request, net::AuthChallengeInfo* authInfo) { - // TODO: This is the default action, have to implement getting the - // username and password from webkit - request->CancelAuth(); + ASSERT(m_loadState == Started, "OnAuthRequired called on a WebRequest not in STARTED state (state=%d)", m_loadState); + + LoaderData* ld = new LoaderData(m_urlLoader); + ld->authChallengeInfo = authInfo; + m_urlLoader->maybeCallOnMainThread(WebUrlLoaderClient::authRequired, ld); } // After calling Start(), the delegate will receive an OnResponseStarted @@ -323,6 +325,20 @@ void WebRequest::OnResponseStarted(URLRequest* request) } } +void WebRequest::setAuth(const std::wstring& username, const std::wstring& password) +{ + ASSERT(m_loadState == Started, "setAuth called on a WebRequest not in STARTED state (state=%d)", m_loadState); + + m_request->SetAuth(username, password); +} + +void WebRequest::cancelAuth() +{ + ASSERT(m_loadState == Started, "cancelAuth called on a WebRequest not in STARTED state (state=%d)", m_loadState); + + m_request->CancelAuth(); +} + void WebRequest::startReading() { ASSERT(m_loadState == Response || m_loadState == GotData, "StartReading in state other than RESPONSE and GOTDATA"); |