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

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: 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
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 5a3cbf9c54c943ebdc7cb92061b1de6d5664aead..79ddb8dbe8bc7cc192575fadac0fd23fd05ae7e2 100644
--- a/chrome/browser/extensions/external_policy_loader.cc
+++ b/chrome/browser/extensions/external_policy_loader.cc
@@ -79,25 +79,20 @@ 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()) {
- DCHECK_EQ(std::string(prefs::kExtensionInstallForceList),
- *content::Details<std::string>(details).ptr());
- StartLoading();
- }
- break;
- }
- case chrome::NOTIFICATION_PROFILE_DESTROYED: {
- if (content::Source<Profile>(source).ptr() == profile_) {
- notification_registrar_.RemoveAll();
- pref_change_registrar_.RemoveAll();
- profile_ = NULL;
- }
- break;
- }
- default:
- NOTREACHED() << "Unexpected notification type.";
+ 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()) {
+ DCHECK_EQ(std::string(prefs::kExtensionInstallForceList), pref_name);
+ StartLoading();
}
}
« no previous file with comments | « chrome/browser/extensions/external_policy_loader.h ('k') | chrome/browser/media_gallery/media_file_system_registry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698