OLD | NEW |
1 // Copyright (c) 2010 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 class Value; | 10 class Value; |
11 | 11 |
12 namespace chromeos { | 12 namespace chromeos { |
13 | 13 |
14 class CrosSettingsProvider { | 14 class CrosSettingsProvider { |
15 public: | 15 public: |
16 virtual ~CrosSettingsProvider() {} | 16 virtual ~CrosSettingsProvider() {} |
17 | 17 |
18 // Sets |in_value| to given |path| in cros settings. | 18 // Sets |in_value| to given |path| in cros settings. |
19 // Note that this takes ownership of |in_value|. | 19 // Note that this takes ownership of |in_value|. |
20 void Set(const std::string& path, Value* in_value); | 20 void Set(const std::string& path, Value* in_value); |
21 | 21 |
22 // Gets settings value of given |path| to |out_value|. | 22 // Gets settings value of given |path| to |out_value|. |
23 // Note that |out_value| is still owned by this class. | 23 // Note that |out_value| is owned by the caller, not this class. |
24 virtual bool Get(const std::string& path, Value** out_value) const = 0; | 24 virtual bool Get(const std::string& path, Value** out_value) const = 0; |
25 | 25 |
26 // Gets the namespace prefix provided by this provider | 26 // Gets the namespace prefix provided by this provider |
27 virtual bool HandlesSetting(const std::string& path) = 0; | 27 virtual bool HandlesSetting(const std::string& path) = 0; |
28 | 28 |
29 private: | 29 private: |
30 // Does the real job for Set(). | 30 // Does the real job for Set(). |
31 virtual void DoSet(const std::string& path, Value* in_value) = 0; | 31 virtual void DoSet(const std::string& path, Value* in_value) = 0; |
32 }; | 32 }; |
33 | 33 |
34 } // namespace chromeos | 34 } // namespace chromeos |
35 | 35 |
36 #endif // CHROME_BROWSER_CHROMEOS_CROS_SETTINGS_PROVIDER_H_ | 36 #endif // CHROME_BROWSER_CHROMEOS_CROS_SETTINGS_PROVIDER_H_ |
OLD | NEW |