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

Unified Diff: chrome/browser/chromeos/cros_settings_provider.h

Issue 8899002: [cros] Add --stub-cros-settings option for testing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: CrosSettingsProvider instances use a callback for notifying observers. Created 9 years 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/cros_settings_provider.h
diff --git a/chrome/browser/chromeos/cros_settings_provider.h b/chrome/browser/chromeos/cros_settings_provider.h
index ba65253a3f30a71a55feee707566379c61db4634..fac72c636c53c3ff0ba46718ac758915865b40ef 100644
--- a/chrome/browser/chromeos/cros_settings_provider.h
+++ b/chrome/browser/chromeos/cros_settings_provider.h
@@ -17,6 +17,13 @@ namespace chromeos {
class CrosSettingsProvider {
public:
+ // The callback type that is called to notify the CrosSettings observers
+ // about a setting change.
+ typedef base::Callback<void(const std::string&)> NotifyObserversCallback;
+
+ // Creates a new provider instance. |notify_cb| will be used to notify
+ // about setting changes.
+ explicit CrosSettingsProvider(const NotifyObserversCallback& notify_cb);
virtual ~CrosSettingsProvider() {}
// Sets |in_value| to given |path| in cros settings.
@@ -38,10 +45,17 @@ class CrosSettingsProvider {
// Reloads the caches if the provider has any.
virtual void Reload() = 0;
+ protected:
+ // Notifies the observers about a setting change.
+ void NotifyObservers(const std::string& path);
+
private:
// Does the real job for Set().
virtual void DoSet(const std::string& path,
const base::Value& in_value) = 0;
+
+ // Callback used to notify about setting changes.
+ NotifyObserversCallback notify_cb_;
};
} // namespace chromeos

Powered by Google App Engine
This is Rietveld 408576698