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

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: trailing space 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..403a5a6e9cde2ac7e1e9d916a95d10334dfe01ac 100644
--- a/chrome/browser/chromeos/settings/cros_settings.h
+++ b/chrome/browser/chromeos/settings/cros_settings.h
@@ -9,12 +9,12 @@
#include <vector>
#include "base/callback_forward.h"
+#include "base/callback_registry.h"
#include "base/containers/hash_tables.h"
-#include "base/observer_list.h"
+#include "base/memory/scoped_ptr.h"
#include "base/threading/non_thread_safe.h"
#include "chrome/browser/chromeos/settings/cros_settings_names.h"
#include "chrome/browser/chromeos/settings/cros_settings_provider.h"
-#include "content/public/browser/notification_observer.h"
namespace base {
class DictionaryValue;
@@ -93,12 +93,11 @@ 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 std::string& path,
+ const base::Closure& callback);
// Returns the provider that handles settings with the |path| or prefix.
CrosSettingsProvider* GetProvider(const std::string& path) const;
@@ -106,7 +105,7 @@ class CrosSettings : public base::NonThreadSafe {
private:
friend class CrosSettingsTest;
- // Fires system setting change notification.
+ // Fires system setting change callback.
void FireObservers(const std::string& path);
// List of ChromeOS system settings providers.
@@ -114,9 +113,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_;
« no previous file with comments | « chrome/browser/chromeos/policy/device_status_collector.cc ('k') | chrome/browser/chromeos/settings/cros_settings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698