Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROMEOS_SETTINGS_CROS_SETTINGS_PROVIDER_H_ | 5 #ifndef CHROMEOS_SETTINGS_CROS_SETTINGS_PROVIDER_H_ |
| 6 #define CHROMEOS_SETTINGS_CROS_SETTINGS_PROVIDER_H_ | 6 #define CHROMEOS_SETTINGS_CROS_SETTINGS_PROVIDER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 37 }; | 37 }; |
| 38 | 38 |
| 39 // Creates a new provider instance. |notify_cb| will be used to notify | 39 // Creates a new provider instance. |notify_cb| will be used to notify |
| 40 // about setting changes. | 40 // about setting changes. |
| 41 explicit CrosSettingsProvider(const NotifyObserversCallback& notify_cb); | 41 explicit CrosSettingsProvider(const NotifyObserversCallback& notify_cb); |
| 42 virtual ~CrosSettingsProvider(); | 42 virtual ~CrosSettingsProvider(); |
| 43 | 43 |
| 44 // Sets |in_value| to given |path| in cros settings. | 44 // Sets |in_value| to given |path| in cros settings. |
| 45 void Set(const std::string& path, const base::Value& in_value); | 45 void Set(const std::string& path, const base::Value& in_value); |
| 46 | 46 |
| 47 // Convenience forms of Set(). These methods will replace any existing | |
|
Mattias Nissler (ping if slow)
2015/03/30 14:45:46
These should be defined in StubSettingsProvider -
| |
| 48 // value at that |path|, even if it has a different type. | |
| 49 void SetBoolean(const std::string& path, bool in_value); | |
| 50 void SetInteger(const std::string& path, int in_value); | |
| 51 void SetDouble(const std::string& path, double in_value); | |
| 52 void SetString(const std::string& path, const std::string& in_value); | |
| 53 | |
| 47 // Gets settings value of given |path| to |out_value|. | 54 // Gets settings value of given |path| to |out_value|. |
| 48 virtual const base::Value* Get(const std::string& path) const = 0; | 55 virtual const base::Value* Get(const std::string& path) const = 0; |
| 49 | 56 |
| 50 // Requests the provider to fetch its values from a trusted store, if it | 57 // Requests the provider to fetch its values from a trusted store, if it |
| 51 // hasn't done so yet. Returns TRUSTED if the values returned by this provider | 58 // hasn't done so yet. Returns TRUSTED if the values returned by this provider |
| 52 // are trusted during the current loop cycle. Otherwise returns | 59 // are trusted during the current loop cycle. Otherwise returns |
| 53 // TEMPORARILY_UNTRUSTED, and |callback| will be invoked later when trusted | 60 // TEMPORARILY_UNTRUSTED, and |callback| will be invoked later when trusted |
| 54 // values become available, PrepareTrustedValues() should be tried again in | 61 // values become available, PrepareTrustedValues() should be tried again in |
| 55 // that case. Returns PERMANENTLY_UNTRUSTED if a permanent error has occurred. | 62 // that case. Returns PERMANENTLY_UNTRUSTED if a permanent error has occurred. |
| 56 virtual TrustedStatus PrepareTrustedValues( | 63 virtual TrustedStatus PrepareTrustedValues( |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 70 virtual void DoSet(const std::string& path, | 77 virtual void DoSet(const std::string& path, |
| 71 const base::Value& in_value) = 0; | 78 const base::Value& in_value) = 0; |
| 72 | 79 |
| 73 // Callback used to notify about setting changes. | 80 // Callback used to notify about setting changes. |
| 74 NotifyObserversCallback notify_cb_; | 81 NotifyObserversCallback notify_cb_; |
| 75 }; | 82 }; |
| 76 | 83 |
| 77 } // namespace chromeos | 84 } // namespace chromeos |
| 78 | 85 |
| 79 #endif // CHROMEOS_SETTINGS_CROS_SETTINGS_PROVIDER_H_ | 86 #endif // CHROMEOS_SETTINGS_CROS_SETTINGS_PROVIDER_H_ |
| OLD | NEW |