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

Unified Diff: chrome/browser/extensions/external_policy_loader.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/extensions/external_policy_loader.cc
diff --git a/chrome/browser/extensions/external_policy_loader.cc b/chrome/browser/extensions/external_policy_loader.cc
index a93fe0f6ff37ca9882e8b9672f9c019c1f7391b8..4364aad0e98ebd35f95e7ecef73f6fb933c782f0 100644
--- a/chrome/browser/extensions/external_policy_loader.cc
+++ b/chrome/browser/extensions/external_policy_loader.cc
@@ -79,28 +79,23 @@ void ExternalPolicyLoader::Observe(
const content::NotificationSource& source,
const content::NotificationDetails& details) {
if (profile_ == NULL) return;
- switch (type) {
- case chrome::NOTIFICATION_PREF_CHANGED: {
- if (content::Source<PrefService>(source).ptr() == profile_->GetPrefs()) {
- std::string* pref_name = content::Details<std::string>(details).ptr();
- if (*pref_name == prefs::kExtensionInstallForceList) {
- StartLoading();
- } else {
- NOTREACHED() << "Unexpected preference name.";
- }
- }
- break;
- }
- case chrome::NOTIFICATION_PROFILE_DESTROYED: {
- if (content::Source<Profile>(source).ptr() == profile_) {
- notification_registrar_.RemoveAll();
- pref_change_registrar_.RemoveAll();
- profile_ = NULL;
- }
- break;
+ DCHECK(type == chrome::NOTIFICATION_PROFILE_DESTROYED) <<
+ "Unexpected notification type.";
+ if (content::Source<Profile>(source).ptr() == profile_) {
+ notification_registrar_.RemoveAll();
+ pref_change_registrar_.RemoveAll();
+ profile_ = NULL;
+ }
+}
+
+void ExternalPolicyLoader::OnPreferenceChanged(PrefServiceBase* service,
+ const std::string& pref_name) {
+ if (service == profile_->GetPrefs()) {
+ if (pref_name == prefs::kExtensionInstallForceList) {
+ StartLoading();
+ } else {
+ NOTREACHED() << "Unexpected preference name.";
}
- default:
- NOTREACHED() << "Unexpected notification type.";
}
}

Powered by Google App Engine
This is Rietveld 408576698