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

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: Flip DCHECK_EQ arguments to (expected, actual) 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
« no previous file with comments | « no previous file | chrome/browser/content_settings/content_settings_policy_provider.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/content_settings/content_settings_default_provider.cc
===================================================================
--- chrome/browser/content_settings/content_settings_default_provider.cc (revision 165014)
+++ 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(chrome::NOTIFICATION_PREF_CHANGED, type);
+ DCHECK_EQ(content::Source<PrefService>(source).ptr(), prefs_);
- 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) {
« no previous file with comments | « no previous file | chrome/browser/content_settings/content_settings_policy_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698