summaryrefslogtreecommitdiffstats
path: root/Source/WebKit/android/WebCoreSupport/WebResourceRequest.cpp
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2011-10-25 08:55:54 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-10-25 08:55:54 -0700
commit2a9675cb0ba09718f308bc6edff3e2b6a5170383 (patch)
tree1592b61d76ff5061f3e1ef3ee9767a87e8fc0a40 /Source/WebKit/android/WebCoreSupport/WebResourceRequest.cpp
parent5b0ee46e1ba2b63f6601cf65f96a75ba5991d768 (diff)
parente82298dad5b93e668a6dae26da91a7d2f942d0bb (diff)
downloadexternal_webkit-2a9675cb0ba09718f308bc6edff3e2b6a5170383.zip
external_webkit-2a9675cb0ba09718f308bc6edff3e2b6a5170383.tar.gz
external_webkit-2a9675cb0ba09718f308bc6edff3e2b6a5170383.tar.bz2
Merge "Report a load error when network loads blocked."
Diffstat (limited to 'Source/WebKit/android/WebCoreSupport/WebResourceRequest.cpp')
-rw-r--r--Source/WebKit/android/WebCoreSupport/WebResourceRequest.cpp35
1 files changed, 23 insertions, 12 deletions
diff --git a/Source/WebKit/android/WebCoreSupport/WebResourceRequest.cpp b/Source/WebKit/android/WebCoreSupport/WebResourceRequest.cpp
index 2ede1ca..663ded8 100644
--- a/Source/WebKit/android/WebCoreSupport/WebResourceRequest.cpp
+++ b/Source/WebKit/android/WebCoreSupport/WebResourceRequest.cpp
@@ -34,22 +34,33 @@ using namespace WebCore;
namespace android {
-WebResourceRequest::WebResourceRequest(const WebCore::ResourceRequest& resourceRequest)
+WebResourceRequest::WebResourceRequest(const WebCore::ResourceRequest& resourceRequest, bool shouldBlockNetworkLoads)
{
// Set the load flags based on the WebCore request.
m_loadFlags = net::LOAD_NORMAL;
- switch (resourceRequest.cachePolicy()) {
- case ReloadIgnoringCacheData:
- m_loadFlags |= net::LOAD_VALIDATE_CACHE;
- break;
- case ReturnCacheDataElseLoad:
- m_loadFlags |= net::LOAD_PREFERRING_CACHE;
- break;
- case ReturnCacheDataDontLoad:
+
+ if (shouldBlockNetworkLoads) {
+ // In the case that the embedder has blocked network loads, we only
+ // ever try to serve content out of the cache. If WebCore has set
+ // ReloadIgnoringCacheData, we would normally attempt to validate
+ // the cached data before serving it. In the absence of network
+ // we can't do that, so we will just return whatever we have in the
+ // cache (which may well be nothing).
m_loadFlags |= net::LOAD_ONLY_FROM_CACHE;
- break;
- case UseProtocolCachePolicy:
- break;
+ } else {
+ switch (resourceRequest.cachePolicy()) {
+ case ReloadIgnoringCacheData:
+ m_loadFlags |= net::LOAD_VALIDATE_CACHE;
+ break;
+ case ReturnCacheDataElseLoad:
+ m_loadFlags |= net::LOAD_PREFERRING_CACHE;
+ break;
+ case ReturnCacheDataDontLoad:
+ m_loadFlags |= net::LOAD_ONLY_FROM_CACHE;
+ break;
+ case UseProtocolCachePolicy:
+ break;
+ }
}
// TODO: We should consider setting these flags and net::LOAD_DO_NOT_SEND_AUTH_DATA