| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_CROS_SETTINGS_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_CROS_SETTINGS_H_ |
| 7 |
| 8 #include <string> |
| 9 #include "base/values.h" |
| 10 |
| 11 #include "chrome/browser/chromeos/cros_settings_names.h" |
| 12 |
| 13 namespace chromeos { |
| 14 |
| 15 // A class manages per-device/global settings. |
| 16 class CrosSettings { |
| 17 public: |
| 18 // Class factory. |
| 19 static CrosSettings* Get(); |
| 20 |
| 21 // Helper function to test if given path is a value cros settings name. |
| 22 static bool IsCrosSettings(const std::wstring& path); |
| 23 |
| 24 // Sets |in_value| to given |path| in cros settings. |
| 25 // Note that this takes ownership of |in_value|. |
| 26 virtual void Set(const std::wstring& path, Value* in_value) = 0; |
| 27 |
| 28 // Gets settings value of given |path| to |out_value|. |
| 29 // Note that |out_value| is still owned by this class. |
| 30 virtual bool Get(const std::wstring& path, Value** out_value) const = 0; |
| 31 |
| 32 // Convenience forms of Set(). These methods will replace any existing |
| 33 // value at that path, even if it has a different type. |
| 34 void SetBoolean(const std::wstring& path, bool in_value); |
| 35 void SetInteger(const std::wstring& path, int in_value); |
| 36 void SetReal(const std::wstring& path, double in_value); |
| 37 void SetString(const std::wstring& path, const std::string& in_value); |
| 38 |
| 39 // These are convenience forms of Get(). The value will be retrieved |
| 40 // and the return value will be true if the path is valid and the value at |
| 41 // the end of the path can be returned in the form specified. |
| 42 bool GetBoolean(const std::wstring& path, bool* out_value) const; |
| 43 bool GetInteger(const std::wstring& path, int* out_value) const; |
| 44 bool GetReal(const std::wstring& path, double* out_value) const; |
| 45 bool GetString(const std::wstring& path, std::string* out_value) const; |
| 46 }; |
| 47 |
| 48 } // namespace chromeos |
| 49 |
| 50 #endif // CHROME_BROWSER_CHROMEOS_CROS_SETTINGS_H_ |
| OLD | NEW |