Index: base/prefs/public/pref_change_registrar.cc |
diff --git a/base/prefs/public/pref_change_registrar.cc b/base/prefs/public/pref_change_registrar.cc |
index 3f94b044d8633e0a007bfe196287b9eb3b0b1a1f..1bd3d1aa2f17fc5ff9ffe705fc527751dbb79071 100644 |
--- a/base/prefs/public/pref_change_registrar.cc |
+++ b/base/prefs/public/pref_change_registrar.cc |
@@ -4,7 +4,9 @@ |
#include "base/prefs/public/pref_change_registrar.h" |
+#include "base/bind.h" |
#include "base/logging.h" |
+#include "base/prefs/public/pref_observer.h" |
#include "base/prefs/public/pref_service_base.h" |
PrefChangeRegistrar::PrefChangeRegistrar() : service_(NULL) {} |
@@ -23,6 +25,11 @@ void PrefChangeRegistrar::Init(PrefServiceBase* service) { |
} |
void PrefChangeRegistrar::Add(const char* path, PrefObserver* obs) { |
+ return Add(path, base::Bind(&PrefObserver::OnPreferenceChanged, |
+ base::Unretained(obs), service_, path)); |
+} |
+ |
+void PrefChangeRegistrar::Add(const char* path, const base::Closure& obs) { |
if (!service_) { |
NOTREACHED(); |
return; |
@@ -37,6 +44,14 @@ void PrefChangeRegistrar::Add(const char* path, PrefObserver* obs) { |
} |
void PrefChangeRegistrar::Remove(const char* path, PrefObserver* obs) { |
+ // Need to bind the callback the exact same way, although it will |
+ // never be called, so that it matches the callback bound via |
+ // AddPrefObserver. |
+ return Remove(path, base::Bind(&PrefObserver::OnPreferenceChanged, |
+ base::Unretained(obs), service_, path)); |
Mattias Nissler (ping if slow)
2012/11/06 13:26:48
Hm, comparing callbacks... not sure whether that's
|
+} |
+ |
+void PrefChangeRegistrar::Remove(const char* path, const base::Closure& obs) { |
if (!service_) { |
NOTREACHED(); |
return; |