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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/external_policy_loader.h" 5 #include "chrome/browser/extensions/external_policy_loader.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/browser/prefs/pref_service.h" 9 #include "chrome/browser/prefs/pref_service.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 } 72 }
73 prefs_.reset(result); 73 prefs_.reset(result);
74 LoadFinished(); 74 LoadFinished();
75 } 75 }
76 76
77 void ExternalPolicyLoader::Observe( 77 void ExternalPolicyLoader::Observe(
78 int type, 78 int type,
79 const content::NotificationSource& source, 79 const content::NotificationSource& source,
80 const content::NotificationDetails& details) { 80 const content::NotificationDetails& details) {
81 if (profile_ == NULL) return; 81 if (profile_ == NULL) return;
82 switch (type) { 82 DCHECK(type == chrome::NOTIFICATION_PROFILE_DESTROYED) <<
83 case chrome::NOTIFICATION_PREF_CHANGED: { 83 "Unexpected notification type.";
84 if (content::Source<PrefService>(source).ptr() == profile_->GetPrefs()) { 84 if (content::Source<Profile>(source).ptr() == profile_) {
85 DCHECK_EQ(std::string(prefs::kExtensionInstallForceList), 85 notification_registrar_.RemoveAll();
86 *content::Details<std::string>(details).ptr()); 86 pref_change_registrar_.RemoveAll();
87 StartLoading(); 87 profile_ = NULL;
88 }
89 break;
90 }
91 case chrome::NOTIFICATION_PROFILE_DESTROYED: {
92 if (content::Source<Profile>(source).ptr() == profile_) {
93 notification_registrar_.RemoveAll();
94 pref_change_registrar_.RemoveAll();
95 profile_ = NULL;
96 }
97 break;
98 }
99 default:
100 NOTREACHED() << "Unexpected notification type.";
101 } 88 }
102 } 89 }
103 90
91 void ExternalPolicyLoader::OnPreferenceChanged(PrefServiceBase* service,
92 const std::string& pref_name) {
93 if (service == profile_->GetPrefs()) {
94 DCHECK_EQ(std::string(prefs::kExtensionInstallForceList), pref_name);
95 StartLoading();
96 }
97 }
98
104 } // namespace extensions 99 } // namespace extensions
OLDNEW
« 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