summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/DEPS2
-rw-r--r--chrome/browser/browsing_data_appcache_helper.cc10
-rw-r--r--chrome/browser/browsing_data_appcache_helper.h8
-rw-r--r--chrome/browser/browsing_data_remover.h2
-rw-r--r--chrome/browser/extensions/extension_data_deleter.cc12
-rw-r--r--chrome/browser/extensions/extension_data_deleter.h13
-rw-r--r--chrome/browser/extensions/extension_service_unittest.cc4
-rw-r--r--chrome/browser/profiles/off_the_record_profile_io_data.cc23
-rw-r--r--chrome/browser/profiles/profile_impl.cc10
-rw-r--r--chrome/browser/profiles/profile_impl_io_data.cc41
-rw-r--r--chrome/browser/profiles/profile_io_data.cc80
-rw-r--r--chrome/browser/profiles/profile_io_data.h37
-rw-r--r--chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc2
-rw-r--r--chrome/browser/renderer_host/offline_resource_throttle.cc19
-rw-r--r--chrome/browser/renderer_host/offline_resource_throttle.h9
-rw-r--r--chrome/browser/ui/cocoa/content_settings/collected_cookies_mac.h1
-rw-r--r--chrome/browser/ui/webui/chrome_url_data_manager_backend.cc10
-rw-r--r--chrome/browser/ui/webui/chrome_url_data_manager_backend.h7
18 files changed, 109 insertions, 181 deletions
diff --git a/chrome/browser/DEPS b/chrome/browser/DEPS
index 2202077..8c62d46 100644
--- a/chrome/browser/DEPS
+++ b/chrome/browser/DEPS
@@ -35,10 +35,8 @@ include_rules = [
"+content/browser/accessibility/browser_accessibility_cocoa.h",
"+content/browser/accessibility/browser_accessibility_manager.h",
"+content/browser/accessibility/browser_accessibility_state.h",
- "+content/browser/appcache/chrome_appcache_service.h",
"+content/browser/browser_url_handler.h",
"+content/browser/cert_store.h",
- "+content/browser/chrome_blob_storage_context.h",
"+content/browser/disposition_utils.h",
"+content/browser/download/download_buffer.h",
"+content/browser/download/download_create_info.h",
diff --git a/chrome/browser/browsing_data_appcache_helper.cc b/chrome/browser/browsing_data_appcache_helper.cc
index 148fa85..153fa40 100644
--- a/chrome/browser/browsing_data_appcache_helper.cc
+++ b/chrome/browser/browsing_data_appcache_helper.cc
@@ -9,16 +9,18 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/url_constants.h"
#include "content/public/browser/browser_thread.h"
+#include "content/public/browser/resource_context.h"
#include "webkit/appcache/appcache_database.h"
#include "webkit/appcache/appcache_storage.h"
using appcache::AppCacheDatabase;
using content::BrowserContext;
using content::BrowserThread;
+using content::ResourceContext;
BrowsingDataAppCacheHelper::BrowsingDataAppCacheHelper(Profile* profile)
: is_fetching_(false),
- appcache_service_(BrowserContext::GetAppCacheService(profile)) {
+ resource_context_(profile->GetResourceContext()) {
}
void BrowsingDataAppCacheHelper::StartFetching(const base::Closure& callback) {
@@ -38,8 +40,8 @@ void BrowsingDataAppCacheHelper::StartFetching(const base::Closure& callback) {
appcache_info_callback_.Reset(
base::Bind(&BrowsingDataAppCacheHelper::OnFetchComplete,
base::Unretained(this)));
- appcache_service_->GetAllAppCacheInfo(info_collection_,
- appcache_info_callback_.callback());
+ ResourceContext::GetAppCacheService(resource_context_)->
+ GetAllAppCacheInfo(info_collection_, appcache_info_callback_.callback());
}
void BrowsingDataAppCacheHelper::CancelNotification() {
@@ -64,7 +66,7 @@ void BrowsingDataAppCacheHelper::DeleteAppCacheGroup(
return;
}
- appcache_service_->DeleteAppCacheGroup(
+ ResourceContext::GetAppCacheService(resource_context_)->DeleteAppCacheGroup(
manifest_url, net::CompletionCallback());
}
diff --git a/chrome/browser/browsing_data_appcache_helper.h b/chrome/browser/browsing_data_appcache_helper.h
index a5f703a..07c00c4 100644
--- a/chrome/browser/browsing_data_appcache_helper.h
+++ b/chrome/browser/browsing_data_appcache_helper.h
@@ -8,12 +8,16 @@
#include "base/callback.h"
#include "base/memory/scoped_ptr.h"
-#include "content/browser/appcache/chrome_appcache_service.h"
#include "net/base/completion_callback.h"
#include "googleurl/src/gurl.h"
+#include "webkit/appcache/appcache_service.h"
class Profile;
+namespace content {
+class ResourceContext;
+}
+
// This class fetches appcache information on behalf of a caller
// on the UI thread.
class BrowsingDataAppCacheHelper
@@ -41,7 +45,7 @@ class BrowsingDataAppCacheHelper
void OnFetchComplete(int rv);
bool is_fetching_;
- scoped_refptr<ChromeAppCacheService> appcache_service_;
+ content::ResourceContext* resource_context_;
net::CancelableCompletionCallback appcache_info_callback_;
DISALLOW_COPY_AND_ASSIGN(BrowsingDataAppCacheHelper);
diff --git a/chrome/browser/browsing_data_remover.h b/chrome/browser/browsing_data_remover.h
index 40b3c25..de973ba 100644
--- a/chrome/browser/browsing_data_remover.h
+++ b/chrome/browser/browsing_data_remover.h
@@ -15,9 +15,9 @@
#include "base/time.h"
#include "chrome/browser/cancelable_request.h"
#include "chrome/browser/prefs/pref_member.h"
-#include "content/browser/appcache/chrome_appcache_service.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
+#include "googleurl/src/gurl.h"
#include "webkit/quota/quota_types.h"
class ExtensionSpecialStoragePolicy;
diff --git a/chrome/browser/extensions/extension_data_deleter.cc b/chrome/browser/extensions/extension_data_deleter.cc
index da69e21..7e6c1be 100644
--- a/chrome/browser/extensions/extension_data_deleter.cc
+++ b/chrome/browser/extensions/extension_data_deleter.cc
@@ -12,19 +12,21 @@
#include "chrome/common/chrome_constants.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/url_constants.h"
-#include "content/browser/appcache/chrome_appcache_service.h"
#include "content/browser/in_process_webkit/webkit_context.h"
+#include "content/public/browser/resource_context.h"
#include "net/base/completion_callback.h"
#include "net/base/cookie_monster.h"
#include "net/base/net_errors.h"
#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_context_getter.h"
+#include "webkit/appcache/appcache_service.h"
#include "webkit/database/database_tracker.h"
#include "webkit/database/database_util.h"
#include "webkit/fileapi/file_system_context.h"
using content::BrowserContext;
using content::BrowserThread;
+using content::ResourceContext;
// static
void ExtensionDataDeleter::StartDeleting(
@@ -66,7 +68,8 @@ void ExtensionDataDeleter::StartDeleting(
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
base::Bind(
- &ExtensionDataDeleter::DeleteAppcachesOnIOThread, deleter));
+ &ExtensionDataDeleter::DeleteAppcachesOnIOThread, deleter,
+ profile->GetResourceContext()));
profile->GetExtensionService()->settings_frontend()->
DeleteStorageSoon(extension_id);
@@ -78,7 +81,6 @@ ExtensionDataDeleter::ExtensionDataDeleter(
const GURL& storage_origin,
bool is_storage_isolated)
: extension_id_(extension_id) {
- appcache_service_ = BrowserContext::GetAppCacheService(profile);
webkit_context_ = BrowserContext::GetWebKitContext(profile);
database_tracker_ = BrowserContext::GetDatabaseTracker(profile);
// Pick the right request context depending on whether it's an extension,
@@ -142,8 +144,8 @@ void ExtensionDataDeleter::DeleteFileSystemOnFileThread() {
file_util::Delete(isolated_app_path_, true);
}
-void ExtensionDataDeleter::DeleteAppcachesOnIOThread() {
+void ExtensionDataDeleter::DeleteAppcachesOnIOThread(ResourceContext* context) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- appcache_service_->DeleteAppCachesForOrigin(
+ ResourceContext::GetAppCacheService(context)->DeleteAppCachesForOrigin(
storage_origin_, net::CompletionCallback());
}
diff --git a/chrome/browser/extensions/extension_data_deleter.h b/chrome/browser/extensions/extension_data_deleter.h
index 851352c..ec9a77b 100644
--- a/chrome/browser/extensions/extension_data_deleter.h
+++ b/chrome/browser/extensions/extension_data_deleter.h
@@ -13,8 +13,8 @@
#include "content/public/browser/browser_thread.h"
#include "googleurl/src/gurl.h"
-namespace webkit_database {
-class DatabaseTracker;
+namespace content {
+class ResourceContext;
}
namespace fileapi {
@@ -25,7 +25,10 @@ namespace net {
class URLRequestContextGetter;
}
-class ChromeAppCacheService;
+namespace webkit_database {
+class DatabaseTracker;
+}
+
class Profile;
class WebKitContext;
@@ -80,7 +83,7 @@ class ExtensionDataDeleter
// Deletes appcache files for the extension. May only be called on the IO
// thread.
- void DeleteAppcachesOnIOThread();
+ void DeleteAppcachesOnIOThread(content::ResourceContext* resource_context);
// The ID of the extension being deleted.
const std::string extension_id_;
@@ -102,8 +105,6 @@ class ExtensionDataDeleter
scoped_refptr<fileapi::FileSystemContext> file_system_context_;
- scoped_refptr<ChromeAppCacheService> appcache_service_;
-
// If non-empty, the extension we're deleting is an isolated app, and this
// is its directory which we should delete.
FilePath isolated_app_path_;
diff --git a/chrome/browser/extensions/extension_service_unittest.cc b/chrome/browser/extensions/extension_service_unittest.cc
index d18a3202..37187c2 100644
--- a/chrome/browser/extensions/extension_service_unittest.cc
+++ b/chrome/browser/extensions/extension_service_unittest.cc
@@ -60,7 +60,6 @@
#include "chrome/common/string_ordinal.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/base/testing_profile.h"
-#include "content/browser/appcache/chrome_appcache_service.h"
#include "content/browser/in_process_webkit/dom_storage_context.h"
#include "content/browser/in_process_webkit/webkit_context.h"
#include "content/public/browser/notification_registrar.h"
@@ -404,6 +403,7 @@ ExtensionServiceTestBase::~ExtensionServiceTestBase() {
// can be destroyed while BrowserThreads and MessageLoop are still around
// (they are used in the destruction process).
service_ = NULL;
+ MessageLoop::current()->RunAllPending();
profile_.reset(NULL);
MessageLoop::current()->RunAllPending();
}
@@ -4323,6 +4323,7 @@ TEST_F(ExtensionServiceTest, ProcessSyncDataTerminatedExtension) {
TEST_F(ExtensionServiceTest, ProcessSyncDataVersionCheck) {
InitializeExtensionServiceWithUpdater();
+ InitializeRequestContext();
TestSyncProcessorStub processor;
service_->MergeDataAndStartSyncing(syncable::EXTENSIONS, SyncDataList(),
&processor);
@@ -4380,6 +4381,7 @@ TEST_F(ExtensionServiceTest, ProcessSyncDataVersionCheck) {
TEST_F(ExtensionServiceTest, ProcessSyncDataNotInstalled) {
InitializeExtensionServiceWithUpdater();
+ InitializeRequestContext();
TestSyncProcessorStub processor;
service_->MergeDataAndStartSyncing(syncable::EXTENSIONS, SyncDataList(),
&processor);
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 3f8a01b..c21cb73 100644
--- a/chrome/browser/profiles/off_the_record_profile_io_data.cc
+++ b/chrome/browser/profiles/off_the_record_profile_io_data.cc
@@ -129,19 +129,20 @@ OffTheRecordProfileIOData::Handle::GetIsolatedAppRequestContextGetter(
}
void OffTheRecordProfileIOData::Handle::LazyInitialize() const {
- if (!initialized_) {
- // Set initialized_ to true at the beginning in case any of the objects
- // below try to get the ResourceContext pointer.
- initialized_ = true;
- io_data_->InitializeOnUIThread(profile_);
- ChromeNetworkDelegate::InitializeReferrersEnabled(
- io_data_->enable_referrers(), profile_->GetPrefs());
+ if (initialized_)
+ return;
+
+ // Set initialized_ to true at the beginning in case any of the objects
+ // below try to get the ResourceContext pointer.
+ initialized_ = true;
+ ChromeNetworkDelegate::InitializeReferrersEnabled(
+ io_data_->enable_referrers(), profile_->GetPrefs());
#if defined(ENABLE_SAFE_BROWSING)
- io_data_->safe_browsing_enabled()->Init(prefs::kSafeBrowsingEnabled,
- profile_->GetPrefs(), NULL);
- io_data_->safe_browsing_enabled()->MoveToThread(BrowserThread::IO);
+ io_data_->safe_browsing_enabled()->Init(prefs::kSafeBrowsingEnabled,
+ profile_->GetPrefs(), NULL);
+ io_data_->safe_browsing_enabled()->MoveToThread(BrowserThread::IO);
#endif
- }
+ io_data_->InitializeOnUIThread(profile_);
}
OffTheRecordProfileIOData::OffTheRecordProfileIOData()
diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc
index b166fc0..e5d02e9 100644
--- a/chrome/browser/profiles/profile_impl.cc
+++ b/chrome/browser/profiles/profile_impl.cc
@@ -101,6 +101,7 @@
#include "grit/locale_settings.h"
#include "net/base/transport_security_state.h"
#include "net/http/http_server_properties.h"
+#include "webkit/appcache/appcache_service.h"
#include "webkit/database/database_tracker.h"
#if defined(OS_WIN)
@@ -174,12 +175,11 @@ FilePath GetMediaCachePath(const FilePath& base) {
void SaveSessionStateOnIOThread(
net::URLRequestContextGetter* url_request_context_getter,
- ChromeAppCacheService* appcache_service) {
+ appcache::AppCacheService* appcache_service) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
url_request_context_getter->GetURLRequestContext()->cookie_store()->
GetCookieMonster()->SaveSessionCookies();
- if (appcache_service)
- appcache_service->set_save_session_state(true);
+ appcache_service->set_save_session_state(true);
}
} // namespace
@@ -551,7 +551,7 @@ ProfileImpl::~ProfileImpl() {
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
base::Bind(&appcache::AppCacheService::set_clear_local_state_on_exit,
- BrowserContext::GetAppCacheService(this), true));
+ base::Unretained(BrowserContext::GetAppCacheService(this)), true));
BrowserContext::GetWebKitContext(this)->set_clear_local_state_on_exit(true);
BrowserContext::GetDatabaseTracker(this)->SetClearLocalStateOnExit(true);
}
@@ -1438,7 +1438,7 @@ void ProfileImpl::SaveSessionState() {
BrowserThread::IO, FROM_HERE,
base::Bind(&SaveSessionStateOnIOThread,
make_scoped_refptr(GetRequestContext()),
- make_scoped_refptr(BrowserContext::GetAppCacheService(this))));
+ BrowserContext::GetAppCacheService(this)));
}
void ProfileImpl::UpdateProfileUserNameCache() {
diff --git a/chrome/browser/profiles/profile_impl_io_data.cc b/chrome/browser/profiles/profile_impl_io_data.cc
index 0b01f29..2ea1c15 100644
--- a/chrome/browser/profiles/profile_impl_io_data.cc
+++ b/chrome/browser/profiles/profile_impl_io_data.cc
@@ -222,28 +222,29 @@ void ProfileImplIOData::Handle::ClearNetworkingHistorySince(
}
void ProfileImplIOData::Handle::LazyInitialize() const {
- if (!initialized_) {
- // Set initialized_ to true at the beginning in case any of the objects
- // below try to get the ResourceContext pointer.
- initialized_ = true;
- io_data_->InitializeOnUIThread(profile_);
- PrefService* pref_service = profile_->GetPrefs();
- io_data_->http_server_properties_manager_.reset(
- new chrome_browser_net::HttpServerPropertiesManager(pref_service));
- ChromeNetworkDelegate::InitializeReferrersEnabled(
- io_data_->enable_referrers(), pref_service);
- io_data_->clear_local_state_on_exit()->Init(
- prefs::kClearSiteDataOnExit, pref_service, NULL);
- io_data_->clear_local_state_on_exit()->MoveToThread(BrowserThread::IO);
- io_data_->session_startup_pref()->Init(
- prefs::kRestoreOnStartup, pref_service, NULL);
- io_data_->session_startup_pref()->MoveToThread(BrowserThread::IO);
+ if (initialized_)
+ return;
+
+ // Set initialized_ to true at the beginning in case any of the objects
+ // below try to get the ResourceContext pointer.
+ initialized_ = true;
+ PrefService* pref_service = profile_->GetPrefs();
+ io_data_->http_server_properties_manager_.reset(
+ new chrome_browser_net::HttpServerPropertiesManager(pref_service));
+ ChromeNetworkDelegate::InitializeReferrersEnabled(
+ io_data_->enable_referrers(), pref_service);
+ io_data_->clear_local_state_on_exit()->Init(
+ prefs::kClearSiteDataOnExit, pref_service, NULL);
+ io_data_->clear_local_state_on_exit()->MoveToThread(BrowserThread::IO);
+ io_data_->session_startup_pref()->Init(
+ prefs::kRestoreOnStartup, pref_service, NULL);
+ io_data_->session_startup_pref()->MoveToThread(BrowserThread::IO);
#if defined(ENABLE_SAFE_BROWSING)
- io_data_->safe_browsing_enabled()->Init(prefs::kSafeBrowsingEnabled,
- pref_service, NULL);
- io_data_->safe_browsing_enabled()->MoveToThread(BrowserThread::IO);
+ io_data_->safe_browsing_enabled()->Init(prefs::kSafeBrowsingEnabled,
+ pref_service, NULL);
+ io_data_->safe_browsing_enabled()->MoveToThread(BrowserThread::IO);
#endif
- }
+ io_data_->InitializeOnUIThread(profile_);
}
ProfileImplIOData::LazyParams::LazyParams()
diff --git a/chrome/browser/profiles/profile_io_data.cc b/chrome/browser/profiles/profile_io_data.cc
index c0b0e13..0df44a9 100644
--- a/chrome/browser/profiles/profile_io_data.cc
+++ b/chrome/browser/profiles/profile_io_data.cc
@@ -14,6 +14,7 @@
#include "base/logging.h"
#include "base/stl_util.h"
#include "base/string_number_conversions.h"
+#include "base/string_util.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/content_settings/cookie_settings.h"
#include "chrome/browser/content_settings/host_content_settings_map.h"
@@ -40,8 +41,6 @@
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
-#include "content/browser/appcache/chrome_appcache_service.h"
-#include "content/browser/chrome_blob_storage_context.h"
#include "content/browser/in_process_webkit/webkit_context.h"
#include "content/browser/renderer_host/media/media_stream_manager.h"
#include "content/browser/renderer_host/resource_dispatcher_host.h"
@@ -60,10 +59,7 @@
#include "net/url_request/url_request.h"
#include "webkit/blob/blob_data.h"
#include "webkit/blob/blob_url_request_job_factory.h"
-#include "webkit/database/database_tracker.h"
-#include "webkit/fileapi/file_system_context.h"
#include "webkit/fileapi/file_system_url_request_job_factory.h"
-#include "webkit/quota/quota_manager.h"
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/gview_request_interceptor.h"
@@ -72,6 +68,7 @@
using content::BrowserContext;
using content::BrowserThread;
+using content::ResourceContext;
namespace {
@@ -196,8 +193,6 @@ void ProfileIOData::InitializeOnUIThread(Profile* profile) {
params->clear_local_state_on_exit =
pref_service->GetBoolean(prefs::kClearSiteDataOnExit);
- params->appcache_service = BrowserContext::GetAppCacheService(profile);
-
// Set up Accept-Language and Accept-Charset header values
params->accept_language = net::HttpUtil::GenerateAcceptLanguageHeader(
pref_service->GetString(prefs::kAcceptLanguages));
@@ -232,12 +227,6 @@ void ProfileIOData::InitializeOnUIThread(Profile* profile) {
profile);
params->cookie_monster_delegate =
new ChromeCookieMonsterDelegate(profile_getter);
- params->database_tracker = BrowserContext::GetDatabaseTracker(profile);
- params->appcache_service = BrowserContext::GetAppCacheService(profile);
- params->blob_storage_context = BrowserContext::GetBlobStorageContext(profile);
- params->file_system_context = BrowserContext::GetFileSystemContext(profile);
- params->webkit_context = BrowserContext::GetWebKitContext(profile);
- params->quota_manager = BrowserContext::GetQuotaManager(profile);
params->extension_info_map = profile->GetExtensionInfoMap();
params->notification_service =
DesktopNotificationServiceFactory::GetForProfile(profile);
@@ -261,6 +250,11 @@ void ProfileIOData::InitializeOnUIThread(Profile* profile) {
#endif
initialized_on_UI_thread_ = true;
+
+ // We need to make sure that content initializes its own data structures that
+ // are associated with each ResourceContext because we might post this
+ // object to the IO thread after this function.
+ BrowserContext::EnsureResourceContextInitialized(profile);
}
ProfileIOData::AppRequestContext::AppRequestContext() {}
@@ -419,44 +413,6 @@ net::URLRequestContext* ProfileIOData::ResourceContext::GetRequestContext() {
return request_context_;
}
-ChromeAppCacheService* ProfileIOData::ResourceContext::GetAppCacheService() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- EnsureInitialized();
- return appcache_service_;
-}
-
-webkit_database::DatabaseTracker*
- ProfileIOData::ResourceContext::GetDatabaseTracker() {
- EnsureInitialized();
- return database_tracker_;
-}
-
-fileapi::FileSystemContext*
- ProfileIOData::ResourceContext::GetFileSystemContext() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- EnsureInitialized();
- return file_system_context_;
-}
-
-WebKitContext* ProfileIOData::ResourceContext::GetWebKitContext() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- EnsureInitialized();
- return webkit_context_;
-}
-
-ChromeBlobStorageContext*
- ProfileIOData::ResourceContext::GetBlobStorageContext() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- EnsureInitialized();
- return blob_storage_context_;
-}
-
-quota::QuotaManager* ProfileIOData::ResourceContext::GetQuotaManager() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- EnsureInitialized();
- return quota_manager_;
-}
-
content::HostZoomMap* ProfileIOData::ResourceContext::GetHostZoomMap() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
EnsureInitialized();
@@ -501,8 +457,6 @@ void ProfileIOData::LazyInitialize() const {
main_request_context_ = new ChromeURLRequestContext;
extensions_request_context_ = new ChromeURLRequestContext;
- profile_params_->appcache_service->set_request_context(main_request_context_);
-
chrome_url_data_manager_backend_.reset(new ChromeURLDataManagerBackend);
network_delegate_.reset(new ChromeNetworkDelegate(
@@ -547,8 +501,8 @@ void ProfileIOData::LazyInitialize() const {
chrome::kChromeUIScheme,
ChromeURLDataManagerBackend::CreateProtocolHandler(
chrome_url_data_manager_backend_.get(),
- profile_params_->appcache_service,
- profile_params_->blob_storage_context->controller()));
+ ResourceContext::GetAppCacheService(&resource_context_),
+ ResourceContext::GetBlobStorageController(&resource_context_)));
DCHECK(set_protocol);
set_protocol = job_factory_->SetProtocolHandler(
chrome::kChromeDevToolsScheme,
@@ -557,13 +511,13 @@ void ProfileIOData::LazyInitialize() const {
set_protocol = job_factory_->SetProtocolHandler(
chrome::kBlobScheme,
new ChromeBlobProtocolHandler(
- profile_params_->blob_storage_context->controller(),
+ ResourceContext::GetBlobStorageController(&resource_context_),
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)));
DCHECK(set_protocol);
set_protocol = job_factory_->SetProtocolHandler(
chrome::kFileSystemScheme,
CreateFileSystemProtocolHandler(
- profile_params_->file_system_context,
+ ResourceContext::GetFileSystemContext(&resource_context_),
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)));
DCHECK(set_protocol);
#if defined(OS_CHROMEOS) && !defined(GOOGLE_CHROME_BUILD)
@@ -578,12 +532,6 @@ void ProfileIOData::LazyInitialize() const {
new media_stream::MediaStreamManager(profile_params_->audio_manager));
// Take ownership over these parameters.
- database_tracker_ = profile_params_->database_tracker;
- appcache_service_ = profile_params_->appcache_service;
- blob_storage_context_ = profile_params_->blob_storage_context;
- file_system_context_ = profile_params_->file_system_context;
- webkit_context_ = profile_params_->webkit_context;
- quota_manager_ = profile_params_->quota_manager;
host_zoom_map_ = profile_params_->host_zoom_map;
host_content_settings_map_ = profile_params_->host_content_settings_map;
cookie_settings_ = profile_params_->cookie_settings;
@@ -592,12 +540,6 @@ void ProfileIOData::LazyInitialize() const {
resource_context_.host_resolver_ = io_thread_globals->host_resolver.get();
resource_context_.request_context_ = main_request_context_;
- resource_context_.database_tracker_ = database_tracker_;
- resource_context_.appcache_service_ = appcache_service_;
- resource_context_.blob_storage_context_ = blob_storage_context_;
- resource_context_.file_system_context_ = file_system_context_;
- resource_context_.webkit_context_ = webkit_context_;
- resource_context_.quota_manager_ = quota_manager_;
resource_context_.host_zoom_map_ = host_zoom_map_;
resource_context_.media_observer_ =
io_thread_globals->media.media_internals.get();
diff --git a/chrome/browser/profiles/profile_io_data.h b/chrome/browser/profiles/profile_io_data.h
index ce970ee..a4d6f07 100644
--- a/chrome/browser/profiles/profile_io_data.h
+++ b/chrome/browser/profiles/profile_io_data.h
@@ -21,8 +21,6 @@
#include "net/base/cookie_monster.h"
class AudioManager;
-class ChromeAppCacheService;
-class ChromeBlobStorageContext;
class CookieSettings;
class DesktopNotificationService;
class ExtensionInfoMap;
@@ -33,10 +31,6 @@ class ProtocolHandlerRegistry;
class TransportSecurityPersister;
class WebKitContext;
-namespace fileapi {
-class FileSystemContext;
-} // namespace fileapi
-
namespace media_stream {
class MediaStreamManager;
} // namespace media_stream
@@ -56,14 +50,6 @@ namespace policy {
class URLBlacklistManager;
} // namespace policy
-namespace quota {
-class QuotaManager;
-}; // namespace quota
-
-namespace webkit_database {
-class DatabaseTracker;
-} // webkit_database
-
// Conceptually speaking, the ProfileIOData represents data that lives on the IO
// thread that is owned by a Profile, such as, but not limited to, network
// objects like CookieMonster, HttpTransactionFactory, etc. Profile owns
@@ -158,12 +144,7 @@ class ProfileIOData {
scoped_refptr<content::HostZoomMap> host_zoom_map;
scoped_refptr<net::SSLConfigService> ssl_config_service;
scoped_refptr<net::CookieMonster::Delegate> cookie_monster_delegate;
- scoped_refptr<webkit_database::DatabaseTracker> database_tracker;
- scoped_refptr<ChromeAppCacheService> appcache_service;
- scoped_refptr<ChromeBlobStorageContext> blob_storage_context;
- scoped_refptr<fileapi::FileSystemContext> file_system_context;
scoped_refptr<WebKitContext> webkit_context;
- scoped_refptr<quota::QuotaManager> quota_manager;
scoped_refptr<ExtensionInfoMap> extension_info_map;
DesktopNotificationService* notification_service;
scoped_refptr<ProtocolHandlerRegistry> protocol_handler_registry;
@@ -238,12 +219,6 @@ class ProfileIOData {
// ResourceContext implementation:
virtual net::HostResolver* GetHostResolver() OVERRIDE;
virtual net::URLRequestContext* GetRequestContext() OVERRIDE;
- virtual ChromeAppCacheService* GetAppCacheService() OVERRIDE;
- virtual webkit_database::DatabaseTracker* GetDatabaseTracker() OVERRIDE;
- virtual fileapi::FileSystemContext* GetFileSystemContext() OVERRIDE;
- virtual WebKitContext* GetWebKitContext() OVERRIDE;
- virtual ChromeBlobStorageContext* GetBlobStorageContext() OVERRIDE;
- virtual quota::QuotaManager* GetQuotaManager() OVERRIDE;
virtual content::HostZoomMap* GetHostZoomMap() OVERRIDE;
virtual MediaObserver* GetMediaObserver() OVERRIDE;
virtual media_stream::MediaStreamManager* GetMediaStreamManager() OVERRIDE;
@@ -255,12 +230,6 @@ class ProfileIOData {
net::HostResolver* host_resolver_;
net::URLRequestContext* request_context_;
- ChromeAppCacheService* appcache_service_;
- webkit_database::DatabaseTracker* database_tracker_;
- fileapi::FileSystemContext* file_system_context_;
- WebKitContext* webkit_context_;
- ChromeBlobStorageContext* blob_storage_context_;
- quota::QuotaManager* quota_manager_;
content::HostZoomMap* host_zoom_map_;
MediaObserver* media_observer_;
media_stream::MediaStreamManager* media_stream_manager_;
@@ -321,12 +290,6 @@ class ProfileIOData {
mutable scoped_ptr<net::URLRequestJobFactory> job_factory_;
// Pointed to by ResourceContext.
- mutable scoped_refptr<webkit_database::DatabaseTracker> database_tracker_;
- mutable scoped_refptr<ChromeAppCacheService> appcache_service_;
- mutable scoped_refptr<ChromeBlobStorageContext> blob_storage_context_;
- mutable scoped_refptr<fileapi::FileSystemContext> file_system_context_;
- mutable scoped_refptr<WebKitContext> webkit_context_;
- mutable scoped_refptr<quota::QuotaManager> quota_manager_;
mutable scoped_refptr<content::HostZoomMap> host_zoom_map_;
mutable scoped_ptr<media_stream::MediaStreamManager> media_stream_manager_;
diff --git a/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc b/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc
index 97db0c6..600ff21 100644
--- a/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc
+++ b/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc
@@ -156,7 +156,7 @@ void ChromeResourceDispatcherHostDelegate::RequestBeginning(
// We check offline first, then check safe browsing so that we still can
// block unsafe site after we remove offline page.
throttles->push_back(new OfflineResourceThrottle(
- child_id, route_id, request, resource_context->GetAppCacheService()));
+ child_id, route_id, request, resource_context));
#endif
throttles->push_back(
diff --git a/chrome/browser/renderer_host/offline_resource_throttle.cc b/chrome/browser/renderer_host/offline_resource_throttle.cc
index 53376de..20b5b30 100644
--- a/chrome/browser/renderer_host/offline_resource_throttle.cc
+++ b/chrome/browser/renderer_host/offline_resource_throttle.cc
@@ -14,19 +14,21 @@
#include "chrome/browser/chromeos/offline/offline_load_page.h"
#include "chrome/browser/net/chrome_url_request_context.h"
#include "chrome/common/url_constants.h"
-#include "content/browser/appcache/chrome_appcache_service.h"
#include "content/browser/renderer_host/render_view_host.h"
#include "content/browser/renderer_host/resource_dispatcher_host.h"
#include "content/browser/renderer_host/resource_dispatcher_host_request_info.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_view_host_delegate.h"
+#include "content/public/browser/resource_context.h"
#include "content/public/browser/resource_throttle_controller.h"
#include "net/base/net_errors.h"
#include "net/base/network_change_notifier.h"
#include "net/url_request/url_request.h"
#include "net/url_request/url_request_context.h"
+#include "webkit/appcache/appcache_service.h"
using content::BrowserThread;
+using content::ResourceContext;
using content::WebContents;
namespace {
@@ -61,12 +63,12 @@ OfflineResourceThrottle::OfflineResourceThrottle(
int render_process_id,
int render_view_id,
net::URLRequest* request,
- ChromeAppCacheService* appcache_service)
+ content::ResourceContext* resource_context)
: render_process_id_(render_process_id),
render_view_id_(render_view_id),
request_(request),
- appcache_service_(appcache_service) {
- DCHECK(appcache_service_);
+ resource_context_(resource_context) {
+ DCHECK(resource_context);
}
OfflineResourceThrottle::~OfflineResourceThrottle() {
@@ -87,10 +89,11 @@ void OfflineResourceThrottle::WillStartRequest(bool* defer) {
appcache_completion_callback_.Reset(
base::Bind(&OfflineResourceThrottle::OnCanHandleOfflineComplete,
AsWeakPtr()));
- appcache_service_->CanHandleMainResourceOffline(
- request_->url(),
- request_->first_party_for_cookies(),
- appcache_completion_callback_.callback());
+ ResourceContext::GetAppCacheService(resource_context_)->
+ CanHandleMainResourceOffline(
+ request_->url(),
+ request_->first_party_for_cookies(),
+ appcache_completion_callback_.callback());
*defer = true;
}
diff --git a/chrome/browser/renderer_host/offline_resource_throttle.h b/chrome/browser/renderer_host/offline_resource_throttle.h
index 589e84b..1844860 100644
--- a/chrome/browser/renderer_host/offline_resource_throttle.h
+++ b/chrome/browser/renderer_host/offline_resource_throttle.h
@@ -17,6 +17,10 @@
class ChromeAppCacheService;
class ResourceDispatcherHost;
+namespace content {
+class ResourceContext;
+}
+
namespace net {
class URLRequest;
} // namespace net
@@ -29,7 +33,7 @@ class OfflineResourceThrottle
OfflineResourceThrottle(int render_process_id,
int render_view_id,
net::URLRequest* request,
- ChromeAppCacheService* appcache_service);
+ content::ResourceContext* resource_context);
virtual ~OfflineResourceThrottle();
// content::ResourceThrottle implementation:
@@ -52,7 +56,8 @@ class OfflineResourceThrottle
int render_process_id_;
int render_view_id_;
net::URLRequest* request_;
- ChromeAppCacheService* const appcache_service_;
+ // Safe to keep a pointer around since ResourceContext outlives all requests.
+ content::ResourceContext* resource_context_;
net::CancelableCompletionCallback appcache_completion_callback_;
DISALLOW_COPY_AND_ASSIGN(OfflineResourceThrottle);
diff --git a/chrome/browser/ui/cocoa/content_settings/collected_cookies_mac.h b/chrome/browser/ui/cocoa/content_settings/collected_cookies_mac.h
index 5a67fd2..5ae4682 100644
--- a/chrome/browser/ui/cocoa/content_settings/collected_cookies_mac.h
+++ b/chrome/browser/ui/cocoa/content_settings/collected_cookies_mac.h
@@ -10,6 +10,7 @@
#include "chrome/browser/cookies_tree_model.h"
#include "chrome/browser/ui/cocoa/constrained_window_mac.h"
#import "chrome/browser/ui/cocoa/content_settings/cookie_tree_node.h"
+#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
@class CollectedCookiesWindowController;
diff --git a/chrome/browser/ui/webui/chrome_url_data_manager_backend.cc b/chrome/browser/ui/webui/chrome_url_data_manager_backend.cc
index 9199e84..fe6bfa7 100644
--- a/chrome/browser/ui/webui/chrome_url_data_manager_backend.cc
+++ b/chrome/browser/ui/webui/chrome_url_data_manager_backend.cc
@@ -24,7 +24,6 @@
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/url_constants.h"
-#include "content/browser/appcache/chrome_appcache_service.h"
#include "content/public/browser/browser_thread.h"
#include "googleurl/src/url_util.h"
#include "grit/platform_locale_settings.h"
@@ -35,6 +34,7 @@
#include "net/url_request/url_request_file_job.h"
#include "net/url_request/url_request_job.h"
#include "net/url_request/url_request_job_factory.h"
+#include "webkit/appcache/appcache_service.h"
#include "webkit/appcache/view_appcache_internals_job.h"
using content::BrowserThread;
@@ -329,7 +329,7 @@ class ChromeProtocolHandler
public:
ChromeProtocolHandler(
ChromeURLDataManagerBackend* backend,
- ChromeAppCacheService* appcache_service,
+ appcache::AppCacheService* appcache_service,
webkit_blob::BlobStorageController* blob_storage_controller);
~ChromeProtocolHandler();
@@ -339,7 +339,7 @@ class ChromeProtocolHandler
private:
// These members are owned by ProfileIOData, which owns this ProtocolHandler.
ChromeURLDataManagerBackend* const backend_;
- ChromeAppCacheService* const appcache_service_;
+ appcache::AppCacheService* const appcache_service_;
webkit_blob::BlobStorageController* const blob_storage_controller_;
DISALLOW_COPY_AND_ASSIGN(ChromeProtocolHandler);
@@ -347,7 +347,7 @@ class ChromeProtocolHandler
ChromeProtocolHandler::ChromeProtocolHandler(
ChromeURLDataManagerBackend* backend,
- ChromeAppCacheService* appcache_service,
+ appcache::AppCacheService* appcache_service,
webkit_blob::BlobStorageController* blob_storage_controller)
: backend_(backend),
appcache_service_(appcache_service),
@@ -396,7 +396,7 @@ ChromeURLDataManagerBackend::~ChromeURLDataManagerBackend() {
net::URLRequestJobFactory::ProtocolHandler*
ChromeURLDataManagerBackend::CreateProtocolHandler(
ChromeURLDataManagerBackend* backend,
- ChromeAppCacheService* appcache_service,
+ appcache::AppCacheService* appcache_service,
webkit_blob::BlobStorageController* blob_storage_controller) {
DCHECK(appcache_service);
DCHECK(blob_storage_controller);
diff --git a/chrome/browser/ui/webui/chrome_url_data_manager_backend.h b/chrome/browser/ui/webui/chrome_url_data_manager_backend.h
index c9271de..073fdc1 100644
--- a/chrome/browser/ui/webui/chrome_url_data_manager_backend.h
+++ b/chrome/browser/ui/webui/chrome_url_data_manager_backend.h
@@ -15,12 +15,15 @@
#include "chrome/browser/ui/webui/chrome_url_data_manager.h"
#include "net/url_request/url_request_job_factory.h"
-class ChromeAppCacheService;
class ChromeURLDataManagerBackend;
class GURL;
class RefCountedMemory;
class URLRequestChromeJob;
+namespace appcache {
+class AppCacheService;
+}
+
namespace net {
class URLRequest;
class URLRequestJob;
@@ -43,7 +46,7 @@ class ChromeURLDataManagerBackend {
// Invoked to create the protocol handler for chrome://.
static net::URLRequestJobFactory::ProtocolHandler* CreateProtocolHandler(
ChromeURLDataManagerBackend* backend,
- ChromeAppCacheService* appcache_service,
+ appcache::AppCacheService* appcache_service,
webkit_blob::BlobStorageController* blob_storage_controller);
// Adds a DataSource to the collection of data sources.