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

Unified Diff: chrome/browser/profiles/profile_impl_io_data.cc

Issue 11238034: Added completion notification to Profile's ClearNetworkingHistorySince. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Missing newline at EOF. Created 8 years, 2 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/profiles/profile_impl_io_data.cc
diff --git a/chrome/browser/profiles/profile_impl_io_data.cc b/chrome/browser/profiles/profile_impl_io_data.cc
index faba3535fa634f92fc430102620364147e664686..7922438e987ee29ed84da8260ea234e6f22c1487 100644
--- a/chrome/browser/profiles/profile_impl_io_data.cc
+++ b/chrome/browser/profiles/profile_impl_io_data.cc
@@ -141,6 +141,26 @@ void ProfileImplIOData::Handle::Init(
io_data_->InitializeMetricsEnabledStateOnUIThread();
}
+void ProfileImplIOData::Handle::InitForTesting() const {
+ using chrome_browser_net::HttpServerPropertiesManager;
+
+ initialized_ = true;
+
+ // Set up an HttpServerPropertiesManager for testing removing browsing data.
+ PrefService* pref_service = profile_->GetPrefs();
+ io_data_->set_http_server_properties_manager(
+ new HttpServerPropertiesManager(pref_service));
+
+ BrowserThread::PostTask(
+ BrowserThread::IO,
+ FROM_HERE,
+ base::Bind(
+ &HttpServerPropertiesManager::InitializeOnIOThread,
+ base::Unretained(io_data_->http_server_properties_manager())));
+
+ io_data_->InitForTesting();
+}
+
base::Callback<ChromeURLDataManagerBackend*(void)>
ProfileImplIOData::Handle::GetChromeURLDataManagerBackendGetter() const {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
@@ -258,7 +278,8 @@ ProfileImplIOData::Handle::GetIsolatedMediaRequestContextGetter(
}
void ProfileImplIOData::Handle::ClearNetworkingHistorySince(
- base::Time time) {
+ base::Time time,
+ const base::Closure& completion) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
LazyInitialize();
@@ -267,7 +288,8 @@ void ProfileImplIOData::Handle::ClearNetworkingHistorySince(
base::Bind(
&ProfileImplIOData::ClearNetworkingHistorySinceOnIOThread,
base::Unretained(io_data_),
- time));
+ time,
+ completion));
}
void ProfileImplIOData::Handle::LazyInitialize() const {
@@ -663,12 +685,13 @@ void ProfileImplIOData::SetUpJobFactory(
}
void ProfileImplIOData::ClearNetworkingHistorySinceOnIOThread(
- base::Time time) {
+ base::Time time,
+ const base::Closure& completion) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
LazyInitialize();
DCHECK(transport_security_state());
- transport_security_state()->DeleteSince(time);
+ transport_security_state()->DeleteSince(time); // Completes synchronously.
DCHECK(http_server_properties_manager());
- http_server_properties_manager()->Clear();
+ http_server_properties_manager()->Clear(completion);
}

Powered by Google App Engine
This is Rietveld 408576698