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

Unified Diff: base/prefs/public/pref_change_registrar.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: base/prefs/public/pref_change_registrar.h
diff --git a/base/prefs/public/pref_change_registrar.h b/base/prefs/public/pref_change_registrar.h
index f3abd9869191056aedecb8a731f499c94414f521..8d9d8dd6b1d10e85b5bf963f9df56331a8e958d8 100644
--- a/base/prefs/public/pref_change_registrar.h
+++ b/base/prefs/public/pref_change_registrar.h
@@ -9,6 +9,7 @@
#include <string>
#include "base/basictypes.h"
+#include "base/callback.h"
#include "base/prefs/base_prefs_export.h"
class PrefObserver;
@@ -32,10 +33,14 @@ class BASE_PREFS_EXPORT PrefChangeRegistrar {
// when the registrar's destructor is called unless the observer has been
// explicitly removed by a call to Remove beforehand.
void Add(const char* path, PrefObserver* obs);
+ void Add(const char* path, const base::Closure& obs);
- // Removes a preference observer that has previously been added with a call to
- // Add.
+ // Removes a preference observer that has previously been added with
+ // a call to Add. Note that in the base::Callback version of this
+ // method, you must pass an object whose Equal() method returns true
+ // when compared to the callback you registered via Add().
void Remove(const char* path, PrefObserver* obs);
+ void Remove(const char* path, const base::Closure& obs);
// Removes all observers that have been previously added with a call to Add.
void RemoveAll();
@@ -50,7 +55,7 @@ class BASE_PREFS_EXPORT PrefChangeRegistrar {
bool IsManaged();
private:
- typedef std::pair<std::string, PrefObserver*> ObserverRegistration;
+ typedef std::pair<std::string, base::Closure> ObserverRegistration;
std::set<ObserverRegistration> observers_;
PrefServiceBase* service_;
« no previous file with comments | « no previous file | base/prefs/public/pref_change_registrar.cc » ('j') | base/prefs/public/pref_change_registrar.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698