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

Unified Diff: chrome/browser/browsing_data_remover.cc

Issue 9419033: Move creation of BrowserContext objects that live in content to content, instead of depending on th… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/browsing_data_remover.cc
===================================================================
--- chrome/browser/browsing_data_remover.cc (revision 122416)
+++ chrome/browser/browsing_data_remover.cc (working copy)
@@ -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;
@@ -262,7 +263,8 @@
// 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_);
}
}
@@ -271,14 +273,13 @@
// 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) {
@@ -364,6 +365,11 @@
NotifyAndDeleteIfDone();
}
+void BrowsingDataRemover::OverrideQuotaManagerForTesting(
+ quota::QuotaManager* quota_manager) {
+ quota_manager_ = quota_manager;
+}
+
base::Time BrowsingDataRemover::CalculateBeginDeleteTime(
TimePeriod time_period) {
base::TimeDelta diff;
@@ -548,7 +554,7 @@
// 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)));
@@ -559,7 +565,7 @@
// 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)));

Powered by Google App Engine
This is Rietveld 408576698