diff options
| -rw-r--r-- | WebKit/android/WebCoreSupport/WebRequest.cpp | 7 | ||||
| -rw-r--r-- | WebKit/android/WebCoreSupport/WebRequest.h | 1 | ||||
| -rw-r--r-- | WebKit/android/WebCoreSupport/WebUrlLoaderClient.cpp | 10 | ||||
| -rw-r--r-- | WebKit/android/WebCoreSupport/WebUrlLoaderClient.h | 2 |
4 files changed, 10 insertions, 10 deletions
diff --git a/WebKit/android/WebCoreSupport/WebRequest.cpp b/WebKit/android/WebCoreSupport/WebRequest.cpp index a165b8a..366c3c9 100644 --- a/WebKit/android/WebCoreSupport/WebRequest.cpp +++ b/WebKit/android/WebCoreSupport/WebRequest.cpp @@ -66,6 +66,7 @@ WebRequest::WebRequest(WebUrlLoaderClient* loader, const WebResourceRequest& web , m_url(webResourceRequest.url()) , m_userAgent(webResourceRequest.userAgent()) , m_loadState(Created) + , m_authRequestCount(0) { GURL gurl(m_url); @@ -86,6 +87,7 @@ WebRequest::WebRequest(WebUrlLoaderClient* loader, const WebResourceRequest& web , m_url(webResourceRequest.url()) , m_userAgent(webResourceRequest.userAgent()) , m_loadState(Created) + , m_authRequestCount(0) { } @@ -310,8 +312,11 @@ void WebRequest::OnAuthRequired(URLRequest* request, net::AuthChallengeInfo* aut ASSERT(m_loadState == Started, "OnAuthRequired called on a WebRequest not in STARTED state (state=%d)", m_loadState); scoped_refptr<net::AuthChallengeInfo> authInfoPtr(authInfo); + bool firstTime = (m_authRequestCount == 0); + ++m_authRequestCount; + m_urlLoader->maybeCallOnMainThread(NewRunnableMethod( - m_urlLoader.get(), &WebUrlLoaderClient::authRequired, authInfoPtr)); + m_urlLoader.get(), &WebUrlLoaderClient::authRequired, authInfoPtr, firstTime)); } // After calling Start(), the delegate will receive an OnResponseStarted diff --git a/WebKit/android/WebCoreSupport/WebRequest.h b/WebKit/android/WebCoreSupport/WebRequest.h index 2bcbb92..98e2921 100644 --- a/WebKit/android/WebCoreSupport/WebRequest.h +++ b/WebKit/android/WebCoreSupport/WebRequest.h @@ -101,6 +101,7 @@ private: std::string m_url; std::string m_userAgent; LoadState m_loadState; + int m_authRequestCount; }; } // namespace android diff --git a/WebKit/android/WebCoreSupport/WebUrlLoaderClient.cpp b/WebKit/android/WebCoreSupport/WebUrlLoaderClient.cpp index 7487e48..d7df279 100644 --- a/WebKit/android/WebCoreSupport/WebUrlLoaderClient.cpp +++ b/WebKit/android/WebCoreSupport/WebUrlLoaderClient.cpp @@ -337,7 +337,7 @@ void WebUrlLoaderClient::didFinishLoading() finish(); } -void WebUrlLoaderClient::authRequired(scoped_refptr<net::AuthChallengeInfo> authChallengeInfo) +void WebUrlLoaderClient::authRequired(scoped_refptr<net::AuthChallengeInfo> authChallengeInfo, bool firstTime) { if (!isActive()) { return; @@ -346,13 +346,7 @@ void WebUrlLoaderClient::authRequired(scoped_refptr<net::AuthChallengeInfo> auth std::string host = base::SysWideToUTF8(authChallengeInfo->host_and_port); std::string realm = base::SysWideToUTF8(authChallengeInfo->realm); - // TODO: Not clear whose responsibility it is to cache credentials. There's nothing - // in AuthChallengeInfo that seems suitable, so for safety we'll tell the UI *not* - // to use cached credentials. We may need to track this ourselves (pass "true" on - // the first call, then "false" for a second call if the credentials are rejected). - bool useCachedCredentials = false; - - m_webFrame->didReceiveAuthenticationChallenge(this, host, realm, useCachedCredentials); + m_webFrame->didReceiveAuthenticationChallenge(this, host, realm, firstTime); } } // namespace android diff --git a/WebKit/android/WebCoreSupport/WebUrlLoaderClient.h b/WebKit/android/WebCoreSupport/WebUrlLoaderClient.h index 5f2c528..56d4289 100644 --- a/WebKit/android/WebCoreSupport/WebUrlLoaderClient.h +++ b/WebKit/android/WebCoreSupport/WebUrlLoaderClient.h @@ -86,7 +86,7 @@ public: void didFinishLoading(); void didFail(PassOwnPtr<WebResponse>); void willSendRequest(PassOwnPtr<WebResponse>); - void authRequired(scoped_refptr<net::AuthChallengeInfo>); + void authRequired(scoped_refptr<net::AuthChallengeInfo>, bool firstTime); // Handle to the chrome IO thread static base::Thread* ioThread(); |
