Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Unified Diff: webkit/appcache/appcache_service.cc

Issue 7720022: Third-party appcache blocking. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Keeping up to date with trunk. Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/appcache/appcache_service.h ('k') | webkit/appcache/appcache_storage.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/appcache/appcache_service.cc
diff --git a/webkit/appcache/appcache_service.cc b/webkit/appcache/appcache_service.cc
index eca61c5a58e08e091b4448689c57cf60e4d91564..73552c9cd4bc94fba8d9c27a6a3a4ab97c2db06d 100644
--- a/webkit/appcache/appcache_service.cc
+++ b/webkit/appcache/appcache_service.cc
@@ -12,6 +12,7 @@
#include "webkit/appcache/appcache_backend_impl.h"
#include "webkit/appcache/appcache_entry.h"
#include "webkit/appcache/appcache_histograms.h"
+#include "webkit/appcache/appcache_policy.h"
#include "webkit/appcache/appcache_quota_client.h"
#include "webkit/appcache/appcache_response.h"
#include "webkit/appcache/appcache_storage_impl.h"
@@ -77,11 +78,17 @@ class AppCacheService::CanHandleOfflineHelper : AsyncHelper {
public:
CanHandleOfflineHelper(
AppCacheService* service, const GURL& url,
- net::CompletionCallback* callback)
- : AsyncHelper(service, callback), url_(url) {
+ const GURL& first_party, net::CompletionCallback* callback)
+ : AsyncHelper(service, callback), url_(url), first_party_(first_party) {
}
virtual void Start() {
+ AppCachePolicy* policy = service_->appcache_policy();
+ if (policy && !policy->CanLoadAppCache(url_, first_party_)) {
+ CallCallback(net::ERR_FAILED);
+ delete this;
+ return;
+ }
service_->storage()->FindResponseForMainRequest(url_, GURL(), this);
}
@@ -90,20 +97,18 @@ class AppCacheService::CanHandleOfflineHelper : AsyncHelper {
virtual void OnMainResponseFound(
const GURL& url, const AppCacheEntry& entry,
const GURL& fallback_url, const AppCacheEntry& fallback_entry,
- int64 cache_id, const GURL& mainfest_url,
- bool was_blocked_by_policy);
+ int64 cache_id, const GURL& mainfest_url);
GURL url_;
+ GURL first_party_;
DISALLOW_COPY_AND_ASSIGN(CanHandleOfflineHelper);
};
void AppCacheService::CanHandleOfflineHelper::OnMainResponseFound(
const GURL& url, const AppCacheEntry& entry,
const GURL& fallback_url, const AppCacheEntry& fallback_entry,
- int64 cache_id, const GURL& mainfest_url,
- bool was_blocked_by_policy) {
- bool can = !was_blocked_by_policy &&
- (entry.has_response_id() || fallback_entry.has_response_id());
+ int64 cache_id, const GURL& manifest_url) {
+ bool can = (entry.has_response_id() || fallback_entry.has_response_id());
CallCallback(can ? net::OK : net::ERR_FAILED);
delete this;
}
@@ -438,9 +443,10 @@ void AppCacheService::Initialize(const FilePath& cache_directory,
void AppCacheService::CanHandleMainResourceOffline(
const GURL& url,
+ const GURL& first_party,
net::CompletionCallback* callback) {
CanHandleOfflineHelper* helper =
- new CanHandleOfflineHelper(this, url, callback);
+ new CanHandleOfflineHelper(this, url, first_party, callback);
helper->Start();
}
« no previous file with comments | « webkit/appcache/appcache_service.h ('k') | webkit/appcache/appcache_storage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698