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

Unified Diff: chrome/browser/content_settings/content_settings_default_provider.cc

Issue 11345008: Remove content::NotificationObserver dependency from most Prefs code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix PrefNotifierImpl 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/content_settings/content_settings_default_provider.cc
diff --git a/chrome/browser/content_settings/content_settings_default_provider.cc b/chrome/browser/content_settings/content_settings_default_provider.cc
index 28fd5cd674dd194ade9c0dd0c284349e07a0630f..6a3e97fa252b2cdb65e5cdc343b98e906095970e 100644
--- a/chrome/browser/content_settings/content_settings_default_provider.cc
+++ b/chrome/browser/content_settings/content_settings_default_provider.cc
@@ -276,37 +276,31 @@ void DefaultProvider::ShutdownOnUIThread() {
prefs_ = NULL;
}
-void DefaultProvider::Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) {
+void DefaultProvider::OnPreferenceChanged(PrefServiceBase* service,
+ const std::string& name) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- if (type == chrome::NOTIFICATION_PREF_CHANGED) {
- DCHECK_EQ(prefs_, content::Source<PrefService>(source).ptr());
- if (updating_preferences_)
- return;
-
- std::string* name = content::Details<std::string>(details).ptr();
- if (*name == prefs::kDefaultContentSettings) {
- ReadDefaultSettings(true);
- } else if (*name == prefs::kGeolocationDefaultContentSetting) {
- MigrateObsoleteGeolocationPref();
- // Return and don't send a notifications. Migrating the obsolete
- // geolocation pref will change the prefs::kDefaultContentSettings and
- // cause the notification to be fired.
- return;
- } else {
- NOTREACHED() << "Unexpected preference observed";
- return;
- }
-
- NotifyObservers(ContentSettingsPattern(),
- ContentSettingsPattern(),
- CONTENT_SETTINGS_TYPE_DEFAULT,
- std::string());
+ DCHECK_EQ(prefs_, service);
+ if (updating_preferences_)
+ return;
+
+ if (name == prefs::kDefaultContentSettings) {
+ ReadDefaultSettings(true);
+ } else if (name == prefs::kGeolocationDefaultContentSetting) {
+ MigrateObsoleteGeolocationPref();
+ // Return and don't send a notifications. Migrating the obsolete
+ // geolocation pref will change the prefs::kDefaultContentSettings and
+ // cause the notification to be fired.
+ return;
} else {
- NOTREACHED() << "Unexpected notification";
+ NOTREACHED() << "Unexpected preference observed";
+ return;
}
+
+ NotifyObservers(ContentSettingsPattern(),
+ ContentSettingsPattern(),
+ CONTENT_SETTINGS_TYPE_DEFAULT,
+ std::string());
}
void DefaultProvider::ReadDefaultSettings(bool overwrite) {

Powered by Google App Engine
This is Rietveld 408576698