OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_CHROMEOS_CROS_SETTINGS_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_CROS_SETTINGS_PROVIDER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_CROS_SETTINGS_PROVIDER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_CROS_SETTINGS_PROVIDER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 | 11 |
12 namespace base { | 12 namespace base { |
13 class Value; | 13 class Value; |
14 } | 14 } |
15 | 15 |
16 namespace chromeos { | 16 namespace chromeos { |
17 | 17 |
18 class CrosSettingsProvider { | 18 class CrosSettingsProvider { |
19 public: | 19 public: |
20 virtual ~CrosSettingsProvider() {} | 20 virtual ~CrosSettingsProvider() {} |
21 | 21 |
22 // Sets |in_value| to given |path| in cros settings. | 22 // Sets |in_value| to given |path| in cros settings. |
23 void Set(const std::string& path, const base::Value& in_value); | 23 void Set(const std::string& path, const base::Value& in_value); |
24 | 24 |
25 // Gets settings value of given |path| to |out_value|. | 25 // Gets settings value of given |path| to |out_value|. |
26 virtual const base::Value* Get(const std::string& path) const = 0; | 26 virtual base::Value* Get(const std::string& path) const = 0; |
Mattias Nissler (ping if slow)
2011/11/30 11:22:44
Why is this no longer const? I hope it doesn't ret
pastarmovj
2011/11/30 17:21:16
Const again.
| |
27 | 27 |
28 // Starts a fetch from the trusted store for the value of |path| if not loaded | 28 // Starts a fetch from the trusted store for the value of |path| if not loaded |
29 // yet. It will call the |callback| function upon completion if a new fetch | 29 // yet. It will call the |callback| function upon completion if a new fetch |
30 // was needed in which case the return value is false. Else it will return | 30 // was needed in which case the return value is false. Else it will return |
31 // true and won't call the |callback|. | 31 // true and won't call the |callback|. |
32 virtual bool GetTrusted(const std::string& path, | 32 virtual bool GetTrusted(const std::string& path, |
33 const base::Closure& callback) const = 0; | 33 const base::Closure& callback) = 0; |
34 | 34 |
35 // Gets the namespace prefix provided by this provider | 35 // Gets the namespace prefix provided by this provider. |
36 virtual bool HandlesSetting(const std::string& path) const = 0; | 36 virtual bool HandlesSetting(const std::string& path) const = 0; |
37 | 37 |
38 // Reloads the caches if the provider has any. | |
39 virtual void Reload() = 0; | |
40 | |
38 private: | 41 private: |
39 // Does the real job for Set(). | 42 // Does the real job for Set(). |
40 virtual void DoSet(const std::string& path, | 43 virtual void DoSet(const std::string& path, |
41 const base::Value& in_value) = 0; | 44 const base::Value& in_value) = 0; |
42 }; | 45 }; |
43 | 46 |
44 } // namespace chromeos | 47 } // namespace chromeos |
45 | 48 |
46 #endif // CHROME_BROWSER_CHROMEOS_CROS_SETTINGS_PROVIDER_H_ | 49 #endif // CHROME_BROWSER_CHROMEOS_CROS_SETTINGS_PROVIDER_H_ |
OLD | NEW |