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

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: Fix memory leaks in tests 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
« no previous file with comments | « chrome/browser/browsing_data_remover.h ('k') | chrome/browser/browsing_data_remover_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/browsing_data_remover.cc
===================================================================
--- chrome/browser/browsing_data_remover.cc (revision 122721)
+++ 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;
@@ -283,20 +284,20 @@
// 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_);
}
}
if (remove_mask & REMOVE_INDEXEDDB || remove_mask & REMOVE_WEBSQL ||
remove_mask & REMOVE_APPCACHE || remove_mask & REMOVE_FILE_SYSTEMS) {
- 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) {
@@ -382,6 +383,11 @@
NotifyAndDeleteIfDone();
}
+void BrowsingDataRemover::OverrideQuotaManagerForTesting(
+ quota::QuotaManager* quota_manager) {
+ quota_manager_ = quota_manager;
+}
+
base::Time BrowsingDataRemover::CalculateBeginDeleteTime(
TimePeriod time_period) {
base::TimeDelta diff;
@@ -566,7 +572,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)));
@@ -577,7 +583,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)));
« no previous file with comments | « chrome/browser/browsing_data_remover.h ('k') | chrome/browser/browsing_data_remover_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698