| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 bool GetBoolean(const std::string& path, bool* out_value) const; | 55 bool GetBoolean(const std::string& path, bool* out_value) const; |
| 56 bool GetInteger(const std::string& path, int* out_value) const; | 56 bool GetInteger(const std::string& path, int* out_value) const; |
| 57 bool GetReal(const std::string& path, double* out_value) const; | 57 bool GetReal(const std::string& path, double* out_value) const; |
| 58 bool GetString(const std::string& path, std::string* out_value) const; | 58 bool GetString(const std::string& path, std::string* out_value) const; |
| 59 | 59 |
| 60 // adding/removing of providers | 60 // adding/removing of providers |
| 61 bool AddSettingsProvider(CrosSettingsProvider* provider); | 61 bool AddSettingsProvider(CrosSettingsProvider* provider); |
| 62 bool RemoveSettingsProvider(CrosSettingsProvider* provider); | 62 bool RemoveSettingsProvider(CrosSettingsProvider* provider); |
| 63 | 63 |
| 64 // If the pref at the given path changes, we call the observer's Observe | 64 // If the pref at the given path changes, we call the observer's Observe |
| 65 // method with PREF_CHANGED. | 65 // method with NOTIFY_PREF_CHANGED. |
| 66 void AddSettingsObserver(const char* path, NotificationObserver* obs); | 66 void AddSettingsObserver(const char* path, NotificationObserver* obs); |
| 67 void RemoveSettingsObserver(const char* path, NotificationObserver* obs); | 67 void RemoveSettingsObserver(const char* path, NotificationObserver* obs); |
| 68 | 68 |
| 69 private: | 69 private: |
| 70 // List of ChromeOS system settings providers. | 70 // List of ChromeOS system settings providers. |
| 71 std::vector<CrosSettingsProvider*> providers_; | 71 std::vector<CrosSettingsProvider*> providers_; |
| 72 | 72 |
| 73 // A map from settings names to a list of observers. Observers get fired in | 73 // A map from settings names to a list of observers. Observers get fired in |
| 74 // the order they are added. | 74 // the order they are added. |
| 75 typedef ObserverList<NotificationObserver> NotificationObserverList; | 75 typedef ObserverList<NotificationObserver> NotificationObserverList; |
| 76 typedef base::hash_map<std::string, NotificationObserverList*> | 76 typedef base::hash_map<std::string, NotificationObserverList*> |
| 77 SettingsObserverMap; | 77 SettingsObserverMap; |
| 78 SettingsObserverMap settings_observers_; | 78 SettingsObserverMap settings_observers_; |
| 79 | 79 |
| 80 CrosSettings(); | 80 CrosSettings(); |
| 81 ~CrosSettings(); | 81 ~CrosSettings(); |
| 82 CrosSettingsProvider* GetProvider(const std::string& path) const; | 82 CrosSettingsProvider* GetProvider(const std::string& path) const; |
| 83 friend struct DefaultSingletonTraits<CrosSettings>; | 83 friend struct DefaultSingletonTraits<CrosSettings>; |
| 84 | 84 |
| 85 DISALLOW_COPY_AND_ASSIGN(CrosSettings); | 85 DISALLOW_COPY_AND_ASSIGN(CrosSettings); |
| 86 }; | 86 }; |
| 87 | 87 |
| 88 } // namespace chromeos | 88 } // namespace chromeos |
| 89 | 89 |
| 90 #endif // CHROME_BROWSER_CHROMEOS_CROS_SETTINGS_H_ | 90 #endif // CHROME_BROWSER_CHROMEOS_CROS_SETTINGS_H_ |
| OLD | NEW |