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

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

Issue 11307020: Cleanup: Simplify some extensions / content_settings Observer code by simply DCHECKING instead of u… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: 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
===================================================================
--- chrome/browser/content_settings/content_settings_default_provider.cc (revision 164413)
+++ chrome/browser/content_settings/content_settings_default_provider.cc (working copy)
@@ -280,33 +280,30 @@
const content::NotificationSource& source,
const content::NotificationDetails& details) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_EQ(type, chrome::NOTIFICATION_PREF_CHANGED);
+ DCHECK_EQ(prefs_, content::Source<PrefService>(source).ptr());
- if (type == chrome::NOTIFICATION_PREF_CHANGED) {
- DCHECK_EQ(prefs_, content::Source<PrefService>(source).ptr());
- if (updating_preferences_)
- return;
+ 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());
+ const 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 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