OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_CROS_SETTINGS_H_ |
6 #define CHROME_BROWSER_CHROMEOS_CROS_SETTINGS_H_ | 6 #define CHROME_BROWSER_CHROMEOS_CROS_SETTINGS_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 void FireObservers(const char* path); | 43 void FireObservers(const char* path); |
44 | 44 |
45 // Gets settings value of given |path| to |out_value|. | 45 // Gets settings value of given |path| to |out_value|. |
46 // Note that the caller owns |out_value| returned. | 46 // Note that the caller owns |out_value| returned. |
47 bool Get(const std::string& path, Value** out_value) const; | 47 bool Get(const std::string& path, Value** out_value) const; |
48 | 48 |
49 // Convenience forms of Set(). These methods will replace any existing | 49 // Convenience forms of Set(). These methods will replace any existing |
50 // value at that path, even if it has a different type. | 50 // value at that path, even if it has a different type. |
51 void SetBoolean(const std::string& path, bool in_value); | 51 void SetBoolean(const std::string& path, bool in_value); |
52 void SetInteger(const std::string& path, int in_value); | 52 void SetInteger(const std::string& path, int in_value); |
53 void SetReal(const std::string& path, double in_value); | 53 void SetDouble(const std::string& path, double in_value); |
54 void SetString(const std::string& path, const std::string& in_value); | 54 void SetString(const std::string& path, const std::string& in_value); |
55 | 55 |
56 // These are convenience forms of Get(). The value will be retrieved | 56 // These are convenience forms of Get(). The value will be retrieved |
57 // and the return value will be true if the path is valid and the value at | 57 // and the return value will be true if the path is valid and the value at |
58 // the end of the path can be returned in the form specified. | 58 // the end of the path can be returned in the form specified. |
59 bool GetBoolean(const std::string& path, bool* out_value) const; | 59 bool GetBoolean(const std::string& path, bool* out_value) const; |
60 bool GetInteger(const std::string& path, int* out_value) const; | 60 bool GetInteger(const std::string& path, int* out_value) const; |
61 bool GetReal(const std::string& path, double* out_value) const; | 61 bool GetDouble(const std::string& path, double* out_value) const; |
62 bool GetString(const std::string& path, std::string* out_value) const; | 62 bool GetString(const std::string& path, std::string* out_value) const; |
63 | 63 |
64 // adding/removing of providers | 64 // adding/removing of providers |
65 bool AddSettingsProvider(CrosSettingsProvider* provider); | 65 bool AddSettingsProvider(CrosSettingsProvider* provider); |
66 bool RemoveSettingsProvider(CrosSettingsProvider* provider); | 66 bool RemoveSettingsProvider(CrosSettingsProvider* provider); |
67 | 67 |
68 // If the pref at the given path changes, we call the observer's Observe | 68 // If the pref at the given path changes, we call the observer's Observe |
69 // method with PREF_CHANGED. | 69 // method with PREF_CHANGED. |
70 void AddSettingsObserver(const char* path, NotificationObserver* obs); | 70 void AddSettingsObserver(const char* path, NotificationObserver* obs); |
71 void RemoveSettingsObserver(const char* path, NotificationObserver* obs); | 71 void RemoveSettingsObserver(const char* path, NotificationObserver* obs); |
(...skipping 13 matching lines...) Expand all Loading... |
85 ~CrosSettings(); | 85 ~CrosSettings(); |
86 CrosSettingsProvider* GetProvider(const std::string& path) const; | 86 CrosSettingsProvider* GetProvider(const std::string& path) const; |
87 friend struct base::DefaultLazyInstanceTraits<CrosSettings>; | 87 friend struct base::DefaultLazyInstanceTraits<CrosSettings>; |
88 | 88 |
89 DISALLOW_COPY_AND_ASSIGN(CrosSettings); | 89 DISALLOW_COPY_AND_ASSIGN(CrosSettings); |
90 }; | 90 }; |
91 | 91 |
92 } // namespace chromeos | 92 } // namespace chromeos |
93 | 93 |
94 #endif // CHROME_BROWSER_CHROMEOS_CROS_SETTINGS_H_ | 94 #endif // CHROME_BROWSER_CHROMEOS_CROS_SETTINGS_H_ |
OLD | NEW |