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

Unified Diff: chrome/browser/ui/webui/settings/settings_clear_browsing_data_handler.cc

Issue 2536003003: MD Settings: Fix WebUI lifecycle issues in Clear Browsing Data handler. (Closed)
Patch Set: address dbeam comments Created 4 years 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/settings/settings_clear_browsing_data_handler.cc
diff --git a/chrome/browser/ui/webui/settings/settings_clear_browsing_data_handler.cc b/chrome/browser/ui/webui/settings/settings_clear_browsing_data_handler.cc
index b5a014ce17b338385c5a9383c5050c41938b2194..b03fb3741eccc243c8f510eadc88854673cd8b27 100644
--- a/chrome/browser/ui/webui/settings/settings_clear_browsing_data_handler.cc
+++ b/chrome/browser/ui/webui/settings/settings_clear_browsing_data_handler.cc
@@ -109,12 +109,19 @@ void ClearBrowsingDataHandler::OnJavascriptAllowed() {
if (sync_service_)
sync_service_observer_.Add(sync_service_);
+
+ DCHECK(counters_.empty());
+ for (const std::string& pref : kCounterPrefs) {
+ AddCounter(
+ BrowsingDataCounterFactory::GetForProfileAndPref(profile_, pref));
+ }
}
void ClearBrowsingDataHandler::OnJavascriptDisallowed() {
profile_pref_registrar_.RemoveAll();
sync_service_observer_.RemoveAll();
task_observer_.reset();
+ counters_.clear();
}
void ClearBrowsingDataHandler::HandleClearBrowsingData(
@@ -259,13 +266,8 @@ void ClearBrowsingDataHandler::HandleInitialize(const base::ListValue* args) {
const base::Value* callback_id;
CHECK(args->Get(0, &callback_id));
+ // Needed because WebUI doesn't handle renderer crashes. See crbug.com/610450.
task_observer_.reset();
- counters_.clear();
-
- for (const std::string& pref : kCounterPrefs) {
- AddCounter(
- BrowsingDataCounterFactory::GetForProfileAndPref(profile_, pref));
- }
OnStateChanged();
RefreshHistoryNotice();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698