summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-17 16:49:29 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-17 16:49:29 +0000
commit7fd47a85b9e070b1acbe4d6129f0edb9e3498099 (patch)
tree26a20943bc57da6e615b6b67f4bc039adffaaa02 /chrome/browser
parentadb57e8c2fe59d5e27fac60f7870fd5157e8aca7 (diff)
downloadchromium_src-7fd47a85b9e070b1acbe4d6129f0edb9e3498099.zip
chromium_src-7fd47a85b9e070b1acbe4d6129f0edb9e3498099.tar.gz
chromium_src-7fd47a85b9e070b1acbe4d6129f0edb9e3498099.tar.bz2
Move creation of BrowserContext objects that live in content to content, instead of depending on the embedder. Apart from allowing us to hide more of content from embedders, it simplifies the work that every embedder has to do (see the change the shell_browser_context.cc as an example).
BUG=98716 Review URL: https://chromiumcodereview.appspot.com/9419033 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@122521 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/DEPS1
-rw-r--r--chrome/browser/browsing_data_appcache_helper.cc3
-rw-r--r--chrome/browser/browsing_data_database_helper.cc3
-rw-r--r--chrome/browser/browsing_data_database_helper_browsertest.cc3
-rw-r--r--chrome/browser/browsing_data_file_system_helper.cc11
-rw-r--r--chrome/browser/browsing_data_file_system_helper_unittest.cc14
-rw-r--r--chrome/browser/browsing_data_indexed_db_helper.cc4
-rw-r--r--chrome/browser/browsing_data_local_storage_helper.cc9
-rw-r--r--chrome/browser/browsing_data_quota_helper_impl.cc2
-rw-r--r--chrome/browser/browsing_data_remover.cc28
-rw-r--r--chrome/browser/browsing_data_remover.h3
-rw-r--r--chrome/browser/browsing_data_remover_unittest.cc13
-rw-r--r--chrome/browser/chromeos/offline/offline_load_page_unittest.cc3
-rw-r--r--chrome/browser/cookies_tree_model_unittest.cc7
-rw-r--r--chrome/browser/diagnostics/sqlite_diagnostics.cc3
-rw-r--r--chrome/browser/download/download_request_limiter_unittest.cc3
-rw-r--r--chrome/browser/extensions/extension_data_deleter.cc9
-rw-r--r--chrome/browser/extensions/extension_file_browser_private_api.cc15
-rw-r--r--chrome/browser/extensions/extension_file_browser_private_apitest.cc4
-rw-r--r--chrome/browser/extensions/extension_local_filesystem_apitest.cc5
-rw-r--r--chrome/browser/extensions/extension_service.cc7
-rw-r--r--chrome/browser/extensions/extension_service_unittest.cc47
-rw-r--r--chrome/browser/extensions/file_manager_util.cc3
-rw-r--r--chrome/browser/memory_purger.cc3
-rw-r--r--chrome/browser/net/view_blob_internals_job_factory.cc1
-rw-r--r--chrome/browser/profiles/off_the_record_profile_impl.cc99
-rw-r--r--chrome/browser/profiles/off_the_record_profile_impl.h53
-rw-r--r--chrome/browser/profiles/off_the_record_profile_io_data.cc4
-rw-r--r--chrome/browser/profiles/profile.cc5
-rw-r--r--chrome/browser/profiles/profile.h25
-rw-r--r--chrome/browser/profiles/profile_impl.cc121
-rw-r--r--chrome/browser/profiles/profile_impl.h24
-rw-r--r--chrome/browser/profiles/profile_impl_io_data.cc4
-rw-r--r--chrome/browser/profiles/profile_io_data.cc15
-rw-r--r--chrome/browser/safe_browsing/client_side_detection_host_unittest.cc5
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc3
-rw-r--r--chrome/browser/sync/profile_sync_service_autofill_unittest.cc7
-rw-r--r--chrome/browser/sync/profile_sync_service_password_unittest.cc5
-rw-r--r--chrome/browser/sync/profile_sync_service_typed_url_unittest.cc6
-rw-r--r--chrome/browser/sync/profile_sync_test_util.cc33
-rw-r--r--chrome/browser/sync/profile_sync_test_util.h20
-rw-r--r--chrome/browser/ui/cocoa/cocoa_profile_test.h1
-rw-r--r--chrome/browser/ui/cocoa/cocoa_profile_test.mm3
-rw-r--r--chrome/browser/ui/cocoa/notifications/balloon_controller_unittest.mm3
-rw-r--r--chrome/browser/ui/views/select_file_dialog_extension_browsertest.cc5
-rw-r--r--chrome/browser/ui/webui/quota_internals_handler.cc5
46 files changed, 186 insertions, 464 deletions
diff --git a/chrome/browser/DEPS b/chrome/browser/DEPS
index 63e5c08..b453fd9 100644
--- a/chrome/browser/DEPS
+++ b/chrome/browser/DEPS
@@ -52,7 +52,6 @@ include_rules = [
"+content/browser/download/drag_download_util.h",
"+content/browser/download/interrupt_reasons.h",
"+content/browser/download/mhtml_generation_manager.h",
- "+content/browser/file_system/browser_file_system_helper.h",
"+content/browser/find_pasteboard.h",
"+content/browser/font_list_async.h",
"+content/browser/geolocation/wifi_data_provider_common.h",
diff --git a/chrome/browser/browsing_data_appcache_helper.cc b/chrome/browser/browsing_data_appcache_helper.cc
index 135b015..148fa85 100644
--- a/chrome/browser/browsing_data_appcache_helper.cc
+++ b/chrome/browser/browsing_data_appcache_helper.cc
@@ -13,11 +13,12 @@
#include "webkit/appcache/appcache_storage.h"
using appcache::AppCacheDatabase;
+using content::BrowserContext;
using content::BrowserThread;
BrowsingDataAppCacheHelper::BrowsingDataAppCacheHelper(Profile* profile)
: is_fetching_(false),
- appcache_service_(profile->GetAppCacheService()) {
+ appcache_service_(BrowserContext::GetAppCacheService(profile)) {
}
void BrowsingDataAppCacheHelper::StartFetching(const base::Closure& callback) {
diff --git a/chrome/browser/browsing_data_database_helper.cc b/chrome/browser/browsing_data_database_helper.cc
index b34fa44..ccb5615 100644
--- a/chrome/browser/browsing_data_database_helper.cc
+++ b/chrome/browser/browsing_data_database_helper.cc
@@ -17,6 +17,7 @@
#include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
+using content::BrowserContext;
using content::BrowserThread;
using WebKit::WebSecurityOrigin;
@@ -51,7 +52,7 @@ bool BrowsingDataDatabaseHelper::DatabaseInfo::IsFileSchemeData() {
BrowsingDataDatabaseHelper::BrowsingDataDatabaseHelper(Profile* profile)
: is_fetching_(false),
- tracker_(profile->GetDatabaseTracker()) {
+ tracker_(BrowserContext::GetDatabaseTracker(profile)) {
}
BrowsingDataDatabaseHelper::~BrowsingDataDatabaseHelper() {
diff --git a/chrome/browser/browsing_data_database_helper_browsertest.cc b/chrome/browser/browsing_data_database_helper_browsertest.cc
index 3889077..e234267 100644
--- a/chrome/browser/browsing_data_database_helper_browsertest.cc
+++ b/chrome/browser/browsing_data_database_helper_browsertest.cc
@@ -14,6 +14,7 @@
#include "chrome/test/base/ui_test_utils.h"
#include "content/test/test_browser_thread.h"
+using content::BrowserContext;
using content::BrowserThread;
namespace {
@@ -29,7 +30,7 @@ class BrowsingDataDatabaseHelperTest : public InProcessBrowserTest {
public:
virtual void CreateDatabases() {
webkit_database::DatabaseTracker* db_tracker =
- browser()->profile()->GetDatabaseTracker();
+ BrowserContext::GetDatabaseTracker(browser()->profile());
string16 db_name = ASCIIToUTF16("db");
string16 description = ASCIIToUTF16("db_description");
int64 size;
diff --git a/chrome/browser/browsing_data_file_system_helper.cc b/chrome/browser/browsing_data_file_system_helper.cc
index 859b32e..9cde505 100644
--- a/chrome/browser/browsing_data_file_system_helper.cc
+++ b/chrome/browser/browsing_data_file_system_helper.cc
@@ -18,6 +18,7 @@
#include "webkit/fileapi/file_system_types.h"
#include "webkit/fileapi/sandbox_mount_point_provider.h"
+using content::BrowserContext;
using content::BrowserThread;
namespace {
@@ -113,13 +114,14 @@ void BrowsingDataFileSystemHelperImpl::DeleteFileSystemOrigin(
void BrowsingDataFileSystemHelperImpl::FetchFileSystemInfoInFileThread() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
scoped_ptr<fileapi::SandboxMountPointProvider::OriginEnumerator>
- origin_enumerator(profile_->GetFileSystemContext()->
+ origin_enumerator(BrowserContext::GetFileSystemContext(profile_)->
sandbox_provider()->CreateOriginEnumerator());
// We don't own this pointer; it's a magic singleton generated by the
// profile's FileSystemContext. Deleting it would be a bad idea.
- fileapi::FileSystemQuotaUtil* quota_util = profile_->
- GetFileSystemContext()->GetQuotaUtil(fileapi::kFileSystemTypeTemporary);
+ fileapi::FileSystemQuotaUtil* quota_util =
+ BrowserContext::GetFileSystemContext(profile_)->GetQuotaUtil(
+ fileapi::kFileSystemTypeTemporary);
GURL current;
while (!(current = origin_enumerator->Next()).is_empty()) {
@@ -164,7 +166,8 @@ void BrowsingDataFileSystemHelperImpl::NotifyOnUIThread() {
void BrowsingDataFileSystemHelperImpl::DeleteFileSystemOriginInFileThread(
const GURL& origin) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
- profile_->GetFileSystemContext()->DeleteDataForOriginOnFileThread(origin);
+ BrowserContext::GetFileSystemContext(profile_)->
+ DeleteDataForOriginOnFileThread(origin);
}
} // namespace
diff --git a/chrome/browser/browsing_data_file_system_helper_unittest.cc b/chrome/browser/browsing_data_file_system_helper_unittest.cc
index 5e05dfc..93ab08f 100644
--- a/chrome/browser/browsing_data_file_system_helper_unittest.cc
+++ b/chrome/browser/browsing_data_file_system_helper_unittest.cc
@@ -18,6 +18,7 @@
#include "webkit/fileapi/file_system_usage_cache.h"
#include "webkit/fileapi/sandbox_mount_point_provider.h"
+using content::BrowserContext;
using content::BrowserThread;
namespace {
@@ -57,10 +58,15 @@ class BrowsingDataFileSystemHelperTest : public testing::Test {
: helper_(BrowsingDataFileSystemHelper::Create(&profile_)),
canned_helper_(new CannedBrowsingDataFileSystemHelper(&profile_)),
ui_thread_(BrowserThread::UI, &message_loop_),
+ db_thread_(BrowserThread::DB, &message_loop_),
+ webkit_thread_(BrowserThread::WEBKIT_DEPRECATED, &message_loop_),
file_thread_(BrowserThread::FILE, &message_loop_),
+ file_user_blocking_thread_(
+ BrowserThread::FILE_USER_BLOCKING, &message_loop_),
io_thread_(BrowserThread::IO, &message_loop_) {
}
- virtual ~BrowsingDataFileSystemHelperTest() {}
+ virtual ~BrowsingDataFileSystemHelperTest() {
+ }
TestingProfile* GetProfile() {
return &profile_;
@@ -131,7 +137,8 @@ class BrowsingDataFileSystemHelperTest : public testing::Test {
// Sets up kOrigin1 with a temporary file system, kOrigin2 with a persistent
// file system, and kOrigin3 with both.
virtual void PopulateTestFileSystemData() {
- sandbox_ = profile_.GetFileSystemContext()->sandbox_provider();
+ sandbox_ = BrowserContext::GetFileSystemContext(&profile_)->
+ sandbox_provider();
CreateDirectoryForOriginAndType(kOrigin1, kTemporary);
CreateDirectoryForOriginAndType(kOrigin2, kPersistent);
@@ -175,7 +182,10 @@ class BrowsingDataFileSystemHelperTest : public testing::Test {
// defined in the order they're listed here. Oh how I love C++.
MessageLoopForUI message_loop_;
content::TestBrowserThread ui_thread_;
+ content::TestBrowserThread db_thread_;
+ content::TestBrowserThread webkit_thread_;
content::TestBrowserThread file_thread_;
+ content::TestBrowserThread file_user_blocking_thread_;
content::TestBrowserThread io_thread_;
TestingProfile profile_;
diff --git a/chrome/browser/browsing_data_indexed_db_helper.cc b/chrome/browser/browsing_data_indexed_db_helper.cc
index e749be3..a26207c 100644
--- a/chrome/browser/browsing_data_indexed_db_helper.cc
+++ b/chrome/browser/browsing_data_indexed_db_helper.cc
@@ -18,6 +18,7 @@
#include "webkit/database/database_util.h"
#include "webkit/glue/webkit_glue.h"
+using content::BrowserContext;
using content::BrowserThread;
using webkit_database::DatabaseUtil;
@@ -62,7 +63,8 @@ class BrowsingDataIndexedDBHelperImpl : public BrowsingDataIndexedDBHelper {
BrowsingDataIndexedDBHelperImpl::BrowsingDataIndexedDBHelperImpl(
Profile* profile)
- : indexed_db_context_(profile->GetWebKitContext()->indexed_db_context()),
+ : indexed_db_context_(
+ BrowserContext::GetWebKitContext(profile)->indexed_db_context()),
is_fetching_(false) {
DCHECK(indexed_db_context_.get());
}
diff --git a/chrome/browser/browsing_data_local_storage_helper.cc b/chrome/browser/browsing_data_local_storage_helper.cc
index ec5daeb..57ccd360 100644
--- a/chrome/browser/browsing_data_local_storage_helper.cc
+++ b/chrome/browser/browsing_data_local_storage_helper.cc
@@ -17,6 +17,7 @@
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
#include "webkit/glue/webkit_glue.h"
+using content::BrowserContext;
using content::BrowserThread;
using WebKit::WebSecurityOrigin;
@@ -89,7 +90,7 @@ void BrowsingDataLocalStorageHelper::DeleteLocalStorageFile(
void BrowsingDataLocalStorageHelper::FetchLocalStorageInfoInWebKitThread() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
file_util::FileEnumerator file_enumerator(
- profile_->GetWebKitContext()->data_path().Append(
+ BrowserContext::GetWebKitContext(profile_)->data_path().Append(
DOMStorageContext::kLocalStorageDirectory),
false, file_util::FileEnumerator::FILES);
for (FilePath file_path = file_enumerator.Next(); !file_path.empty();
@@ -139,8 +140,8 @@ void BrowsingDataLocalStorageHelper::NotifyInUIThread() {
void BrowsingDataLocalStorageHelper::DeleteLocalStorageFileInWebKitThread(
const FilePath& file_path) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
- profile_->GetWebKitContext()->dom_storage_context()->DeleteLocalStorageFile(
- file_path);
+ BrowserContext::GetWebKitContext(profile_)->dom_storage_context()->
+ DeleteLocalStorageFile(file_path);
}
CannedBrowsingDataLocalStorageHelper::CannedBrowsingDataLocalStorageHelper(
@@ -221,7 +222,7 @@ void CannedBrowsingDataLocalStorageHelper::ConvertPendingInfoInWebKitThread() {
web_security_origin.port(),
web_security_origin.databaseIdentifier().utf8(),
security_origin,
- profile_->GetWebKitContext()->dom_storage_context()->
+ BrowserContext::GetWebKitContext(profile_)->dom_storage_context()->
GetLocalStorageFilePath(web_security_origin.databaseIdentifier()),
0,
base::Time()));
diff --git a/chrome/browser/browsing_data_quota_helper_impl.cc b/chrome/browser/browsing_data_quota_helper_impl.cc
index b198068..435afb0 100644
--- a/chrome/browser/browsing_data_quota_helper_impl.cc
+++ b/chrome/browser/browsing_data_quota_helper_impl.cc
@@ -19,7 +19,7 @@ BrowsingDataQuotaHelper* BrowsingDataQuotaHelper::Create(Profile* profile) {
return new BrowsingDataQuotaHelperImpl(
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI),
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO),
- profile->GetQuotaManager());
+ content::BrowserContext::GetQuotaManager(profile));
}
void BrowsingDataQuotaHelperImpl::StartFetching(
diff --git a/chrome/browser/browsing_data_remover.cc b/chrome/browser/browsing_data_remover.cc
index c8a8576f..fe623d2 100644
--- a/chrome/browser/browsing_data_remover.cc
+++ b/chrome/browser/browsing_data_remover.cc
@@ -58,6 +58,7 @@
#include "webkit/quota/quota_manager.h"
#include "webkit/quota/quota_types.h"
+using content::BrowserContext;
using content::BrowserThread;
using content::DownloadManager;
using content::UserMetricsAction;
@@ -283,7 +284,8 @@ void BrowsingDataRemover::RemoveImpl(int remove_mask,
// be removed if a WEBKIT thread exists, so check that first:
if (BrowserThread::IsMessageLoopValid(BrowserThread::WEBKIT_DEPRECATED)) {
// We assume the end time is now.
- profile_->GetWebKitContext()->DeleteDataModifiedSince(delete_begin_);
+ BrowserContext::GetWebKitContext(profile_)->
+ DeleteDataModifiedSince(delete_begin_);
}
}
@@ -292,14 +294,13 @@ void BrowsingDataRemover::RemoveImpl(int remove_mask,
// TODO(mkwst): At the moment, we don't have the ability to pass a mask into
// QuotaManager. Until then, we'll clear all quota-managed data types if any
// ought to be cleared.
- quota_manager_ = profile_->GetQuotaManager();
- if (quota_manager_) {
- waiting_for_clear_quota_managed_data_ = true;
- BrowserThread::PostTask(
- BrowserThread::IO, FROM_HERE,
- base::Bind(&BrowsingDataRemover::ClearQuotaManagedDataOnIOThread,
- base::Unretained(this)));
- }
+ if (!quota_manager_)
+ quota_manager_ = content::BrowserContext::GetQuotaManager(profile_);
+ waiting_for_clear_quota_managed_data_ = true;
+ BrowserThread::PostTask(
+ BrowserThread::IO, FROM_HERE,
+ base::Bind(&BrowsingDataRemover::ClearQuotaManagedDataOnIOThread,
+ base::Unretained(this)));
}
if (remove_mask & REMOVE_PLUGIN_DATA) {
@@ -385,6 +386,11 @@ void BrowsingDataRemover::OnHistoryDeletionDone() {
NotifyAndDeleteIfDone();
}
+void BrowsingDataRemover::OverrideQuotaManagerForTesting(
+ quota::QuotaManager* quota_manager) {
+ quota_manager_ = quota_manager;
+}
+
base::Time BrowsingDataRemover::CalculateBeginDeleteTime(
TimePeriod time_period) {
base::TimeDelta diff;
@@ -569,7 +575,7 @@ void BrowsingDataRemover::ClearQuotaManagedDataOnIOThread() {
// all origins with persistent quota modified within the user-specified
// timeframe, and deal with the resulting set in
// OnGotPersistentQuotaManagedOrigins.
- profile_->GetQuotaManager()->GetOriginsModifiedSince(
+ quota_manager_->GetOriginsModifiedSince(
quota::kStorageTypePersistent, delete_begin_,
base::Bind(&BrowsingDataRemover::OnGotQuotaManagedOrigins,
base::Unretained(this)));
@@ -580,7 +586,7 @@ void BrowsingDataRemover::ClearQuotaManagedDataOnIOThread() {
// Do the same for temporary quota, regardless, passing the resulting set into
// OnGotTemporaryQuotaManagedOrigins.
- profile_->GetQuotaManager()->GetOriginsModifiedSince(
+ quota_manager_->GetOriginsModifiedSince(
quota::kStorageTypeTemporary, delete_begin_,
base::Bind(&BrowsingDataRemover::OnGotQuotaManagedOrigins,
base::Unretained(this)));
diff --git a/chrome/browser/browsing_data_remover.h b/chrome/browser/browsing_data_remover.h
index 33f3515..40b3c25 100644
--- a/chrome/browser/browsing_data_remover.h
+++ b/chrome/browser/browsing_data_remover.h
@@ -130,6 +130,9 @@ class BrowsingDataRemover : public content::NotificationObserver,
// BrowsingDataRemover uses. This method generates that mask.
static int GenerateQuotaClientMask(int remove_mask);
+ // Used for testing.
+ void OverrideQuotaManagerForTesting(quota::QuotaManager* quota_manager);
+
static bool is_removing() { return removing_; }
private:
diff --git a/chrome/browser/browsing_data_remover_unittest.cc b/chrome/browser/browsing_data_remover_unittest.cc
index cca20d8..6313494 100644
--- a/chrome/browser/browsing_data_remover_unittest.cc
+++ b/chrome/browser/browsing_data_remover_unittest.cc
@@ -292,6 +292,8 @@ class BrowsingDataRemoverTest : public testing::Test,
db_thread_(BrowserThread::DB, &message_loop_),
webkit_thread_(BrowserThread::WEBKIT_DEPRECATED, &message_loop_),
file_thread_(BrowserThread::FILE, &message_loop_),
+ file_user_blocking_thread_(
+ BrowserThread::FILE_USER_BLOCKING, &message_loop_),
io_thread_(BrowserThread::IO, &message_loop_),
profile_(new TestingProfile()) {
registrar_.Add(this, chrome::NOTIFICATION_BROWSING_DATA_REMOVED,
@@ -317,6 +319,7 @@ class BrowsingDataRemoverTest : public testing::Test,
BrowsingDataRemover* remover = new BrowsingDataRemover(
profile_.get(), period,
base::Time::Now() + base::TimeDelta::FromMilliseconds(10));
+ remover->OverrideQuotaManagerForTesting(GetMockManager());
remover->AddObserver(tester);
called_with_details_.reset(new BrowsingDataRemover::NotificationDetails());
@@ -355,15 +358,15 @@ class BrowsingDataRemoverTest : public testing::Test,
}
quota::MockQuotaManager* GetMockManager() {
- if (profile_->GetQuotaManager() == NULL) {
- profile_->SetQuotaManager(new quota::MockQuotaManager(
+ if (!quota_manager_) {
+ quota_manager_ = new quota::MockQuotaManager(
profile_->IsOffTheRecord(),
profile_->GetPath(),
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO),
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB),
- profile_->GetExtensionSpecialStoragePolicy()));
+ profile_->GetExtensionSpecialStoragePolicy());
}
- return (quota::MockQuotaManager*) profile_->GetQuotaManager();
+ return quota_manager_;
}
// content::NotificationObserver implementation.
@@ -392,8 +395,10 @@ class BrowsingDataRemoverTest : public testing::Test,
content::TestBrowserThread db_thread_;
content::TestBrowserThread webkit_thread_;
content::TestBrowserThread file_thread_;
+ content::TestBrowserThread file_user_blocking_thread_;
content::TestBrowserThread io_thread_;
scoped_ptr<TestingProfile> profile_;
+ scoped_refptr<quota::MockQuotaManager> quota_manager_;
DISALLOW_COPY_AND_ASSIGN(BrowsingDataRemoverTest);
};
diff --git a/chrome/browser/chromeos/offline/offline_load_page_unittest.cc b/chrome/browser/chromeos/offline/offline_load_page_unittest.cc
index 9b6fe98..b307cd1 100644
--- a/chrome/browser/chromeos/offline/offline_load_page_unittest.cc
+++ b/chrome/browser/chromeos/offline/offline_load_page_unittest.cc
@@ -50,6 +50,8 @@ class OfflineLoadPageTest : public ChromeRenderViewHostTestHarness {
OfflineLoadPageTest()
: ui_thread_(BrowserThread::UI, MessageLoop::current()),
+ file_user_blocking_thread_(
+ BrowserThread::FILE_USER_BLOCKING, MessageLoop::current()),
io_thread_(BrowserThread::IO, MessageLoop::current()) {
}
@@ -86,6 +88,7 @@ class OfflineLoadPageTest : public ChromeRenderViewHostTestHarness {
private:
UserResponse user_response_;
content::TestBrowserThread ui_thread_;
+ content::TestBrowserThread file_user_blocking_thread_;
content::TestBrowserThread io_thread_;
// Initializes / shuts down a stub CrosLibrary.
diff --git a/chrome/browser/cookies_tree_model_unittest.cc b/chrome/browser/cookies_tree_model_unittest.cc
index 6dde8ea..3d10042 100644
--- a/chrome/browser/cookies_tree_model_unittest.cc
+++ b/chrome/browser/cookies_tree_model_unittest.cc
@@ -34,8 +34,10 @@ namespace {
class CookiesTreeModelTest : public testing::Test {
public:
- CookiesTreeModelTest() : ui_thread_(BrowserThread::UI, &message_loop_),
- io_thread_(BrowserThread::IO, &message_loop_) {
+ CookiesTreeModelTest()
+ : ui_thread_(BrowserThread::UI, &message_loop_),
+ file_user_blocking_(BrowserThread::FILE_USER_BLOCKING, &message_loop_),
+ io_thread_(BrowserThread::IO, &message_loop_) {
}
virtual ~CookiesTreeModelTest() {
@@ -276,6 +278,7 @@ class CookiesTreeModelTest : public testing::Test {
protected:
MessageLoop message_loop_;
content::TestBrowserThread ui_thread_;
+ content::TestBrowserThread file_user_blocking_;
content::TestBrowserThread io_thread_;
scoped_ptr<TestingProfile> profile_;
diff --git a/chrome/browser/diagnostics/sqlite_diagnostics.cc b/chrome/browser/diagnostics/sqlite_diagnostics.cc
index 686a2c31..1e58591 100644
--- a/chrome/browser/diagnostics/sqlite_diagnostics.cc
+++ b/chrome/browser/diagnostics/sqlite_diagnostics.cc
@@ -13,6 +13,7 @@
#include "base/utf_string_conversions.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths.h"
+#include "content/public/common/content_constants.h"
#include "sql/connection.h"
#include "sql/diagnostic_error_delegate.h"
#include "sql/statement.h"
@@ -152,7 +153,7 @@ DiagnosticTest* MakeSqliteThumbnailsDbTest() {
}
DiagnosticTest* MakeSqliteAppCacheDbTest() {
- FilePath appcache_dir(chrome::kAppCacheDirname);
+ FilePath appcache_dir(content::kAppCacheDirname);
FilePath appcache_db = appcache_dir.Append(appcache::kAppCacheDatabaseName);
return new SqliteIntegrityTest(false, ASCIIToUTF16("AppCache DB"),
appcache_db);
diff --git a/chrome/browser/download/download_request_limiter_unittest.cc b/chrome/browser/download/download_request_limiter_unittest.cc
index 614fe07..fff7d64 100644
--- a/chrome/browser/download/download_request_limiter_unittest.cc
+++ b/chrome/browser/download/download_request_limiter_unittest.cc
@@ -16,6 +16,8 @@ class DownloadRequestLimiterTest : public TabContentsWrapperTestHarness {
public:
DownloadRequestLimiterTest()
: ui_thread_(BrowserThread::UI, &message_loop_),
+ file_user_blocking_thread_(
+ BrowserThread::FILE_USER_BLOCKING, &message_loop_),
io_thread_(BrowserThread::IO, &message_loop_) {
}
@@ -90,6 +92,7 @@ class DownloadRequestLimiterTest : public TabContentsWrapperTestHarness {
int ask_allow_count_;
content::TestBrowserThread ui_thread_;
+ content::TestBrowserThread file_user_blocking_thread_;
content::TestBrowserThread io_thread_;
};
diff --git a/chrome/browser/extensions/extension_data_deleter.cc b/chrome/browser/extensions/extension_data_deleter.cc
index d314ffd..da69e21 100644
--- a/chrome/browser/extensions/extension_data_deleter.cc
+++ b/chrome/browser/extensions/extension_data_deleter.cc
@@ -23,6 +23,7 @@
#include "webkit/database/database_util.h"
#include "webkit/fileapi/file_system_context.h"
+using content::BrowserContext;
using content::BrowserThread;
// static
@@ -77,9 +78,9 @@ ExtensionDataDeleter::ExtensionDataDeleter(
const GURL& storage_origin,
bool is_storage_isolated)
: extension_id_(extension_id) {
- appcache_service_ = profile->GetAppCacheService();
- webkit_context_ = profile->GetWebKitContext();
- database_tracker_ = profile->GetDatabaseTracker();
+ 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,
// isolated app, or regular app.
if (storage_origin.SchemeIs(chrome::kExtensionScheme)) {
@@ -92,7 +93,7 @@ ExtensionDataDeleter::ExtensionDataDeleter(
} else {
extension_request_context_ = profile->GetRequestContext();
}
- file_system_context_ = profile->GetFileSystemContext();
+ file_system_context_ = BrowserContext::GetFileSystemContext(profile);
storage_origin_ = storage_origin;
origin_id_ =
webkit_database::DatabaseUtil::GetOriginIdentifier(storage_origin_);
diff --git a/chrome/browser/extensions/extension_file_browser_private_api.cc b/chrome/browser/extensions/extension_file_browser_private_api.cc
index 75a2c83..039265a 100644
--- a/chrome/browser/extensions/extension_file_browser_private_api.cc
+++ b/chrome/browser/extensions/extension_file_browser_private_api.cc
@@ -54,6 +54,7 @@
#endif
using chromeos::disks::DiskMountManager;
+using content::BrowserContext;
using content::BrowserThread;
using content::ChildProcessSecurityPolicy;
using content::SiteInstance;
@@ -389,7 +390,7 @@ class RequestLocalFileSystemFunction::LocalFileSystemCallbackDispatcher {
}
fileapi::ExternalFileSystemMountPointProvider* provider =
- profile_->GetFileSystemContext()->external_provider();
+ BrowserContext::GetFileSystemContext(profile_)->external_provider();
if (!provider)
return false;
@@ -420,7 +421,7 @@ class RequestLocalFileSystemFunction::LocalFileSystemCallbackDispatcher {
void RequestLocalFileSystemFunction::RequestOnFileThread(
const GURL& source_url, int child_id) {
GURL origin_url = source_url.GetOrigin();
- profile()->GetFileSystemContext()->OpenFileSystem(
+ BrowserContext::GetFileSystemContext(profile())->OpenFileSystem(
origin_url, fileapi::kFileSystemTypeExternal, false, // create
LocalFileSystemCallbackDispatcher::CreateCallback(
this,
@@ -473,8 +474,8 @@ bool FileWatchBrowserFunctionBase::GetLocalFilePath(
if (type != fileapi::kFileSystemTypeExternal)
return false;
- FilePath root_path = profile_->GetFileSystemContext()->external_provider()->
- GetFileSystemRootPathOnFileThread(
+ FilePath root_path = BrowserContext::GetFileSystemContext(profile_)->
+ external_provider()->GetFileSystemRootPathOnFileThread(
file_origin_url,
fileapi::kFileSystemTypeExternal,
*virtual_path,
@@ -744,7 +745,7 @@ class
return false;
fileapi::ExternalFileSystemMountPointProvider* external_provider =
- profile_->GetFileSystemContext()->external_provider();
+ BrowserContext::GetFileSystemContext(profile_)->external_provider();
if (!external_provider)
return false;
@@ -871,7 +872,7 @@ void ExecuteTasksFileBrowserFunction::RequestFileEntryOnFileThread(
const std::vector<GURL>& file_urls) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
GURL origin_url = source_url.GetOrigin();
- profile()->GetFileSystemContext()->OpenFileSystem(
+ BrowserContext::GetFileSystemContext(profile())->OpenFileSystem(
origin_url, fileapi::kFileSystemTypeExternal, false, // create
ExecuteTasksFileSystemCallbackDispatcher::CreateCallback(
this,
@@ -1005,7 +1006,7 @@ void FileBrowserFunction::GetLocalPathsOnFileThread(
// FilePath(virtual_path) doesn't work on win, so limit this to ChromeOS.
#if defined(OS_CHROMEOS)
fileapi::ExternalFileSystemMountPointProvider* provider =
- profile_->GetFileSystemContext()->external_provider();
+ BrowserContext::GetFileSystemContext(profile_)->external_provider();
if (!provider) {
LOG(WARNING) << "External provider is not available";
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
diff --git a/chrome/browser/extensions/extension_file_browser_private_apitest.cc b/chrome/browser/extensions/extension_file_browser_private_apitest.cc
index 417cc1f..7f42438 100644
--- a/chrome/browser/extensions/extension_file_browser_private_apitest.cc
+++ b/chrome/browser/extensions/extension_file_browser_private_apitest.cc
@@ -17,6 +17,7 @@
using ::testing::_;
using ::testing::ReturnRef;
using ::testing::StrEq;
+using content::BrowserContext;
class ExtensionFileBrowserPrivateApiTest : public ExtensionApiTest {
public:
@@ -51,7 +52,8 @@ class ExtensionFileBrowserPrivateApiTest : public ExtensionApiTest {
void AddTmpMountPoint() {
fileapi::ExternalFileSystemMountPointProvider* provider =
- browser()->profile()->GetFileSystemContext()->external_provider();
+ BrowserContext::GetFileSystemContext(browser()->profile())->
+ external_provider();
provider->AddMountPoint(test_mount_point_);
}
diff --git a/chrome/browser/extensions/extension_local_filesystem_apitest.cc b/chrome/browser/extensions/extension_local_filesystem_apitest.cc
index d8e8ce8..76502c2 100644
--- a/chrome/browser/extensions/extension_local_filesystem_apitest.cc
+++ b/chrome/browser/extensions/extension_local_filesystem_apitest.cc
@@ -8,6 +8,8 @@
#include "webkit/fileapi/file_system_context.h"
#include "webkit/fileapi/file_system_mount_point_provider.h"
+using content::BrowserContext;
+
#if defined(OS_CHROMEOS)
class FileSystemExtensionApiTest : public ExtensionApiTest {
@@ -21,7 +23,8 @@ class FileSystemExtensionApiTest : public ExtensionApiTest {
void AddTmpMountPoint() {
// Add tmp mount point.
fileapi::ExternalFileSystemMountPointProvider* provider =
- browser()->profile()->GetFileSystemContext()->external_provider();
+ BrowserContext::GetFileSystemContext(browser()->profile())->
+ external_provider();
provider->AddMountPoint(test_mount_point_);
}
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index 81a6a2f3..3b0902c 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -120,6 +120,7 @@
#endif
using base::Time;
+using content::BrowserContext;
using content::BrowserThread;
using content::DevToolsAgentHost;
using content::DevToolsAgentHostRegistry;
@@ -1136,9 +1137,9 @@ void ExtensionService::NotifyExtensionUnloaded(
#if defined(OS_CHROMEOS)
// Revoke external file access to
- if (profile_->GetFileSystemContext() &&
- profile_->GetFileSystemContext()->external_provider()) {
- profile_->GetFileSystemContext()->external_provider()->
+ if (BrowserContext::GetFileSystemContext(profile_) &&
+ BrowserContext::GetFileSystemContext(profile_)->external_provider()) {
+ BrowserContext::GetFileSystemContext(profile_)->external_provider()->
RevokeAccessForExtension(extension->id());
}
diff --git a/chrome/browser/extensions/extension_service_unittest.cc b/chrome/browser/extensions/extension_service_unittest.cc
index 5c4cc56..d18a3202 100644
--- a/chrome/browser/extensions/extension_service_unittest.cc
+++ b/chrome/browser/extensions/extension_service_unittest.cc
@@ -61,12 +61,12 @@
#include "chrome/common/url_constants.h"
#include "chrome/test/base/testing_profile.h"
#include "content/browser/appcache/chrome_appcache_service.h"
-#include "content/browser/file_system/browser_file_system_helper.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"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/plugin_service.h"
+#include "content/public/common/content_constants.h"
#include "content/test/test_browser_thread.h"
#include "googleurl/src/gurl.h"
#include "grit/browser_resources.h"
@@ -81,6 +81,7 @@
#include "webkit/plugins/npapi/mock_plugin_list.h"
#include "webkit/quota/quota_manager.h"
+using content::BrowserContext;
using content::BrowserThread;
using content::PluginService;
@@ -375,38 +376,8 @@ class ExtensionTestingProfile : public TestingProfile {
}
virtual ExtensionService* GetExtensionService() { return service_; }
- virtual ChromeAppCacheService* GetAppCacheService() {
- if (!appcache_service_) {
- appcache_service_ = new ChromeAppCacheService(NULL);
- if (!BrowserThread::PostTask(
- BrowserThread::IO, FROM_HERE,
- base::Bind(
- &ChromeAppCacheService::InitializeOnIOThread,
- appcache_service_.get(),
- IsOffTheRecord()
- ? FilePath() : GetPath().Append(chrome::kAppCacheDirname),
- GetResourceContext(),
- make_scoped_refptr(GetExtensionSpecialStoragePolicy()))))
- NOTREACHED();
- }
- return appcache_service_;
- }
-
- virtual fileapi::FileSystemContext* GetFileSystemContext() {
- if (!file_system_context_) {
- quota::QuotaManager* quota_manager = GetQuotaManager();
- file_system_context_ = CreateFileSystemContext(
- GetPath(), IsOffTheRecord(),
- GetExtensionSpecialStoragePolicy(),
- quota_manager ? quota_manager->proxy() : NULL);
- }
- return file_system_context_;
- }
-
private:
ExtensionService* service_;
- scoped_refptr<ChromeAppCacheService> appcache_service_;
- scoped_refptr<fileapi::FileSystemContext> file_system_context_;
};
// Our message loop may be used in tests which require it to be an IO loop.
@@ -3104,7 +3075,8 @@ TEST_F(ExtensionServiceTest, ClearExtensionData) {
EXPECT_EQ(1U, callback.list_.size());
// Open a database.
- webkit_database::DatabaseTracker* db_tracker = profile_->GetDatabaseTracker();
+ webkit_database::DatabaseTracker* db_tracker =
+ BrowserContext::GetDatabaseTracker(profile_.get());
string16 db_name = UTF8ToUTF16("db");
string16 description = UTF8ToUTF16("db_description");
int64 size;
@@ -3118,7 +3090,7 @@ TEST_F(ExtensionServiceTest, ClearExtensionData) {
// Create local storage. We only simulate this by creating the backing file
// since webkit is not initialized.
DOMStorageContext* context =
- profile_->GetWebKitContext()->dom_storage_context();
+ BrowserContext::GetWebKitContext(profile_.get())->dom_storage_context();
FilePath lso_path = context->GetLocalStorageFilePath(origin_id);
EXPECT_TRUE(file_util::CreateDirectory(lso_path.DirName()));
EXPECT_EQ(0, file_util::WriteFile(lso_path, NULL, 0));
@@ -3127,7 +3099,7 @@ TEST_F(ExtensionServiceTest, ClearExtensionData) {
// Create indexed db. Similarly, it is enough to only simulate this by
// creating the directory on the disk.
IndexedDBContext* idb_context =
- profile_->GetWebKitContext()->indexed_db_context();
+ BrowserContext::GetWebKitContext(profile_.get())->indexed_db_context();
FilePath idb_path = idb_context->GetIndexedDBFilePath(origin_id);
EXPECT_TRUE(file_util::CreateDirectory(idb_path));
EXPECT_TRUE(file_util::DirectoryExists(idb_path));
@@ -3213,7 +3185,8 @@ TEST_F(ExtensionServiceTest, ClearAppData) {
EXPECT_EQ(1U, callback.list_.size());
// Open a database.
- webkit_database::DatabaseTracker* db_tracker = profile_->GetDatabaseTracker();
+ webkit_database::DatabaseTracker* db_tracker =
+ BrowserContext::GetDatabaseTracker(profile_.get());
string16 db_name = UTF8ToUTF16("db");
string16 description = UTF8ToUTF16("db_description");
int64 size;
@@ -3227,7 +3200,7 @@ TEST_F(ExtensionServiceTest, ClearAppData) {
// Create local storage. We only simulate this by creating the backing file
// since webkit is not initialized.
DOMStorageContext* context =
- profile_->GetWebKitContext()->dom_storage_context();
+ BrowserContext::GetWebKitContext(profile_.get())->dom_storage_context();
FilePath lso_path = context->GetLocalStorageFilePath(origin_id);
EXPECT_TRUE(file_util::CreateDirectory(lso_path.DirName()));
EXPECT_EQ(0, file_util::WriteFile(lso_path, NULL, 0));
@@ -3236,7 +3209,7 @@ TEST_F(ExtensionServiceTest, ClearAppData) {
// Create indexed db. Similarly, it is enough to only simulate this by
// creating the directory on the disk.
IndexedDBContext* idb_context =
- profile_->GetWebKitContext()->indexed_db_context();
+ BrowserContext::GetWebKitContext(profile_.get())->indexed_db_context();
FilePath idb_path = idb_context->GetIndexedDBFilePath(origin_id);
EXPECT_TRUE(file_util::CreateDirectory(idb_path));
EXPECT_TRUE(file_util::DirectoryExists(idb_path));
diff --git a/chrome/browser/extensions/file_manager_util.cc b/chrome/browser/extensions/file_manager_util.cc
index 02ed921..5b96ac6 100644
--- a/chrome/browser/extensions/file_manager_util.cc
+++ b/chrome/browser/extensions/file_manager_util.cc
@@ -38,6 +38,7 @@
#include "chrome/browser/chromeos/media/media_player.h"
#endif
+using content::BrowserContext;
using content::BrowserThread;
using content::PluginService;
using content::UserMetricsAction;
@@ -216,7 +217,7 @@ bool ConvertFileToFileSystemUrl(
bool ConvertFileToRelativeFileSystemPath(
Profile* profile, const FilePath& full_file_path, FilePath* virtual_path) {
fileapi::ExternalFileSystemMountPointProvider* provider =
- profile->GetFileSystemContext()->external_provider();
+ BrowserContext::GetFileSystemContext(profile)->external_provider();
if (!provider)
return false;
diff --git a/chrome/browser/memory_purger.cc b/chrome/browser/memory_purger.cc
index a183855..7bf7c3a 100644
--- a/chrome/browser/memory_purger.cc
+++ b/chrome/browser/memory_purger.cc
@@ -25,6 +25,7 @@
#include "net/url_request/url_request_context_getter.h"
#include "third_party/tcmalloc/chromium/src/google/malloc_extension.h"
+using content::BrowserContext;
using content::BrowserThread;
// PurgeMemoryHelper -----------------------------------------------------------
@@ -118,7 +119,7 @@ void MemoryPurger::PurgeBrowser() {
// Ask all WebKitContexts to purge memory (freeing memory used to cache
// the LocalStorage sqlite DB). WebKitContext creation is basically free so
// we don't bother with a "...WithoutCreating()" function.
- profiles[i]->GetWebKitContext()->PurgeMemory();
+ BrowserContext::GetWebKitContext(profiles[i])->PurgeMemory();
}
BrowserThread::PostTask(
diff --git a/chrome/browser/net/view_blob_internals_job_factory.cc b/chrome/browser/net/view_blob_internals_job_factory.cc
index 246e618..ed9a109 100644
--- a/chrome/browser/net/view_blob_internals_job_factory.cc
+++ b/chrome/browser/net/view_blob_internals_job_factory.cc
@@ -8,7 +8,6 @@
#include "base/string_util.h"
#include "chrome/browser/net/chrome_url_request_context.h"
#include "chrome/common/url_constants.h"
-#include "content/browser/chrome_blob_storage_context.h"
#include "net/url_request/url_request.h"
#include "webkit/blob/view_blob_internals_job.h"
diff --git a/chrome/browser/profiles/off_the_record_profile_impl.cc b/chrome/browser/profiles/off_the_record_profile_impl.cc
index b206eec..49738b1 100644
--- a/chrome/browser/profiles/off_the_record_profile_impl.cc
+++ b/chrome/browser/profiles/off_the_record_profile_impl.cc
@@ -44,9 +44,6 @@
#include "chrome/common/json_pref_store.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/render_messages.h"
-#include "content/browser/appcache/chrome_appcache_service.h"
-#include "content/browser/chrome_blob_storage_context.h"
-#include "content/browser/file_system/browser_file_system_helper.h"
#include "content/browser/in_process_webkit/webkit_context.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/host_zoom_map.h"
@@ -55,7 +52,6 @@
#include "net/base/transport_security_state.h"
#include "net/http/http_server_properties.h"
#include "webkit/database/database_tracker.h"
-#include "webkit/quota/quota_manager.h"
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/preferences.h"
@@ -133,14 +129,6 @@ OffTheRecordProfileImpl::~OffTheRecordProfileImpl() {
BrowserThread::IO, FROM_HERE,
base::Bind(&NotifyOTRProfileDestroyedOnIOThread, profile_, this));
- // Clean up all DB files/directories
- if (db_tracker_) {
- BrowserThread::PostTask(
- BrowserThread::FILE, FROM_HERE,
- base::Bind(&webkit_database::DatabaseTracker::Shutdown,
- db_tracker_.get()));
- }
-
BrowserList::RemoveObserver(this);
if (host_content_settings_map_)
@@ -190,17 +178,6 @@ Profile* OffTheRecordProfileImpl::GetOriginalProfile() {
return profile_;
}
-ChromeAppCacheService* OffTheRecordProfileImpl::GetAppCacheService() {
- CreateQuotaManagerAndClients();
- return appcache_service_;
-}
-
-webkit_database::DatabaseTracker*
- OffTheRecordProfileImpl::GetDatabaseTracker() {
- CreateQuotaManagerAndClients();
- return db_tracker_;
-}
-
VisitedLinkMaster* OffTheRecordProfileImpl::GetVisitedLinkMaster() {
// We don't provide access to the VisitedLinkMaster when we're OffTheRecord
// because we don't want to leak the sites that the user has visited before.
@@ -313,20 +290,10 @@ DownloadManager* OffTheRecordProfileImpl::GetDownloadManager() {
return DownloadServiceFactory::GetForProfile(this)->GetDownloadManager();
}
-fileapi::FileSystemContext* OffTheRecordProfileImpl::GetFileSystemContext() {
- CreateQuotaManagerAndClients();
- return file_system_context_.get();
-}
-
net::URLRequestContextGetter* OffTheRecordProfileImpl::GetRequestContext() {
return io_data_.GetMainRequestContextGetter();
}
-quota::QuotaManager* OffTheRecordProfileImpl::GetQuotaManager() {
- CreateQuotaManagerAndClients();
- return quota_manager_.get();
-}
-
net::URLRequestContextGetter*
OffTheRecordProfileImpl::GetRequestContextForRenderProcess(
int renderer_child_id) {
@@ -409,6 +376,11 @@ bool OffTheRecordProfileImpl::DidLastSessionExitCleanly() {
return profile_->DidLastSessionExitCleanly();
}
+quota::SpecialStoragePolicy*
+ OffTheRecordProfileImpl::GetSpecialStoragePolicy() {
+ return GetExtensionSpecialStoragePolicy();
+}
+
BookmarkModel* OffTheRecordProfileImpl::GetBookmarkModel() {
return profile_->GetBookmarkModel();
}
@@ -429,11 +401,6 @@ Time OffTheRecordProfileImpl::GetStartTime() const {
return start_time_;
}
-WebKitContext* OffTheRecordProfileImpl::GetWebKitContext() {
- CreateQuotaManagerAndClients();
- return webkit_context_.get();
-}
-
history::TopSites* OffTheRecordProfileImpl::GetTopSitesWithoutCreating() {
return NULL;
}
@@ -487,17 +454,6 @@ void OffTheRecordProfileImpl::OnBrowserAdded(const Browser* browser) {
void OffTheRecordProfileImpl::OnBrowserRemoved(const Browser* browser) {
}
-ChromeBlobStorageContext* OffTheRecordProfileImpl::GetBlobStorageContext() {
- if (!blob_storage_context_) {
- blob_storage_context_ = new ChromeBlobStorageContext();
- BrowserThread::PostTask(
- BrowserThread::IO, FROM_HERE,
- base::Bind(&ChromeBlobStorageContext::InitializeOnIOThread,
- blob_storage_context_.get()));
- }
- return blob_storage_context_;
-}
-
ExtensionInfoMap* OffTheRecordProfileImpl::GetExtensionInfoMap() {
return profile_->GetExtensionInfoMap();
}
@@ -557,51 +513,6 @@ void OffTheRecordProfileImpl::Observe(int type,
}
}
-void OffTheRecordProfileImpl::CreateQuotaManagerAndClients() {
- if (quota_manager_.get()) {
- DCHECK(file_system_context_.get());
- DCHECK(db_tracker_.get());
- DCHECK(webkit_context_.get());
- return;
- }
-
- // All of the clients have to be created and registered with the
- // QuotaManager prior to the QuotaManger being used. So we do them
- // all together here prior to handing out a reference to anything
- // that utlizes the QuotaManager.
- quota_manager_ = new quota::QuotaManager(
- IsOffTheRecord(),
- GetPath(),
- BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO),
- BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB),
- GetExtensionSpecialStoragePolicy());
-
- // Each consumer is responsible for registering its QuotaClient during
- // its construction.
- file_system_context_ = CreateFileSystemContext(
- GetPath(), IsOffTheRecord(),
- GetExtensionSpecialStoragePolicy(),
- quota_manager_->proxy());
- db_tracker_ = new webkit_database::DatabaseTracker(
- GetPath(), IsOffTheRecord(), false, GetExtensionSpecialStoragePolicy(),
- quota_manager_->proxy(),
- BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE));
- webkit_context_ = new WebKitContext(
- IsOffTheRecord(), GetPath(), GetExtensionSpecialStoragePolicy(),
- false, quota_manager_->proxy(),
- BrowserThread::GetMessageLoopProxyForThread(
- BrowserThread::WEBKIT_DEPRECATED));
- appcache_service_ = new ChromeAppCacheService(quota_manager_->proxy());
- BrowserThread::PostTask(
- BrowserThread::IO, FROM_HERE,
- base::Bind(&ChromeAppCacheService::InitializeOnIOThread,
- appcache_service_.get(),
- IsOffTheRecord()
- ? FilePath() : GetPath().Append(chrome::kAppCacheDirname),
- io_data_.GetResourceContextNoInit(),
- make_scoped_refptr(GetExtensionSpecialStoragePolicy())));
-}
-
#if defined(OS_CHROMEOS)
// Special case of the OffTheRecordProfileImpl which is used while Guest
// session in CrOS.
diff --git a/chrome/browser/profiles/off_the_record_profile_impl.h b/chrome/browser/profiles/off_the_record_profile_impl.h
index d22887d..e22e9d4 100644
--- a/chrome/browser/profiles/off_the_record_profile_impl.h
+++ b/chrome/browser/profiles/off_the_record_profile_impl.h
@@ -35,14 +35,10 @@ class OffTheRecordProfileImpl : public Profile,
// Profile implementation.
virtual std::string GetProfileName() OVERRIDE;
- virtual FilePath GetPath() OVERRIDE;
- virtual bool IsOffTheRecord() OVERRIDE;
virtual Profile* GetOffTheRecordProfile() OVERRIDE;
virtual void DestroyOffTheRecordProfile() OVERRIDE;
virtual bool HasOffTheRecordProfile() OVERRIDE;
virtual Profile* GetOriginalProfile() OVERRIDE;
- virtual ChromeAppCacheService* GetAppCacheService() OVERRIDE;
- virtual webkit_database::DatabaseTracker* GetDatabaseTracker() OVERRIDE;
virtual VisitedLinkMaster* GetVisitedLinkMaster() OVERRIDE;
virtual ExtensionService* GetExtensionService() OVERRIDE;
virtual UserScriptMaster* GetUserScriptMaster() OVERRIDE;
@@ -64,32 +60,18 @@ class OffTheRecordProfileImpl : public Profile,
virtual PrefService* GetPrefs() OVERRIDE;
virtual PrefService* GetOffTheRecordPrefs() OVERRIDE;
virtual TemplateURLFetcher* GetTemplateURLFetcher() OVERRIDE;
- virtual content::DownloadManager* GetDownloadManager() OVERRIDE;
- virtual fileapi::FileSystemContext* GetFileSystemContext() OVERRIDE;
- virtual net::URLRequestContextGetter* GetRequestContext() OVERRIDE;
- virtual quota::QuotaManager* GetQuotaManager() OVERRIDE;
- virtual net::URLRequestContextGetter* GetRequestContextForRenderProcess(
- int renderer_child_id) OVERRIDE;
- virtual net::URLRequestContextGetter* GetRequestContextForMedia() OVERRIDE;
virtual net::URLRequestContextGetter*
GetRequestContextForExtensions() OVERRIDE;
virtual net::URLRequestContextGetter* GetRequestContextForIsolatedApp(
const std::string& app_id) OVERRIDE;
- virtual content::ResourceContext* GetResourceContext() OVERRIDE;
virtual net::SSLConfigService* GetSSLConfigService() OVERRIDE;
virtual HostContentSettingsMap* GetHostContentSettingsMap() OVERRIDE;
- virtual content::HostZoomMap* GetHostZoomMap() OVERRIDE;
- virtual content::GeolocationPermissionContext*
- GetGeolocationPermissionContext() OVERRIDE;
- virtual content::SpeechInputPreferences* GetSpeechInputPreferences() OVERRIDE;
virtual UserStyleSheetWatcher* GetUserStyleSheetWatcher() OVERRIDE;
- virtual bool DidLastSessionExitCleanly() OVERRIDE;
virtual BookmarkModel* GetBookmarkModel() OVERRIDE;
virtual ProtocolHandlerRegistry* GetProtocolHandlerRegistry() OVERRIDE;
virtual TokenService* GetTokenService() OVERRIDE;
virtual bool IsSameProfile(Profile* profile) OVERRIDE;
virtual Time GetStartTime() const OVERRIDE;
- virtual WebKitContext* GetWebKitContext() OVERRIDE;
virtual history::TopSites* GetTopSitesWithoutCreating() OVERRIDE;
virtual history::TopSites* GetTopSites() OVERRIDE;
virtual void MarkAsCleanShutdown() OVERRIDE;
@@ -106,7 +88,6 @@ class OffTheRecordProfileImpl : public Profile,
virtual void OnBrowserAdded(const Browser* browser) OVERRIDE;
virtual void OnBrowserRemoved(const Browser* browser) OVERRIDE;
- virtual ChromeBlobStorageContext* GetBlobStorageContext() OVERRIDE;
virtual ExtensionInfoMap* GetExtensionInfoMap() OVERRIDE;
virtual ChromeURLDataManager* GetChromeURLDataManager() OVERRIDE;
virtual PromoCounter* GetInstantPromoCounter() OVERRIDE;
@@ -123,14 +104,28 @@ class OffTheRecordProfileImpl : public Profile,
virtual void ClearNetworkingHistorySince(base::Time time) OVERRIDE;
virtual GURL GetHomePage() OVERRIDE;
+ // content::BrowserContext implementation:
+ virtual FilePath GetPath() OVERRIDE;
+ virtual bool IsOffTheRecord() OVERRIDE;
+ virtual content::DownloadManager* GetDownloadManager() OVERRIDE;
+ virtual net::URLRequestContextGetter* GetRequestContext() OVERRIDE;
+ virtual net::URLRequestContextGetter* GetRequestContextForRenderProcess(
+ int renderer_child_id) OVERRIDE;
+ virtual net::URLRequestContextGetter* GetRequestContextForMedia() OVERRIDE;
+ virtual content::ResourceContext* GetResourceContext() OVERRIDE;
+ virtual content::HostZoomMap* GetHostZoomMap() OVERRIDE;
+ virtual content::GeolocationPermissionContext*
+ GetGeolocationPermissionContext() OVERRIDE;
+ virtual content::SpeechInputPreferences* GetSpeechInputPreferences() OVERRIDE;
+ virtual bool DidLastSessionExitCleanly() OVERRIDE;
+ virtual quota::SpecialStoragePolicy* GetSpecialStoragePolicy() OVERRIDE;
+
// content::NotificationObserver implementation.
virtual void Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE;
private:
- void CreateQuotaManagerAndClients();
-
content::NotificationRegistrar registrar_;
// The real underlying profile.
@@ -152,31 +147,15 @@ class OffTheRecordProfileImpl : public Profile,
// Use a separate zoom map for OTR.
scoped_refptr<content::HostZoomMap> host_zoom_map_;
- // Use a special WebKit context for OTR browsing.
- scoped_refptr<WebKitContext> webkit_context_;
-
// Time we were started.
Time start_time_;
- scoped_refptr<ChromeAppCacheService> appcache_service_;
-
- // The main database tracker for this profile.
- // Should be used only on the file thread.
- scoped_refptr<webkit_database::DatabaseTracker> db_tracker_;
-
FilePath last_selected_directory_;
- scoped_refptr<ChromeBlobStorageContext> blob_storage_context_;
-
- // The file_system context for this profile.
- scoped_refptr<fileapi::FileSystemContext> file_system_context_;
-
scoped_ptr<PrefProxyConfigTracker> pref_proxy_config_tracker_;
scoped_ptr<ChromeURLDataManager> chrome_url_data_manager_;
- scoped_refptr<quota::QuotaManager> quota_manager_;
-
DISALLOW_COPY_AND_ASSIGN(OffTheRecordProfileImpl);
};
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 a77beec..3f8a01b 100644
--- a/chrome/browser/profiles/off_the_record_profile_io_data.cc
+++ b/chrome/browser/profiles/off_the_record_profile_io_data.cc
@@ -130,6 +130,9 @@ 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());
@@ -138,7 +141,6 @@ void OffTheRecordProfileIOData::Handle::LazyInitialize() const {
profile_->GetPrefs(), NULL);
io_data_->safe_browsing_enabled()->MoveToThread(BrowserThread::IO);
#endif
- initialized_ = true;
}
}
diff --git a/chrome/browser/profiles/profile.cc b/chrome/browser/profiles/profile.cc
index c238068..4390994 100644
--- a/chrome/browser/profiles/profile.cc
+++ b/chrome/browser/profiles/profile.cc
@@ -44,17 +44,12 @@
#include "chrome/common/json_pref_store.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/render_messages.h"
-#include "content/browser/appcache/chrome_appcache_service.h"
-#include "content/browser/chrome_blob_storage_context.h"
-#include "content/browser/file_system/browser_file_system_helper.h"
#include "content/browser/in_process_webkit/webkit_context.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/download_manager.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui.h"
#include "ui/base/resource/resource_bundle.h"
-#include "webkit/database/database_tracker.h"
-#include "webkit/quota/quota_manager.h"
#if defined(TOOLKIT_USES_GTK)
#include "chrome/browser/ui/gtk/gtk_theme_service.h"
diff --git a/chrome/browser/profiles/profile.h b/chrome/browser/profiles/profile.h
index 286af37..70cc53a 100644
--- a/chrome/browser/profiles/profile.h
+++ b/chrome/browser/profiles/profile.h
@@ -180,28 +180,6 @@ class Profile : public content::BrowserContext {
// Returns the profile corresponding to the given WebUI.
static Profile* FromWebUI(content::WebUI* web_ui);
- // content::BrowserContext implementation ------------------------------------
-
- virtual FilePath GetPath() = 0;
- virtual content::DownloadManager* GetDownloadManager() = 0;
- virtual net::URLRequestContextGetter* GetRequestContext() = 0;
- virtual net::URLRequestContextGetter* GetRequestContextForRenderProcess(
- int renderer_child_id) = 0;
- virtual net::URLRequestContextGetter* GetRequestContextForMedia() = 0;
- virtual content::ResourceContext* GetResourceContext() = 0;
- virtual content::HostZoomMap* GetHostZoomMap() = 0;
- virtual content::GeolocationPermissionContext*
- GetGeolocationPermissionContext() = 0;
- virtual content::SpeechInputPreferences* GetSpeechInputPreferences() = 0;
- virtual quota::QuotaManager* GetQuotaManager() = 0;
- virtual webkit_database::DatabaseTracker* GetDatabaseTracker() = 0;
- virtual WebKitContext* GetWebKitContext() = 0;
- virtual ChromeAppCacheService* GetAppCacheService() = 0;
- virtual ChromeBlobStorageContext* GetBlobStorageContext() = 0;
- virtual fileapi::FileSystemContext* GetFileSystemContext() = 0;
-
- // content::BrowserContext implementation ------------------------------------
-
// Typesafe upcast.
virtual TestingProfile* AsTestingProfile();
@@ -378,9 +356,6 @@ class Profile : public content::BrowserContext {
// Returns the user style sheet watcher.
virtual UserStyleSheetWatcher* GetUserStyleSheetWatcher() = 0;
- // Returns true if the last time this profile was open it was exited cleanly.
- virtual bool DidLastSessionExitCleanly() = 0;
-
// Returns the BookmarkModel, creating if not yet created.
virtual BookmarkModel* GetBookmarkModel() = 0;
diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc
index 1c95a71..b166fc0 100644
--- a/chrome/browser/profiles/profile_impl.cc
+++ b/chrome/browser/profiles/profile_impl.cc
@@ -92,9 +92,6 @@
#include "chrome/common/json_pref_store.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/file_system/browser_file_system_helper.h"
#include "content/browser/in_process_webkit/webkit_context.h"
#include "content/browser/speech/speech_input_manager.h"
#include "content/public/browser/browser_thread.h"
@@ -105,7 +102,6 @@
#include "net/base/transport_security_state.h"
#include "net/http/http_server_properties.h"
#include "webkit/database/database_tracker.h"
-#include "webkit/quota/quota_manager.h"
#if defined(OS_WIN)
#include "chrome/browser/instant/promo_counter.h"
@@ -549,13 +545,15 @@ ProfileImpl::~ProfileImpl() {
// Save the session state if we're going to restore the session during the
// next startup.
SessionStartupPref pref = SessionStartupPref::GetStartupPref(this);
- if (pref.type == SessionStartupPref::LAST)
+ if (pref.type == SessionStartupPref::LAST) {
SaveSessionState();
- else if (appcache_service_ && clear_local_state_on_exit_) {
+ } else if (clear_local_state_on_exit_) {
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
base::Bind(&appcache::AppCacheService::set_clear_local_state_on_exit,
- appcache_service_.get(), true));
+ BrowserContext::GetAppCacheService(this), true));
+ BrowserContext::GetWebKitContext(this)->set_clear_local_state_on_exit(true);
+ BrowserContext::GetDatabaseTracker(this)->SetClearLocalStateOnExit(true);
}
StopCreateSessionServiceTimer();
@@ -576,13 +574,6 @@ ProfileImpl::~ProfileImpl() {
ProfileDependencyManager::GetInstance()->DestroyProfileServices(this);
- if (db_tracker_) {
- BrowserThread::PostTask(
- BrowserThread::FILE, FROM_HERE,
- base::Bind(&webkit_database::DatabaseTracker::Shutdown,
- db_tracker_.get()));
- }
-
// Password store uses WebDB, shut it down before the WebDB has been shutdown.
if (password_store_.get())
password_store_->Shutdown();
@@ -680,16 +671,6 @@ Profile* ProfileImpl::GetOriginalProfile() {
return this;
}
-ChromeAppCacheService* ProfileImpl::GetAppCacheService() {
- CreateQuotaManagerAndClients();
- return appcache_service_;
-}
-
-webkit_database::DatabaseTracker* ProfileImpl::GetDatabaseTracker() {
- CreateQuotaManagerAndClients();
- return db_tracker_;
-}
-
VisitedLinkMaster* ProfileImpl::GetVisitedLinkMaster() {
if (!visited_link_master_.get()) {
scoped_ptr<VisitedLinkMaster> visited_links(
@@ -1136,16 +1117,6 @@ DownloadManager* ProfileImpl::GetDownloadManager() {
return DownloadServiceFactory::GetForProfile(this)->GetDownloadManager();
}
-fileapi::FileSystemContext* ProfileImpl::GetFileSystemContext() {
- CreateQuotaManagerAndClients();
- return file_system_context_.get();
-}
-
-quota::QuotaManager* ProfileImpl::GetQuotaManager() {
- CreateQuotaManagerAndClients();
- return quota_manager_.get();
-}
-
bool ProfileImpl::DidLastSessionExitCleanly() {
// last_session_exited_cleanly_ is set when the preferences are loaded. Force
// it to be set by asking for the prefs.
@@ -1153,6 +1124,10 @@ bool ProfileImpl::DidLastSessionExitCleanly() {
return last_session_exited_cleanly_;
}
+quota::SpecialStoragePolicy* ProfileImpl::GetSpecialStoragePolicy() {
+ return GetExtensionSpecialStoragePolicy();
+}
+
BookmarkModel* ProfileImpl::GetBookmarkModel() {
if (!bookmark_bar_model_.get()) {
bookmark_bar_model_.reset(new BookmarkModel(this));
@@ -1194,57 +1169,6 @@ ExtensionPrefValueMap* ProfileImpl::GetExtensionPrefValueMap() {
return extension_pref_value_map_.get();
}
-void ProfileImpl::CreateQuotaManagerAndClients() {
- if (quota_manager_.get()) {
- DCHECK(file_system_context_.get());
- DCHECK(db_tracker_.get());
- DCHECK(webkit_context_.get());
- return;
- }
-
- // All of the clients have to be created and registered with the
- // QuotaManager prior to the QuotaManger being used. So we do them
- // all together here prior to handing out a reference to anything
- // that utlizes the QuotaManager.
- quota_manager_ = new quota::QuotaManager(
- IsOffTheRecord(),
- GetPath(),
- BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO),
- BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB),
- GetExtensionSpecialStoragePolicy());
-
- // Each consumer is responsible for registering its QuotaClient during
- // its construction.
- file_system_context_ = CreateFileSystemContext(
- GetPath(), IsOffTheRecord(),
- GetExtensionSpecialStoragePolicy(),
- quota_manager_->proxy());
- db_tracker_ = new webkit_database::DatabaseTracker(
- GetPath(), IsOffTheRecord(), clear_local_state_on_exit_,
- GetExtensionSpecialStoragePolicy(),
- quota_manager_->proxy(),
- BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE));
- webkit_context_ = new WebKitContext(
- IsOffTheRecord(), GetPath(), GetExtensionSpecialStoragePolicy(),
- clear_local_state_on_exit_, quota_manager_->proxy(),
- BrowserThread::GetMessageLoopProxyForThread(
- BrowserThread::WEBKIT_DEPRECATED));
- appcache_service_ = new ChromeAppCacheService(quota_manager_->proxy());
- BrowserThread::PostTask(
- BrowserThread::IO, FROM_HERE,
- base::Bind(&ChromeAppCacheService::InitializeOnIOThread,
- appcache_service_.get(),
- IsOffTheRecord()
- ? FilePath() : GetPath().Append(chrome::kAppCacheDirname),
- io_data_.GetResourceContextNoInit(),
- make_scoped_refptr(GetExtensionSpecialStoragePolicy())));
-}
-
-WebKitContext* ProfileImpl::GetWebKitContext() {
- CreateQuotaManagerAndClients();
- return webkit_context_.get();
-}
-
void ProfileImpl::MarkAsCleanShutdown() {
if (prefs_.get()) {
// The session cleanly exited, set kSessionExitedCleanly appropriately.
@@ -1280,14 +1204,6 @@ void ProfileImpl::Observe(int type,
} else if (*pref_name_in == prefs::kClearSiteDataOnExit) {
clear_local_state_on_exit_ =
prefs->GetBoolean(prefs::kClearSiteDataOnExit);
- if (webkit_context_) {
- webkit_context_->set_clear_local_state_on_exit(
- clear_local_state_on_exit_);
- }
- if (db_tracker_) {
- db_tracker_->SetClearLocalStateOnExit(
- clear_local_state_on_exit_);
- }
} else if (*pref_name_in == prefs::kGoogleServicesUsername) {
UpdateProfileUserNameCache();
} else if (*pref_name_in == prefs::kProfileAvatarIndex) {
@@ -1342,17 +1258,6 @@ TokenService* ProfileImpl::GetTokenService() {
return token_service_.get();
}
-ChromeBlobStorageContext* ProfileImpl::GetBlobStorageContext() {
- if (!blob_storage_context_) {
- blob_storage_context_ = new ChromeBlobStorageContext();
- BrowserThread::PostTask(
- BrowserThread::IO, FROM_HERE,
- base::Bind(&ChromeBlobStorageContext::InitializeOnIOThread,
- blob_storage_context_.get()));
- }
- return blob_storage_context_;
-}
-
ExtensionInfoMap* ProfileImpl::GetExtensionInfoMap() {
return extension_info_map_.get();
}
@@ -1526,16 +1431,14 @@ GURL ProfileImpl::GetHomePage() {
void ProfileImpl::SaveSessionState() {
if (!session_restore_enabled_)
return;
- if (webkit_context_.get())
- webkit_context_->SaveSessionState();
- if (db_tracker_.get())
- db_tracker_->SaveSessionState();
+ BrowserContext::GetWebKitContext(this)->SaveSessionState();
+ BrowserContext::GetDatabaseTracker(this)->SaveSessionState();
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
base::Bind(&SaveSessionStateOnIOThread,
make_scoped_refptr(GetRequestContext()),
- make_scoped_refptr(appcache_service_.get())));
+ make_scoped_refptr(BrowserContext::GetAppCacheService(this))));
}
void ProfileImpl::UpdateProfileUserNameCache() {
diff --git a/chrome/browser/profiles/profile_impl.h b/chrome/browser/profiles/profile_impl.h
index f7884b1..b82f1a7 100644
--- a/chrome/browser/profiles/profile_impl.h
+++ b/chrome/browser/profiles/profile_impl.h
@@ -61,12 +61,8 @@ class ProfileImpl : public Profile,
virtual content::GeolocationPermissionContext*
GetGeolocationPermissionContext() OVERRIDE;
virtual content::SpeechInputPreferences* GetSpeechInputPreferences() OVERRIDE;
- virtual quota::QuotaManager* GetQuotaManager() OVERRIDE;
- virtual webkit_database::DatabaseTracker* GetDatabaseTracker() OVERRIDE;
- virtual WebKitContext* GetWebKitContext() OVERRIDE;
- virtual ChromeAppCacheService* GetAppCacheService() OVERRIDE;
- virtual ChromeBlobStorageContext* GetBlobStorageContext() OVERRIDE;
- virtual fileapi::FileSystemContext* GetFileSystemContext() OVERRIDE;
+ virtual bool DidLastSessionExitCleanly() OVERRIDE;
+ virtual quota::SpecialStoragePolicy* GetSpecialStoragePolicy() OVERRIDE;
// Profile implementation:
virtual std::string GetProfileName() OVERRIDE;
@@ -110,7 +106,6 @@ class ProfileImpl : public Profile,
virtual net::SSLConfigService* GetSSLConfigService() OVERRIDE;
virtual HostContentSettingsMap* GetHostContentSettingsMap() OVERRIDE;
virtual UserStyleSheetWatcher* GetUserStyleSheetWatcher() OVERRIDE;
- virtual bool DidLastSessionExitCleanly() OVERRIDE;
virtual BookmarkModel* GetBookmarkModel() OVERRIDE;
virtual ProtocolHandlerRegistry* GetProtocolHandlerRegistry() OVERRIDE;
virtual bool IsSameProfile(Profile* profile) OVERRIDE;
@@ -176,8 +171,6 @@ class ProfileImpl : public Profile,
ExtensionPrefValueMap* GetExtensionPrefValueMap();
- void CreateQuotaManagerAndClients();
-
void UpdateProfileUserNameCache();
@@ -251,9 +244,6 @@ class ProfileImpl : public Profile,
scoped_refptr<history::ShortcutsBackend> shortcuts_backend_;
scoped_refptr<WebDataService> web_data_service_;
scoped_refptr<PasswordStore> password_store_;
- scoped_refptr<WebKitContext> webkit_context_;
- scoped_refptr<fileapi::FileSystemContext> file_system_context_;
- scoped_refptr<quota::QuotaManager> quota_manager_;
bool history_service_created_;
bool favicon_service_created_;
bool created_web_data_service_;
@@ -274,18 +264,8 @@ class ProfileImpl : public Profile,
scoped_ptr<PromoCounter> instant_promo_counter_;
#endif
- // The AppCacheService for this profile, shared by all requests contexts
- // associated with this profile. Should only be used on the IO thread.
- scoped_refptr<ChromeAppCacheService> appcache_service_;
-
- // The main database tracker for this profile.
- // Should be used only on the file thread.
- scoped_refptr<webkit_database::DatabaseTracker> db_tracker_;
-
scoped_refptr<history::TopSites> top_sites_; // For history and thumbnails.
- scoped_refptr<ChromeBlobStorageContext> blob_storage_context_;
-
#if defined(OS_CHROMEOS)
scoped_ptr<chromeos::Preferences> chromeos_preferences_;
diff --git a/chrome/browser/profiles/profile_impl_io_data.cc b/chrome/browser/profiles/profile_impl_io_data.cc
index 3481fda..0b01f29 100644
--- a/chrome/browser/profiles/profile_impl_io_data.cc
+++ b/chrome/browser/profiles/profile_impl_io_data.cc
@@ -223,6 +223,9 @@ 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(
@@ -240,7 +243,6 @@ void ProfileImplIOData::Handle::LazyInitialize() const {
pref_service, NULL);
io_data_->safe_browsing_enabled()->MoveToThread(BrowserThread::IO);
#endif
- initialized_ = true;
}
}
diff --git a/chrome/browser/profiles/profile_io_data.cc b/chrome/browser/profiles/profile_io_data.cc
index 5e761a1..c0b0e13 100644
--- a/chrome/browser/profiles/profile_io_data.cc
+++ b/chrome/browser/profiles/profile_io_data.cc
@@ -70,6 +70,7 @@
#include "chrome/browser/chromeos/proxy_config_service_impl.h"
#endif // defined(OS_CHROMEOS)
+using content::BrowserContext;
using content::BrowserThread;
namespace {
@@ -195,7 +196,7 @@ void ProfileIOData::InitializeOnUIThread(Profile* profile) {
params->clear_local_state_on_exit =
pref_service->GetBoolean(prefs::kClearSiteDataOnExit);
- params->appcache_service = profile->GetAppCacheService();
+ params->appcache_service = BrowserContext::GetAppCacheService(profile);
// Set up Accept-Language and Accept-Charset header values
params->accept_language = net::HttpUtil::GenerateAcceptLanguageHeader(
@@ -231,12 +232,12 @@ void ProfileIOData::InitializeOnUIThread(Profile* profile) {
profile);
params->cookie_monster_delegate =
new ChromeCookieMonsterDelegate(profile_getter);
- params->database_tracker = profile->GetDatabaseTracker();
- params->appcache_service = profile->GetAppCacheService();
- params->blob_storage_context = profile->GetBlobStorageContext();
- params->file_system_context = profile->GetFileSystemContext();
- params->webkit_context = profile->GetWebKitContext();
- params->quota_manager = profile->GetQuotaManager();
+ 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);
diff --git a/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc b/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc
index ff85fac..7588b60 100644
--- a/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc
+++ b/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc
@@ -159,6 +159,9 @@ class ClientSideDetectionHostTest : public TabContentsWrapperTestHarness {
ui_thread_.reset(new content::TestBrowserThread(BrowserThread::UI,
&message_loop_));
+ file_user_blocking_thread_.reset(
+ new content::TestBrowserThread(BrowserThread::FILE_USER_BLOCKING,
+ &message_loop_));
// Note: we're starting a real IO thread to make sure our DCHECKs that
// verify which thread is running are actually tested.
io_thread_.reset(new content::TestBrowserThread(BrowserThread::IO));
@@ -187,6 +190,7 @@ class ClientSideDetectionHostTest : public TabContentsWrapperTestHarness {
message_loop_.RunAllPending();
TabContentsWrapperTestHarness::TearDown();
io_thread_.reset();
+ file_user_blocking_thread_.reset();
ui_thread_.reset();
}
@@ -290,6 +294,7 @@ class ClientSideDetectionHostTest : public TabContentsWrapperTestHarness {
private:
scoped_ptr<content::TestBrowserThread> ui_thread_;
+ scoped_ptr<content::TestBrowserThread> file_user_blocking_thread_;
scoped_ptr<content::TestBrowserThread> io_thread_;
};
diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc
index 139a643..7a366bc 100644
--- a/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc
@@ -82,6 +82,8 @@ class SafeBrowsingBlockingPageTest : public ChromeRenderViewHostTestHarness {
SafeBrowsingBlockingPageTest()
: ui_thread_(BrowserThread::UI, MessageLoop::current()),
+ file_user_blocking_thread_(
+ BrowserThread::FILE_USER_BLOCKING, MessageLoop::current()),
io_thread_(BrowserThread::IO, MessageLoop::current()) {
ResetUserResponse();
service_ = new TestSafeBrowsingService();
@@ -189,6 +191,7 @@ class SafeBrowsingBlockingPageTest : public ChromeRenderViewHostTestHarness {
UserResponse user_response_;
TestSafeBrowsingBlockingPageFactory factory_;
content::TestBrowserThread ui_thread_;
+ content::TestBrowserThread file_user_blocking_thread_;
content::TestBrowserThread io_thread_;
};
diff --git a/chrome/browser/sync/profile_sync_service_autofill_unittest.cc b/chrome/browser/sync/profile_sync_service_autofill_unittest.cc
index 60c44b3..bb872fd 100644
--- a/chrome/browser/sync/profile_sync_service_autofill_unittest.cc
+++ b/chrome/browser/sync/profile_sync_service_autofill_unittest.cc
@@ -380,10 +380,6 @@ class ProfileSyncServiceAutofillTest : public AbstractProfileSyncServiceTest {
WillRepeatedly(Return(web_data_service_.get()));
personal_data_manager_->Init(&profile_);
- notification_service_ = new ThreadNotificationService(
- db_thread_.DeprecatedGetThreadObject());
- notification_service_->Init();
-
// Note: This must be called *after* the notification service is created.
web_data_service_->StartSyncableService();
}
@@ -392,7 +388,6 @@ class ProfileSyncServiceAutofillTest : public AbstractProfileSyncServiceTest {
// Note: The tear down order is important.
service_.reset();
web_data_service_->ShutdownSyncableService();
- notification_service_->TearDown();
profile_.ResetRequestContext();
AbstractProfileSyncServiceTest::TearDown();
}
@@ -572,8 +567,6 @@ class ProfileSyncServiceAutofillTest : public AbstractProfileSyncServiceTest {
friend class AddAutofillHelper<AutofillProfile>;
friend class FakeServerUpdater;
- scoped_refptr<ThreadNotificationService> notification_service_;
-
ProfileMock profile_;
AutofillTableMock autofill_table_;
scoped_ptr<WebDatabaseFake> web_database_;
diff --git a/chrome/browser/sync/profile_sync_service_password_unittest.cc b/chrome/browser/sync/profile_sync_service_password_unittest.cc
index d8d481d..49a453a 100644
--- a/chrome/browser/sync/profile_sync_service_password_unittest.cc
+++ b/chrome/browser/sync/profile_sync_service_password_unittest.cc
@@ -181,9 +181,6 @@ class ProfileSyncServicePasswordTest : public AbstractProfileSyncServiceTest {
profile_.CreateRequestContext();
password_store_ = new MockPasswordStore();
- notification_service_ = new ThreadNotificationService(
- db_thread_.DeprecatedGetThreadObject());
- notification_service_->Init();
registrar_.Add(&observer_,
chrome::NOTIFICATION_SYNC_CONFIGURE_DONE,
content::NotificationService::AllSources());
@@ -195,7 +192,6 @@ class ProfileSyncServicePasswordTest : public AbstractProfileSyncServiceTest {
virtual void TearDown() {
password_store_->Shutdown();
service_.reset();
- notification_service_->TearDown();
profile_.ResetRequestContext();
AbstractProfileSyncServiceTest::TearDown();
}
@@ -315,7 +311,6 @@ class ProfileSyncServicePasswordTest : public AbstractProfileSyncServiceTest {
EXPECT_CALL(*password_store_, RemoveLoginImpl(_)).Times(0);
}
- scoped_refptr<ThreadNotificationService> notification_service_;
content::NotificationObserverMock observer_;
ProfileMock profile_;
scoped_refptr<MockPasswordStore> password_store_;
diff --git a/chrome/browser/sync/profile_sync_service_typed_url_unittest.cc b/chrome/browser/sync/profile_sync_service_typed_url_unittest.cc
index 251dcd7..6db9cf2 100644
--- a/chrome/browser/sync/profile_sync_service_typed_url_unittest.cc
+++ b/chrome/browser/sync/profile_sync_service_typed_url_unittest.cc
@@ -164,17 +164,12 @@ class ProfileSyncServiceTypedUrlTest : public AbstractProfileSyncServiceTest {
.WillRepeatedly(RunTaskOnDBThread(&history_thread_,
history_backend_.get()));
history_thread_.Start();
-
- notification_service_ =
- new ThreadNotificationService(&history_thread_);
- notification_service_->Init();
}
virtual void TearDown() {
history_backend_ = NULL;
history_service_ = NULL;
service_.reset();
- notification_service_->TearDown();
history_thread_.Stop();
profile_.ResetRequestContext();
AbstractProfileSyncServiceTest::TearDown();
@@ -297,7 +292,6 @@ class ProfileSyncServiceTypedUrlTest : public AbstractProfileSyncServiceTest {
}
Thread history_thread_;
- scoped_refptr<ThreadNotificationService> notification_service_;
ProfileMock profile_;
scoped_refptr<HistoryBackendMock> history_backend_;
diff --git a/chrome/browser/sync/profile_sync_test_util.cc b/chrome/browser/sync/profile_sync_test_util.cc
index 2211aa1..951acd3 100644
--- a/chrome/browser/sync/profile_sync_test_util.cc
+++ b/chrome/browser/sync/profile_sync_test_util.cc
@@ -13,39 +13,6 @@ ProfileSyncServiceObserverMock::ProfileSyncServiceObserverMock() {}
ProfileSyncServiceObserverMock::~ProfileSyncServiceObserverMock() {}
-ThreadNotificationService::ThreadNotificationService(
- base::Thread* notification_thread)
- : done_event_(false, false),
- notification_thread_(notification_thread) {}
-
-void ThreadNotificationService::Init() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- notification_thread_->message_loop()->PostTask(
- FROM_HERE,
- base::Bind(&ThreadNotificationService::InitTask, this));
- done_event_.Wait();
-}
-
-void ThreadNotificationService::TearDown() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- notification_thread_->message_loop()->PostTask(
- FROM_HERE,
- base::Bind(&ThreadNotificationService::TearDownTask, this));
- done_event_.Wait();
-}
-
-ThreadNotificationService::~ThreadNotificationService() {}
-
-void ThreadNotificationService::InitTask() {
- service_.reset(content::NotificationService::Create());
- done_event_.Signal();
-}
-
-void ThreadNotificationService::TearDownTask() {
- service_.reset(NULL);
- done_event_.Signal();
-}
-
ThreadNotifier::ThreadNotifier(base::Thread* notify_thread)
: done_event_(false, false),
notify_thread_(notify_thread) {}
diff --git a/chrome/browser/sync/profile_sync_test_util.h b/chrome/browser/sync/profile_sync_test_util.h
index c99134e..de41505 100644
--- a/chrome/browser/sync/profile_sync_test_util.h
+++ b/chrome/browser/sync/profile_sync_test_util.h
@@ -43,26 +43,6 @@ class ProfileSyncServiceObserverMock : public ProfileSyncServiceObserver {
MOCK_METHOD0(OnStateChanged, void());
};
-class ThreadNotificationService
- : public base::RefCountedThreadSafe<ThreadNotificationService> {
- public:
- explicit ThreadNotificationService(base::Thread* notification_thread);
-
- void Init();
- void TearDown();
-
- private:
- friend class base::RefCountedThreadSafe<ThreadNotificationService>;
- virtual ~ThreadNotificationService();
-
- void InitTask();
- void TearDownTask();
-
- base::WaitableEvent done_event_;
- base::Thread* notification_thread_;
- scoped_ptr<content::NotificationService> service_;
-};
-
class ThreadNotifier : // NOLINT
public base::RefCountedThreadSafe<ThreadNotifier> {
public:
diff --git a/chrome/browser/ui/cocoa/cocoa_profile_test.h b/chrome/browser/ui/cocoa/cocoa_profile_test.h
index 968acc6..331cf21 100644
--- a/chrome/browser/ui/cocoa/cocoa_profile_test.h
+++ b/chrome/browser/ui/cocoa/cocoa_profile_test.h
@@ -65,6 +65,7 @@ class CocoaProfileTest : public CocoaTest {
TestingProfile* profile_; // Weak; owned by profile_manager_.
scoped_ptr<Browser> browser_;
+ scoped_ptr<content::TestBrowserThread> file_user_blocking_thread_;
scoped_ptr<content::TestBrowserThread> file_thread_;
scoped_ptr<content::TestBrowserThread> io_thread_;
};
diff --git a/chrome/browser/ui/cocoa/cocoa_profile_test.mm b/chrome/browser/ui/cocoa/cocoa_profile_test.mm
index a0f07e0..abdacb3 100644
--- a/chrome/browser/ui/cocoa/cocoa_profile_test.mm
+++ b/chrome/browser/ui/cocoa/cocoa_profile_test.mm
@@ -14,6 +14,8 @@ CocoaProfileTest::CocoaProfileTest()
: ui_thread_(BrowserThread::UI, &message_loop_),
profile_manager_(static_cast<TestingBrowserProcess*>(g_browser_process)),
profile_(NULL),
+ file_user_blocking_thread_(new content::TestBrowserThread(
+ BrowserThread::FILE_USER_BLOCKING, &message_loop_)),
file_thread_(new content::TestBrowserThread(BrowserThread::FILE,
&message_loop_)),
io_thread_(new content::TestBrowserThread(BrowserThread::IO,
@@ -38,6 +40,7 @@ CocoaProfileTest::~CocoaProfileTest() {
// Drop any new tasks for the IO and FILE threads.
io_thread_.reset();
file_thread_.reset();
+ file_user_blocking_thread_.reset();
message_loop_.RunAllPending();
}
diff --git a/chrome/browser/ui/cocoa/notifications/balloon_controller_unittest.mm b/chrome/browser/ui/cocoa/notifications/balloon_controller_unittest.mm
index 8f3edcf..cd9a421 100644
--- a/chrome/browser/ui/cocoa/notifications/balloon_controller_unittest.mm
+++ b/chrome/browser/ui/cocoa/notifications/balloon_controller_unittest.mm
@@ -52,6 +52,8 @@ class BalloonControllerTest : public ChromeRenderViewHostTestHarness {
public:
BalloonControllerTest() :
ui_thread_(BrowserThread::UI, MessageLoop::current()),
+ file_user_blocking_thread_(
+ BrowserThread::FILE_USER_BLOCKING, MessageLoop::current()),
io_thread_(BrowserThread::IO, MessageLoop::current()) {
}
@@ -72,6 +74,7 @@ class BalloonControllerTest : public ChromeRenderViewHostTestHarness {
protected:
content::TestBrowserThread ui_thread_;
+ content::TestBrowserThread file_user_blocking_thread_;
content::TestBrowserThread io_thread_;
scoped_ptr<Browser> browser_;
scoped_ptr<BalloonCollection> collection_;
diff --git a/chrome/browser/ui/views/select_file_dialog_extension_browsertest.cc b/chrome/browser/ui/views/select_file_dialog_extension_browsertest.cc
index 43f3d1b..41f1686 100644
--- a/chrome/browser/ui/views/select_file_dialog_extension_browsertest.cc
+++ b/chrome/browser/ui/views/select_file_dialog_extension_browsertest.cc
@@ -27,6 +27,8 @@
#include "webkit/fileapi/file_system_context.h"
#include "webkit/fileapi/file_system_mount_point_provider.h"
+using content::BrowserContext;
+
// Mock listener used by test below.
class MockSelectFileDialogListener : public SelectFileDialog::Listener {
public:
@@ -101,7 +103,8 @@ class SelectFileDialogExtensionBrowserTest : public ExtensionBrowserTest {
// Creates a file system mount point for a directory.
void AddMountPoint(const FilePath& path) {
fileapi::ExternalFileSystemMountPointProvider* provider =
- browser()->profile()->GetFileSystemContext()->external_provider();
+ BrowserContext::GetFileSystemContext(browser()->profile())->
+ external_provider();
provider->AddMountPoint(path);
}
diff --git a/chrome/browser/ui/webui/quota_internals_handler.cc b/chrome/browser/ui/webui/quota_internals_handler.cc
index b56e47a..877c25f 100644
--- a/chrome/browser/ui/webui/quota_internals_handler.cc
+++ b/chrome/browser/ui/webui/quota_internals_handler.cc
@@ -15,6 +15,8 @@
#include "content/public/browser/web_ui.h"
#include "net/base/net_util.h"
+using content::BrowserContext;
+
namespace quota_internals {
QuotaInternalsHandler::QuotaInternalsHandler() {}
@@ -84,7 +86,8 @@ void QuotaInternalsHandler::SendMessage(const std::string& message,
void QuotaInternalsHandler::OnRequestInfo(const base::ListValue*) {
if (!proxy_)
proxy_ = new QuotaInternalsProxy(this);
- proxy_->RequestInfo(Profile::FromWebUI(web_ui())->GetQuotaManager());
+ proxy_->RequestInfo(
+ content::BrowserContext::GetQuotaManager(Profile::FromWebUI(web_ui())));
}
} // namespace quota_internals