diff options
author | marja@chromium.org <marja@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-08 10:55:19 +0000 |
---|---|---|
committer | marja@chromium.org <marja@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-08 10:55:19 +0000 |
commit | 0a60884751e554f218bc88a4948c9d0a0d736375 (patch) | |
tree | 90b0f87f8aad4310be13425641b500ed11fd250a /content | |
parent | b3d0768e00a91fb32b4de82f7961b92a4d119383 (diff) | |
download | chromium_src-0a60884751e554f218bc88a4948c9d0a0d736375.zip chromium_src-0a60884751e554f218bc88a4948c9d0a0d736375.tar.gz chromium_src-0a60884751e554f218bc88a4948c9d0a0d736375.tar.bz2 |
Third-party appcache blocking.
BUG=72586
TEST=AppCacheHostTest.SelectCacheAllowed, AppCacheHostTest.SelectCacheBlocked, AppCacheRequestHandlerTest.MainResource_Blocked
Review URL: http://codereview.chromium.org/7720022
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@100131 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/browser/appcache/chrome_appcache_service.cc | 11 | ||||
-rw-r--r-- | content/browser/appcache/chrome_appcache_service.h | 7 | ||||
-rw-r--r-- | content/browser/content_browser_client.h | 1 | ||||
-rw-r--r-- | content/browser/mock_content_browser_client.cc | 3 | ||||
-rw-r--r-- | content/browser/mock_content_browser_client.h | 1 |
5 files changed, 14 insertions, 9 deletions
diff --git a/content/browser/appcache/chrome_appcache_service.cc b/content/browser/appcache/chrome_appcache_service.cc index dc9b793..41936ef 100644 --- a/content/browser/appcache/chrome_appcache_service.cc +++ b/content/browser/appcache/chrome_appcache_service.cc @@ -49,18 +49,19 @@ void ChromeAppCacheService::InitializeOnIOThread( ChromeAppCacheService::~ChromeAppCacheService() { } -bool ChromeAppCacheService::CanLoadAppCache(const GURL& manifest_url) { +bool ChromeAppCacheService::CanLoadAppCache(const GURL& manifest_url, + const GURL& first_party) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); // We don't prompt for read access. return content::GetContentClient()->browser()->AllowAppCache( - manifest_url, *resource_context_); + manifest_url, first_party, *resource_context_); } -int ChromeAppCacheService::CanCreateAppCache( - const GURL& manifest_url, net::CompletionCallback* callback) { +bool ChromeAppCacheService::CanCreateAppCache( + const GURL& manifest_url, const GURL& first_party) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); return content::GetContentClient()->browser()->AllowAppCache( - manifest_url, *resource_context_) ? net::OK : net::ERR_ACCESS_DENIED; + manifest_url, first_party, *resource_context_); } void ChromeAppCacheService::Observe(int type, diff --git a/content/browser/appcache/chrome_appcache_service.h b/content/browser/appcache/chrome_appcache_service.h index 51829f9..3aff0cf 100644 --- a/content/browser/appcache/chrome_appcache_service.h +++ b/content/browser/appcache/chrome_appcache_service.h @@ -49,9 +49,10 @@ class ChromeAppCacheService virtual ~ChromeAppCacheService(); // AppCachePolicy overrides - virtual bool CanLoadAppCache(const GURL& manifest_url); - virtual int CanCreateAppCache(const GURL& manifest_url, - net::CompletionCallback* callback); + virtual bool CanLoadAppCache(const GURL& manifest_url, + const GURL& first_party); + virtual bool CanCreateAppCache(const GURL& manifest_url, + const GURL& first_party); // NotificationObserver override virtual void Observe(int type, diff --git a/content/browser/content_browser_client.h b/content/browser/content_browser_client.h index 32fa117..787273e 100644 --- a/content/browser/content_browser_client.h +++ b/content/browser/content_browser_client.h @@ -146,6 +146,7 @@ class ContentBrowserClient { // Allow the embedder to control if an AppCache can be used for the given url. // This is called on the IO thread. virtual bool AllowAppCache(const GURL& manifest_url, + const GURL& first_party, const content::ResourceContext& context) = 0; // Allow the embedder to control if the given cookie can be read. diff --git a/content/browser/mock_content_browser_client.cc b/content/browser/mock_content_browser_client.cc index 1ab31c9..51d770f 100644 --- a/content/browser/mock_content_browser_client.cc +++ b/content/browser/mock_content_browser_client.cc @@ -87,7 +87,8 @@ SkBitmap* MockContentBrowserClient::GetDefaultFavicon() { } bool MockContentBrowserClient::AllowAppCache( - const GURL& manifest_url, const content::ResourceContext& context) { + const GURL& manifest_url, const GURL& first_party, + const content::ResourceContext& context) { return true; } diff --git a/content/browser/mock_content_browser_client.h b/content/browser/mock_content_browser_client.h index 4320592..8af7faa 100644 --- a/content/browser/mock_content_browser_client.h +++ b/content/browser/mock_content_browser_client.h @@ -42,6 +42,7 @@ class MockContentBrowserClient : public ContentBrowserClient { virtual std::string GetAcceptLangs(const TabContents* tab) OVERRIDE; virtual SkBitmap* GetDefaultFavicon() OVERRIDE; virtual bool AllowAppCache(const GURL& manifest_url, + const GURL& first_party, const content::ResourceContext& context) OVERRIDE; virtual bool AllowGetCookie(const GURL& url, const GURL& first_party, |