diff options
author | Ben Murdoch <benm@google.com> | 2011-08-05 15:42:17 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2011-08-05 15:50:19 +0100 |
commit | b03ba594dfb7cae54557397a2a86b0a926da4685 (patch) | |
tree | 1500e82f92fed8e60b7e033b15d53b9f65c23e3f /Source/WebKit/android/WebCoreSupport | |
parent | 6b9d05281a529f9cd3e527fb8d657b338bb4fd7a (diff) | |
download | external_webkit-b03ba594dfb7cae54557397a2a86b0a926da4685.zip external_webkit-b03ba594dfb7cae54557397a2a86b0a926da4685.tar.gz external_webkit-b03ba594dfb7cae54557397a2a86b0a926da4685.tar.bz2 |
Plumb a bool through to Java to supress auth dialog.
In the case of a prefetch or favicon load, we want to silently fail
auth loads but allow the use of cached credentials. To acheive this,
pass an extra flag through to Java to decide whether to show the
prompt or not.
Requires:
frameworks/base change: Ida5708aad7cbe5633106e9ae2997c9231aaf95b8
packages/apps/Browser change: Id901855830bbe17ede8a18293cff2bbc0aad4ba8
Bug: 5094761
Change-Id: If8c6f22e8307e1e13b8f7ad29f79305ce24b3255
Diffstat (limited to 'Source/WebKit/android/WebCoreSupport')
4 files changed, 17 insertions, 4 deletions
diff --git a/Source/WebKit/android/WebCoreSupport/WebRequest.cpp b/Source/WebKit/android/WebCoreSupport/WebRequest.cpp index 85460bd..90b0939 100644 --- a/Source/WebKit/android/WebCoreSupport/WebRequest.cpp +++ b/Source/WebKit/android/WebCoreSupport/WebRequest.cpp @@ -395,8 +395,10 @@ void WebRequest::OnAuthRequired(net::URLRequest* request, net::AuthChallengeInfo bool firstTime = (m_authRequestCount == 0); ++m_authRequestCount; + bool suppressDialog = (request->load_flags() & net::LOAD_DO_NOT_PROMPT_FOR_LOGIN); + m_urlLoader->maybeCallOnMainThread(NewRunnableMethod( - m_urlLoader.get(), &WebUrlLoaderClient::authRequired, authInfoPtr, firstTime)); + m_urlLoader.get(), &WebUrlLoaderClient::authRequired, authInfoPtr, firstTime, suppressDialog)); } // Called when we received an SSL certificate error. The delegate will provide diff --git a/Source/WebKit/android/WebCoreSupport/WebResourceRequest.cpp b/Source/WebKit/android/WebCoreSupport/WebResourceRequest.cpp index 9b70fce..2ede1ca 100644 --- a/Source/WebKit/android/WebCoreSupport/WebResourceRequest.cpp +++ b/Source/WebKit/android/WebCoreSupport/WebResourceRequest.cpp @@ -62,6 +62,17 @@ WebResourceRequest::WebResourceRequest(const WebCore::ResourceRequest& resourceR } + switch (resourceRequest.targetType()) { + case ResourceRequest::TargetIsPrefetch: + m_loadFlags |= (net::LOAD_PREFETCH | net::LOAD_DO_NOT_PROMPT_FOR_LOGIN); + break; + case ResourceRequest::TargetIsFavicon: + m_loadFlags |= net::LOAD_DO_NOT_PROMPT_FOR_LOGIN; + break; + default: break; + } + + // Set the request headers const HTTPHeaderMap& map = resourceRequest.httpHeaderFields(); for (HTTPHeaderMap::const_iterator it = map.begin(); it != map.end(); ++it) { diff --git a/Source/WebKit/android/WebCoreSupport/WebUrlLoaderClient.cpp b/Source/WebKit/android/WebCoreSupport/WebUrlLoaderClient.cpp index 9ee0de2..56a9539 100644 --- a/Source/WebKit/android/WebCoreSupport/WebUrlLoaderClient.cpp +++ b/Source/WebKit/android/WebCoreSupport/WebUrlLoaderClient.cpp @@ -469,7 +469,7 @@ void WebUrlLoaderClient::didFinishLoading() finish(); } -void WebUrlLoaderClient::authRequired(scoped_refptr<net::AuthChallengeInfo> authChallengeInfo, bool firstTime) +void WebUrlLoaderClient::authRequired(scoped_refptr<net::AuthChallengeInfo> authChallengeInfo, bool firstTime, bool suppressDialog) { if (!isActive()) return; @@ -477,7 +477,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); - m_webFrame->didReceiveAuthenticationChallenge(this, host, realm, firstTime); + m_webFrame->didReceiveAuthenticationChallenge(this, host, realm, firstTime, suppressDialog); } void WebUrlLoaderClient::reportSslCertError(int cert_error, net::X509Certificate* cert) diff --git a/Source/WebKit/android/WebCoreSupport/WebUrlLoaderClient.h b/Source/WebKit/android/WebCoreSupport/WebUrlLoaderClient.h index dc7e8d5..5f03339 100644 --- a/Source/WebKit/android/WebCoreSupport/WebUrlLoaderClient.h +++ b/Source/WebKit/android/WebCoreSupport/WebUrlLoaderClient.h @@ -90,7 +90,7 @@ public: void didFinishLoading(); void didFail(PassOwnPtr<WebResponse>); void willSendRequest(PassOwnPtr<WebResponse>); - void authRequired(scoped_refptr<net::AuthChallengeInfo>, bool firstTime); + void authRequired(scoped_refptr<net::AuthChallengeInfo>, bool firstTime, bool suppressDialog); void reportSslCertError(int cert_error, net::X509Certificate* cert); void requestClientCert(net::SSLCertRequestInfo* cert); |