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

Side by Side Diff: chrome/browser/protector/base_prefs_change.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/prefs/pref_service.h" 5 #include "chrome/browser/prefs/pref_service.h"
6 #include "chrome/browser/profiles/profile.h" 6 #include "chrome/browser/profiles/profile.h"
7 #include "chrome/browser/protector/base_prefs_change.h" 7 #include "chrome/browser/protector/base_prefs_change.h"
8 #include "chrome/browser/protector/protected_prefs_watcher.h" 8 #include "chrome/browser/protector/protected_prefs_watcher.h"
9 #include "chrome/browser/protector/protector_service.h" 9 #include "chrome/browser/protector/protector_service.h"
10 #include "chrome/browser/protector/protector_service_factory.h" 10 #include "chrome/browser/protector/protector_service_factory.h"
(...skipping 25 matching lines...) Expand all
36 36
37 void BasePrefsChange::DismissOnPrefChange(const std::string& pref_name) { 37 void BasePrefsChange::DismissOnPrefChange(const std::string& pref_name) {
38 DCHECK(!pref_observer_.IsObserved(pref_name)); 38 DCHECK(!pref_observer_.IsObserved(pref_name));
39 pref_observer_.Add(pref_name.c_str(), this); 39 pref_observer_.Add(pref_name.c_str(), this);
40 } 40 }
41 41
42 void BasePrefsChange::IgnorePrefChanges() { 42 void BasePrefsChange::IgnorePrefChanges() {
43 pref_observer_.RemoveAll(); 43 pref_observer_.RemoveAll();
44 } 44 }
45 45
46 void BasePrefsChange::Observe(int type, 46 void BasePrefsChange::OnPreferenceChanged(PrefServiceBase* service,
47 const content::NotificationSource& source, 47 const std::string& pref_name) {
48 const content::NotificationDetails& details) { 48 DCHECK(pref_observer_.IsObserved(pref_name));
49 DCHECK(type == chrome::NOTIFICATION_PREF_CHANGED);
50 const std::string* pref_name = content::Details<std::string>(details).ptr();
51 DCHECK(pref_name && pref_observer_.IsObserved(*pref_name));
52 // Will delete this instance. 49 // Will delete this instance.
53 ProtectorServiceFactory::GetForProfile(profile())->DismissChange(this); 50 ProtectorServiceFactory::GetForProfile(profile())->DismissChange(this);
54 } 51 }
55 52
56 } // namespace protector 53 } // namespace protector
OLDNEW
« no previous file with comments | « chrome/browser/protector/base_prefs_change.h ('k') | chrome/browser/protector/protected_prefs_watcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698