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

Unified Diff: chrome/browser/prefs/pref_notifier_impl.h

Issue 11368098: Draft change to use base::Closure instead of PrefObserver in PrefChangeRegistrar. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . 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/prefs/pref_notifier_impl.h
diff --git a/chrome/browser/prefs/pref_notifier_impl.h b/chrome/browser/prefs/pref_notifier_impl.h
index 34c225f96048f16cd59d610a4e0807bd580aef39..e7d2154489c45fe0ea0e8a68a53c77c040326b99 100644
--- a/chrome/browser/prefs/pref_notifier_impl.h
+++ b/chrome/browser/prefs/pref_notifier_impl.h
@@ -12,7 +12,6 @@
#include "base/hash_tables.h"
#include "base/observer_list.h"
#include "base/prefs/pref_notifier.h"
-#include "base/prefs/public/pref_observer.h"
#include "base/threading/non_thread_safe.h"
class PrefService;
@@ -27,8 +26,13 @@ class PrefNotifierImpl : public PrefNotifier,
// If the pref at the given path changes, we call the observer's
// OnPreferenceChanged method.
- void AddPrefObserver(const char* path, PrefObserver* observer);
- void RemovePrefObserver(const char* path, PrefObserver* observer);
+ void AddPrefObserver(const char* path, const base::Closure& observer);
+
+ // This removes an observer. Note that when using the Closure
+ // version of the method, you must provide a closure whose Equal()
+ // method will evaluate to true when compared to the closure you
+ // registered using AddPrefObserver.
+ void RemovePrefObserver(const char* path, const base::Closure& observer);
// We run the callback once, when initialization completes. The bool
// parameter will be set to true for successful initialization,
@@ -45,7 +49,7 @@ class PrefNotifierImpl : public PrefNotifier,
// A map from pref names to a list of observers. Observers get fired in the
// order they are added. These should only be accessed externally for unit
// testing.
- typedef ObserverList<PrefObserver> PrefObserverList;
+ typedef std::list<base::Closure> PrefObserverList;
typedef base::hash_map<std::string, PrefObserverList*> PrefObserverMap;
typedef std::list<base::Callback<void(bool)> > PrefInitObserverList;

Powered by Google App Engine
This is Rietveld 408576698