Chromium Code Reviews| Index: chrome/browser/chromeos/settings/cros_settings.h |
| diff --git a/chrome/browser/chromeos/settings/cros_settings.h b/chrome/browser/chromeos/settings/cros_settings.h |
| index e14b2be11752d3474407bf502d6a7e773ea20976..e8aa0f741740812c537415ef3a7a9bd2dd87927e 100644 |
| --- a/chrome/browser/chromeos/settings/cros_settings.h |
| +++ b/chrome/browser/chromeos/settings/cros_settings.h |
| @@ -9,7 +9,9 @@ |
| #include <vector> |
| #include "base/callback_forward.h" |
| +#include "base/callback_registry.h" |
| #include "base/containers/hash_tables.h" |
| +#include "base/memory/scoped_ptr.h" |
| #include "base/observer_list.h" |
|
Mattias Nissler (ping if slow)
2013/09/18 09:09:48
remove
|
| #include "base/threading/non_thread_safe.h" |
| #include "chrome/browser/chromeos/settings/cros_settings_names.h" |
| @@ -93,12 +95,10 @@ class CrosSettings : public base::NonThreadSafe { |
| bool AddSettingsProvider(CrosSettingsProvider* provider); |
| bool RemoveSettingsProvider(CrosSettingsProvider* provider); |
| - // If the pref at the given |path| changes, we call the observer's Observe |
| - // method with NOTIFICATION_SYSTEM_SETTING_CHANGED. |
| - void AddSettingsObserver(const char* path, |
| - content::NotificationObserver* obs); |
| - void RemoveSettingsObserver(const char* path, |
| - content::NotificationObserver* obs); |
| + // Add an observer Callback for changes for the given |path|. |
| + typedef base::CallbackRegistry<void>::Subscription ObserverSubscription; |
| + scoped_ptr<ObserverSubscription> AddSettingsObserver( |
| + const char* path, const base::Closure& callback); |
|
Mattias Nissler (ping if slow)
2013/09/18 09:09:48
nit: parameters on separate lines
Avi (use Gerrit)
2013/09/18 16:41:44
Done.
|
| // Returns the provider that handles settings with the |path| or prefix. |
| CrosSettingsProvider* GetProvider(const std::string& path) const; |
| @@ -114,9 +114,7 @@ class CrosSettings : public base::NonThreadSafe { |
| // A map from settings names to a list of observers. Observers get fired in |
| // the order they are added. |
| - typedef ObserverList<content::NotificationObserver, true> |
| - NotificationObserverList; |
| - typedef base::hash_map<std::string, NotificationObserverList*> |
| + typedef base::hash_map<std::string, base::CallbackRegistry<void>*> |
| SettingsObserverMap; |
| SettingsObserverMap settings_observers_; |