summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/automation/testing_automation_provider.cc1
-rw-r--r--chrome/browser/browsing_data_remover.h1
-rw-r--r--chrome/browser/chrome_content_browser_client.cc10
-rw-r--r--chrome/browser/chrome_content_browser_client.h2
-rw-r--r--chrome/browser/cookies_tree_model.cc1
-rw-r--r--chrome/browser/cookies_tree_model.h2
-rw-r--r--chrome/browser/cookies_tree_model_unittest.cc1
-rw-r--r--chrome/browser/extensions/extension_service_unittest.cc2
-rw-r--r--chrome/browser/net/chrome_url_request_context.h2
-rw-r--r--chrome/browser/profiles/off_the_record_profile_io_data.cc4
-rw-r--r--chrome/browser/profiles/profile.cc2
-rw-r--r--chrome/browser/profiles/profile_impl.cc2
-rw-r--r--chrome/browser/profiles/profile_impl_io_data.cc4
-rw-r--r--chrome/browser/profiles/profile_io_data.cc1
-rw-r--r--chrome/browser/ui/cocoa/content_settings/collected_cookies_mac.mm1
-rw-r--r--chrome/browser/ui/gtk/collected_cookies_gtk.cc1
-rw-r--r--chrome/browser/ui/views/collected_cookies_win.cc1
-rw-r--r--chrome/browser/ui/webui/collected_cookies_ui_delegate.cc1
-rw-r--r--content/browser/appcache/chrome_appcache_service.cc20
-rw-r--r--content/browser/appcache/chrome_appcache_service.h10
-rw-r--r--content/browser/appcache/chrome_appcache_service_unittest.cc6
-rw-r--r--content/browser/content_browser_client.cc5
-rw-r--r--content/browser/content_browser_client.h6
23 files changed, 64 insertions, 22 deletions
diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc
index fd421ab..6e9aac8 100644
--- a/chrome/browser/automation/testing_automation_provider.cc
+++ b/chrome/browser/automation/testing_automation_provider.cc
@@ -41,6 +41,7 @@
#include "chrome/browser/bookmarks/bookmark_storage.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_shutdown.h"
+#include "chrome/browser/content_settings/host_content_settings_map.h"
#include "chrome/browser/debugger/devtools_manager.h"
#include "chrome/browser/download/download_prefs.h"
#include "chrome/browser/download/download_shelf.h"
diff --git a/chrome/browser/browsing_data_remover.h b/chrome/browser/browsing_data_remover.h
index 6d83a84..a563c9a 100644
--- a/chrome/browser/browsing_data_remover.h
+++ b/chrome/browser/browsing_data_remover.h
@@ -14,6 +14,7 @@
#include "base/time.h"
#include "content/browser/appcache/chrome_appcache_service.h"
#include "content/browser/cancelable_request.h"
+#include "content/common/notification_observer.h"
#include "content/common/notification_registrar.h"
class ExtensionSpecialStoragePolicy;
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index 5f3a3ab..be93cc2 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -9,6 +9,7 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/character_encoding.h"
#include "chrome/browser/chrome_worker_message_filter.h"
+#include "chrome/browser/content_settings/host_content_settings_map.h"
#include "chrome/browser/debugger/devtools_handler.h"
#include "chrome/browser/desktop_notification_handler.h"
#include "chrome/browser/extensions/extension_message_handler.h"
@@ -28,6 +29,7 @@
#include "chrome/common/pref_names.h"
#include "content/browser/renderer_host/browser_render_process_host.h"
#include "content/browser/renderer_host/render_view_host.h"
+#include "content/browser/resource_context.h"
#include "content/browser/tab_contents/tab_contents.h"
#include "content/browser/worker_host/worker_process_host.h"
@@ -180,6 +182,14 @@ std::string ChromeContentBrowserClient::GetApplicationLocale() {
return g_browser_process->GetApplicationLocale();
}
+bool ChromeContentBrowserClient::AllowAppCache(
+ const GURL& manifest_url, const content::ResourceContext* context) {
+ ContentSetting setting = context->host_content_settings_map()->
+ GetContentSetting(manifest_url, CONTENT_SETTINGS_TYPE_COOKIES, "");
+ DCHECK(setting != CONTENT_SETTING_DEFAULT);
+ return setting != CONTENT_SETTING_BLOCK;
+}
+
#if defined(OS_LINUX)
int ChromeContentBrowserClient::GetCrashSignalFD(
const std::string& process_type) {
diff --git a/chrome/browser/chrome_content_browser_client.h b/chrome/browser/chrome_content_browser_client.h
index 48ea5ab..050def3 100644
--- a/chrome/browser/chrome_content_browser_client.h
+++ b/chrome/browser/chrome_content_browser_client.h
@@ -26,6 +26,8 @@ class ChromeContentBrowserClient : public content::ContentBrowserClient {
virtual void AppendExtraCommandLineSwitches(CommandLine* command_line,
int child_process_id);
virtual std::string GetApplicationLocale();
+ virtual bool AllowAppCache(const GURL& manifest_url,
+ const content::ResourceContext* context);
#if defined(OS_LINUX)
// Can return an optional fd for crash handling, otherwise returns -1.
virtual int GetCrashSignalFD(const std::string& process_type);
diff --git a/chrome/browser/cookies_tree_model.cc b/chrome/browser/cookies_tree_model.cc
index 80c2c8a..2760059 100644
--- a/chrome/browser/cookies_tree_model.cc
+++ b/chrome/browser/cookies_tree_model.cc
@@ -12,6 +12,7 @@
#include "base/memory/linked_ptr.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
+#include "chrome/browser/content_settings/host_content_settings_map.h"
#include "chrome/browser/extensions/extension_service.h"
#include "content/browser/in_process_webkit/webkit_context.h"
#include "grit/app_resources.h"
diff --git a/chrome/browser/cookies_tree_model.h b/chrome/browser/cookies_tree_model.h
index f04d8194..9515f51 100644
--- a/chrome/browser/cookies_tree_model.h
+++ b/chrome/browser/cookies_tree_model.h
@@ -20,6 +20,7 @@
#include "chrome/browser/browsing_data_database_helper.h"
#include "chrome/browser/browsing_data_indexed_db_helper.h"
#include "chrome/browser/browsing_data_local_storage_helper.h"
+#include "chrome/common/content_settings.h"
#include "net/base/cookie_monster.h"
#include "ui/base/models/tree_node_model.h"
@@ -37,6 +38,7 @@ class CookieTreeSessionStoragesNode;
class CookieTreeIndexedDBNode;
class CookieTreeIndexedDBsNode;
class CookieTreeOriginNode;
+class HostContentSettingsMap;
// CookieTreeNode -------------------------------------------------------------
// The base node type in the Cookies, Databases, and Local Storage options
diff --git a/chrome/browser/cookies_tree_model_unittest.cc b/chrome/browser/cookies_tree_model_unittest.cc
index 93333cb..d30c136 100644
--- a/chrome/browser/cookies_tree_model_unittest.cc
+++ b/chrome/browser/cookies_tree_model_unittest.cc
@@ -6,6 +6,7 @@
#include <string>
+#include "chrome/browser/content_settings/host_content_settings_map.h"
#include "chrome/browser/content_settings/stub_settings_observer.h"
#include "chrome/browser/mock_browsing_data_appcache_helper.h"
#include "chrome/browser/mock_browsing_data_database_helper.h"
diff --git a/chrome/browser/extensions/extension_service_unittest.cc b/chrome/browser/extensions/extension_service_unittest.cc
index bc4bdde..aa55653 100644
--- a/chrome/browser/extensions/extension_service_unittest.cc
+++ b/chrome/browser/extensions/extension_service_unittest.cc
@@ -352,7 +352,7 @@ class ExtensionTestingProfile : public TestingProfile {
&ChromeAppCacheService::InitializeOnIOThread,
IsOffTheRecord()
? FilePath() : GetPath().Append(chrome::kAppCacheDirname),
- make_scoped_refptr(GetHostContentSettingsMap()),
+ &GetResourceContext(),
make_scoped_refptr(GetExtensionSpecialStoragePolicy()),
false)))
NOTREACHED();
diff --git a/chrome/browser/net/chrome_url_request_context.h b/chrome/browser/net/chrome_url_request_context.h
index b60d37a..7b2c287 100644
--- a/chrome/browser/net/chrome_url_request_context.h
+++ b/chrome/browser/net/chrome_url_request_context.h
@@ -18,6 +18,8 @@
#include "chrome/common/extensions/extension_icon_set.h"
#include "content/browser/appcache/chrome_appcache_service.h"
#include "content/browser/chrome_blob_storage_context.h"
+#include "content/common/notification_observer.h"
+#include "content/common/notification_registrar.h"
#include "net/base/cookie_policy.h"
#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_context_getter.h"
diff --git a/chrome/browser/profiles/off_the_record_profile_io_data.cc b/chrome/browser/profiles/off_the_record_profile_io_data.cc
index 017ecd2..a2d5a99 100644
--- a/chrome/browser/profiles/off_the_record_profile_io_data.cc
+++ b/chrome/browser/profiles/off_the_record_profile_io_data.cc
@@ -49,7 +49,9 @@ OffTheRecordProfileIOData::Handle::~Handle() {
const content::ResourceContext&
OffTheRecordProfileIOData::Handle::GetResourceContext() const {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- LazyInitialize();
+ // Don't call LazyInitialize here, since the resource context is created at
+ // the beginning of initalization and is used by some members while they're
+ // being initialized (i.e. AppCacheService).
return io_data_->GetResourceContext();
}
diff --git a/chrome/browser/profiles/profile.cc b/chrome/browser/profiles/profile.cc
index 6f28f42..f83b7f2 100644
--- a/chrome/browser/profiles/profile.cc
+++ b/chrome/browser/profiles/profile.cc
@@ -248,7 +248,7 @@ class OffTheRecordProfileImpl : public Profile,
&ChromeAppCacheService::InitializeOnIOThread,
IsOffTheRecord()
? FilePath() : GetPath().Append(chrome::kAppCacheDirname),
- make_scoped_refptr(GetHostContentSettingsMap()),
+ &GetResourceContext(),
make_scoped_refptr(GetExtensionSpecialStoragePolicy()),
false));
}
diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc
index 170eaa3..8f56eef 100644
--- a/chrome/browser/profiles/profile_impl.cc
+++ b/chrome/browser/profiles/profile_impl.cc
@@ -715,7 +715,7 @@ ChromeAppCacheService* ProfileImpl::GetAppCacheService() {
&ChromeAppCacheService::InitializeOnIOThread,
IsOffTheRecord()
? FilePath() : GetPath().Append(chrome::kAppCacheDirname),
- make_scoped_refptr(GetHostContentSettingsMap()),
+ &GetResourceContext(),
make_scoped_refptr(GetExtensionSpecialStoragePolicy()),
clear_local_state_on_exit_));
}
diff --git a/chrome/browser/profiles/profile_impl_io_data.cc b/chrome/browser/profiles/profile_impl_io_data.cc
index 8864427..b295fc2 100644
--- a/chrome/browser/profiles/profile_impl_io_data.cc
+++ b/chrome/browser/profiles/profile_impl_io_data.cc
@@ -76,7 +76,9 @@ void ProfileImplIOData::Handle::Init(const FilePath& cookie_path,
const content::ResourceContext&
ProfileImplIOData::Handle::GetResourceContext() const {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- LazyInitialize();
+ // Don't call LazyInitialize here, since the resource context is created at
+ // the beginning of initalization and is used by some members while they're
+ // being initialized (i.e. AppCacheService).
return io_data_->GetResourceContext();
}
diff --git a/chrome/browser/profiles/profile_io_data.cc b/chrome/browser/profiles/profile_io_data.cc
index e6460da..f1bb1db 100644
--- a/chrome/browser/profiles/profile_io_data.cc
+++ b/chrome/browser/profiles/profile_io_data.cc
@@ -13,6 +13,7 @@
#include "base/stl_util-inl.h"
#include "base/string_number_conversions.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/content_settings/host_content_settings_map.h"
#include "chrome/browser/custom_handlers/protocol_handler_registry.h"
#include "chrome/browser/extensions/user_script_master.h"
#include "chrome/browser/io_thread.h"
diff --git a/chrome/browser/ui/cocoa/content_settings/collected_cookies_mac.mm b/chrome/browser/ui/cocoa/content_settings/collected_cookies_mac.mm
index 7cf857c..ff1c330 100644
--- a/chrome/browser/ui/cocoa/content_settings/collected_cookies_mac.mm
+++ b/chrome/browser/ui/cocoa/content_settings/collected_cookies_mac.mm
@@ -8,6 +8,7 @@
#import "base/mac/mac_util.h"
#include "base/sys_string_conversions.h"
+#include "chrome/browser/content_settings/host_content_settings_map.h"
#include "chrome/browser/content_settings/tab_specific_content_settings.h"
#include "chrome/browser/profiles/profile.h"
#import "chrome/browser/ui/cocoa/content_settings/cookie_details_view_controller.h"
diff --git a/chrome/browser/ui/gtk/collected_cookies_gtk.cc b/chrome/browser/ui/gtk/collected_cookies_gtk.cc
index 4431fca..53cfea6 100644
--- a/chrome/browser/ui/gtk/collected_cookies_gtk.cc
+++ b/chrome/browser/ui/gtk/collected_cookies_gtk.cc
@@ -6,6 +6,7 @@
#include <string>
+#include "chrome/browser/content_settings/host_content_settings_map.h"
#include "chrome/browser/content_settings/tab_specific_content_settings.h"
#include "chrome/browser/cookies_tree_model.h"
#include "chrome/browser/profiles/profile.h"
diff --git a/chrome/browser/ui/views/collected_cookies_win.cc b/chrome/browser/ui/views/collected_cookies_win.cc
index ea27282..ef99ffa 100644
--- a/chrome/browser/ui/views/collected_cookies_win.cc
+++ b/chrome/browser/ui/views/collected_cookies_win.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/ui/views/collected_cookies_win.h"
+#include "chrome/browser/content_settings/host_content_settings_map.h"
#include "chrome/browser/content_settings/tab_specific_content_settings.h"
#include "chrome/browser/cookies_tree_model.h"
#include "chrome/browser/profiles/profile.h"
diff --git a/chrome/browser/ui/webui/collected_cookies_ui_delegate.cc b/chrome/browser/ui/webui/collected_cookies_ui_delegate.cc
index 95fff22..88441fc 100644
--- a/chrome/browser/ui/webui/collected_cookies_ui_delegate.cc
+++ b/chrome/browser/ui/webui/collected_cookies_ui_delegate.cc
@@ -7,6 +7,7 @@
#include "base/message_loop.h"
#include "base/string_util.h"
#include "base/values.h"
+#include "chrome/browser/content_settings/host_content_settings_map.h"
#include "chrome/browser/content_settings/tab_specific_content_settings.h"
#include "chrome/browser/cookies_tree_model.h"
#include "chrome/browser/profiles/profile.h"
diff --git a/content/browser/appcache/chrome_appcache_service.cc b/content/browser/appcache/chrome_appcache_service.cc
index 0e8a0f0..b829a92 100644
--- a/content/browser/appcache/chrome_appcache_service.cc
+++ b/content/browser/appcache/chrome_appcache_service.cc
@@ -6,6 +6,7 @@
#include "base/file_path.h"
#include "base/file_util.h"
+#include "content/browser/content_browser_client.h"
#include "content/common/notification_service.h"
#include "net/base/net_errors.h"
#include "webkit/appcache/appcache_thread.h"
@@ -29,12 +30,12 @@ void DeleteLocalStateOnIOThread(FilePath cache_path) {
// ----------------------------------------------------------------------------
ChromeAppCacheService::ChromeAppCacheService()
- : clear_local_state_on_exit_(false) {
+ : resource_context_(NULL), clear_local_state_on_exit_(false) {
}
void ChromeAppCacheService::InitializeOnIOThread(
const FilePath& cache_path,
- scoped_refptr<HostContentSettingsMap> content_settings_map,
+ const content::ResourceContext* resource_context,
scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy,
bool clear_local_state_on_exit) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
@@ -45,7 +46,7 @@ void ChromeAppCacheService::InitializeOnIOThread(
}
cache_path_ = cache_path;
- host_contents_settings_map_ = content_settings_map;
+ resource_context_ = resource_context;
registrar_.Add(
this, NotificationType::PURGE_MEMORY, NotificationService::AllSources());
SetClearLocalStateOnExit(clear_local_state_on_exit);
@@ -82,21 +83,16 @@ void ChromeAppCacheService::SetClearLocalStateOnExit(bool clear_local_state) {
bool ChromeAppCacheService::CanLoadAppCache(const GURL& manifest_url) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- ContentSetting setting = host_contents_settings_map_->GetContentSetting(
- manifest_url, CONTENT_SETTINGS_TYPE_COOKIES, "");
- DCHECK(setting != CONTENT_SETTING_DEFAULT);
// We don't prompt for read access.
- return setting != CONTENT_SETTING_BLOCK;
+ return content::GetContentClient()->browser()->AllowAppCache(
+ manifest_url, resource_context_);
}
int ChromeAppCacheService::CanCreateAppCache(
const GURL& manifest_url, net::CompletionCallback* callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- ContentSetting setting = host_contents_settings_map_->GetContentSetting(
- manifest_url, CONTENT_SETTINGS_TYPE_COOKIES, "");
- DCHECK(setting != CONTENT_SETTING_DEFAULT);
- return (setting != CONTENT_SETTING_BLOCK) ? net::OK :
- net::ERR_ACCESS_DENIED;
+ return content::GetContentClient()->browser()->AllowAppCache(
+ manifest_url, resource_context_) ? net::OK : net::ERR_ACCESS_DENIED;
}
void ChromeAppCacheService::Observe(NotificationType type,
diff --git a/content/browser/appcache/chrome_appcache_service.h b/content/browser/appcache/chrome_appcache_service.h
index 6b0c1e9..a56d31c 100644
--- a/content/browser/appcache/chrome_appcache_service.h
+++ b/content/browser/appcache/chrome_appcache_service.h
@@ -7,8 +7,8 @@
#pragma once
#include "base/memory/ref_counted.h"
-#include "chrome/browser/content_settings/host_content_settings_map.h"
#include "content/browser/browser_thread.h"
+#include "content/common/notification_observer.h"
#include "content/common/notification_registrar.h"
#include "webkit/appcache/appcache_policy.h"
#include "webkit/appcache/appcache_service.h"
@@ -16,6 +16,10 @@
class FilePath;
+namespace content {
+class ResourceContext;
+}
+
// An AppCacheService subclass used by the chrome. There is an instance
// associated with each Profile. This derivation adds refcounting semantics
// since a profile has multiple URLRequestContexts which refer to the same
@@ -35,7 +39,7 @@ class ChromeAppCacheService
void InitializeOnIOThread(
const FilePath& cache_path, // may be empty to use in-memory structures
- scoped_refptr<HostContentSettingsMap> content_settings_map,
+ const content::ResourceContext* resource_context,
scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy,
bool clear_local_state_on_exit);
@@ -57,7 +61,7 @@ class ChromeAppCacheService
const NotificationSource& source,
const NotificationDetails& details);
- scoped_refptr<HostContentSettingsMap> host_contents_settings_map_;
+ const content::ResourceContext* resource_context_;
NotificationRegistrar registrar_;
bool clear_local_state_on_exit_;
FilePath cache_path_;
diff --git a/content/browser/appcache/chrome_appcache_service_unittest.cc b/content/browser/appcache/chrome_appcache_service_unittest.cc
index 3e4a975..475bf5c 100644
--- a/content/browser/appcache/chrome_appcache_service_unittest.cc
+++ b/content/browser/appcache/chrome_appcache_service_unittest.cc
@@ -43,12 +43,13 @@ TEST_F(ChromeAppCacheServiceTest, KeepOnDestruction) {
FilePath appcache_path = temp_dir_.path().Append(chrome::kAppCacheDirname);
scoped_refptr<ChromeAppCacheService> appcache_service =
new ChromeAppCacheService;
+ const content::ResourceContext* resource_context = NULL;
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
NewRunnableMethod(appcache_service.get(),
&ChromeAppCacheService::InitializeOnIOThread,
appcache_path,
- scoped_refptr<HostContentSettingsMap>(NULL),
+ resource_context,
scoped_refptr<quota::SpecialStoragePolicy>(NULL),
false));
// Make the steps needed to initialize the storage of AppCache data.
@@ -74,12 +75,13 @@ TEST_F(ChromeAppCacheServiceTest, RemoveOnDestruction) {
FilePath appcache_path = temp_dir_.path().Append(chrome::kAppCacheDirname);
scoped_refptr<ChromeAppCacheService> appcache_service =
new ChromeAppCacheService;
+ const content::ResourceContext* resource_context = NULL;
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
NewRunnableMethod(appcache_service.get(),
&ChromeAppCacheService::InitializeOnIOThread,
appcache_path,
- scoped_refptr<HostContentSettingsMap>(NULL),
+ resource_context,
scoped_refptr<quota::SpecialStoragePolicy>(NULL),
true));
// Make the steps needed to initialize the storage of AppCache data.
diff --git a/content/browser/content_browser_client.cc b/content/browser/content_browser_client.cc
index 9cb40e8..2f6d597 100644
--- a/content/browser/content_browser_client.cc
+++ b/content/browser/content_browser_client.cc
@@ -52,6 +52,11 @@ std::string ContentBrowserClient::GetApplicationLocale() {
return std::string();
}
+bool ContentBrowserClient::AllowAppCache(
+ const GURL& manifest_url, const content::ResourceContext* context) {
+ return true;
+}
+
#if defined(OS_LINUX)
int ContentBrowserClient::GetCrashSignalFD(const std::string& process_type) {
return -1;
diff --git a/content/browser/content_browser_client.h b/content/browser/content_browser_client.h
index 2bc9537..145952b 100644
--- a/content/browser/content_browser_client.h
+++ b/content/browser/content_browser_client.h
@@ -20,6 +20,7 @@ class WorkerProcessHost;
namespace content {
+class ResourceContext;
class WebUIFactory;
// Embedder API for participating in browser logic.
@@ -61,6 +62,11 @@ class ContentBrowserClient {
// Returns the locale used by the application.
virtual std::string GetApplicationLocale();
+ // 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 content::ResourceContext* context);
+
#if defined(OS_LINUX)
// Can return an optional fd for crash handling, otherwise returns -1.
virtual int GetCrashSignalFD(const std::string& process_type);