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

Unified Diff: chrome/browser/sync/glue/typed_url_data_type_controller.cc

Issue 11345008: Remove content::NotificationObserver dependency from most Prefs code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head for commit Created 8 years, 1 month 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/sync/glue/typed_url_data_type_controller.h ('k') | chrome/browser/sync/sync_prefs.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/glue/typed_url_data_type_controller.cc
diff --git a/chrome/browser/sync/glue/typed_url_data_type_controller.cc b/chrome/browser/sync/glue/typed_url_data_type_controller.cc
index 88a9d238d6b557a82cd22982a1e558d5d01a705d..0e9713fd842f0c7d62b97f9d2f96a97efd5219fc 100644
--- a/chrome/browser/sync/glue/typed_url_data_type_controller.cc
+++ b/chrome/browser/sync/glue/typed_url_data_type_controller.cc
@@ -87,29 +87,22 @@ void TypedUrlDataTypeController::SetBackend(history::HistoryBackend* backend) {
backend_ = backend;
}
-void TypedUrlDataTypeController::Observe(
- int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) {
+void TypedUrlDataTypeController::OnPreferenceChanged(
+ PrefServiceBase* service,
+ const std::string& pref_name) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- switch (type) {
- case chrome::NOTIFICATION_PREF_CHANGED:
- DCHECK(*content::Details<std::string>(details).ptr() ==
- prefs::kSavingBrowserHistoryDisabled);
- if (profile()->GetPrefs()->GetBoolean(
- prefs::kSavingBrowserHistoryDisabled)) {
- // We've turned off history persistence, so if we are running,
- // generate an unrecoverable error. This can be fixed by restarting
- // Chrome (on restart, typed urls will not be a registered type).
- if (state() != NOT_RUNNING && state() != STOPPING) {
- profile_sync_service()->DisableBrokenDatatype(syncer::TYPED_URLS,
- FROM_HERE, "History saving is now disabled by policy.");
- }
- }
- break;
- default:
- NOTREACHED();
- break;
+ DCHECK_EQ(std::string(prefs::kSavingBrowserHistoryDisabled), pref_name);
+ if (profile()->GetPrefs()->GetBoolean(
+ prefs::kSavingBrowserHistoryDisabled)) {
+ // We've turned off history persistence, so if we are running,
+ // generate an unrecoverable error. This can be fixed by restarting
+ // Chrome (on restart, typed urls will not be a registered type).
+ if (state() != NOT_RUNNING && state() != STOPPING) {
+ profile_sync_service()->DisableBrokenDatatype(
+ syncer::TYPED_URLS,
+ FROM_HERE,
+ "History saving is now disabled by policy.");
+ }
}
}
@@ -147,7 +140,6 @@ void TypedUrlDataTypeController::StopModels() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(state() == STOPPING || state() == NOT_RUNNING || state() == DISABLED);
DVLOG(1) << "TypedUrlDataTypeController::StopModels(): State = " << state();
- notification_registrar_.RemoveAll();
}
TypedUrlDataTypeController::~TypedUrlDataTypeController() {}
« no previous file with comments | « chrome/browser/sync/glue/typed_url_data_type_controller.h ('k') | chrome/browser/sync/sync_prefs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698