| 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_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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 // If the pref at the given path changes, we call the observer's Observe | 85 // If the pref at the given path changes, we call the observer's Observe |
| 86 // method with PREF_CHANGED. | 86 // method with PREF_CHANGED. |
| 87 void AddSettingsObserver(const char* path, | 87 void AddSettingsObserver(const char* path, |
| 88 content::NotificationObserver* obs); | 88 content::NotificationObserver* obs); |
| 89 void RemoveSettingsObserver(const char* path, | 89 void RemoveSettingsObserver(const char* path, |
| 90 content::NotificationObserver* obs); | 90 content::NotificationObserver* obs); |
| 91 | 91 |
| 92 // Returns the provider that handles settings with the path or prefix. | 92 // Returns the provider that handles settings with the path or prefix. |
| 93 CrosSettingsProvider* GetProvider(const std::string& path) const; | 93 CrosSettingsProvider* GetProvider(const std::string& path) const; |
| 94 | 94 |
| 95 // Forces all providers to reload their caches from the respective backing |
| 96 // stores if they have any. |
| 97 void ReloadProviders(); |
| 98 |
| 95 private: | 99 private: |
| 96 // List of ChromeOS system settings providers. | 100 // List of ChromeOS system settings providers. |
| 97 std::vector<CrosSettingsProvider*> providers_; | 101 std::vector<CrosSettingsProvider*> providers_; |
| 98 | 102 |
| 99 // A map from settings names to a list of observers. Observers get fired in | 103 // A map from settings names to a list of observers. Observers get fired in |
| 100 // the order they are added. | 104 // the order they are added. |
| 101 typedef ObserverList<content::NotificationObserver> NotificationObserverList; | 105 typedef ObserverList<content::NotificationObserver> NotificationObserverList; |
| 102 typedef base::hash_map<std::string, NotificationObserverList*> | 106 typedef base::hash_map<std::string, NotificationObserverList*> |
| 103 SettingsObserverMap; | 107 SettingsObserverMap; |
| 104 SettingsObserverMap settings_observers_; | 108 SettingsObserverMap settings_observers_; |
| 105 | 109 |
| 106 CrosSettings(); | 110 CrosSettings(); |
| 107 ~CrosSettings(); | 111 ~CrosSettings(); |
| 108 friend struct base::DefaultLazyInstanceTraits<CrosSettings>; | 112 friend struct base::DefaultLazyInstanceTraits<CrosSettings>; |
| 109 | 113 |
| 110 DISALLOW_COPY_AND_ASSIGN(CrosSettings); | 114 DISALLOW_COPY_AND_ASSIGN(CrosSettings); |
| 111 }; | 115 }; |
| 112 | 116 |
| 113 } // namespace chromeos | 117 } // namespace chromeos |
| 114 | 118 |
| 115 #endif // CHROME_BROWSER_CHROMEOS_CROS_SETTINGS_H_ | 119 #endif // CHROME_BROWSER_CHROMEOS_CROS_SETTINGS_H_ |
| OLD | NEW |