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

Unified Diff: chrome/browser/chromeos/settings/cros_settings.h

Issue 23494053: Remove NOTIFICATION_SYSTEM_SETTING_CHANGED, switch CrosSettings to base::CallbackRegistry. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: oops Created 7 years, 3 months 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/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_;

Powered by Google App Engine
This is Rietveld 408576698