OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_SETTINGS_CROS_SETTINGS_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_SETTINGS_CROS_SETTINGS_H_ |
6 #define CHROME_BROWSER_CHROMEOS_SETTINGS_CROS_SETTINGS_H_ | 6 #define CHROME_BROWSER_CHROMEOS_SETTINGS_CROS_SETTINGS_H_ |
7 | 7 |
| 8 #include <map> |
8 #include <memory> | 9 #include <memory> |
9 #include <string> | 10 #include <string> |
10 #include <vector> | 11 #include <vector> |
11 | 12 |
12 #include "base/callback_forward.h" | 13 #include "base/callback_forward.h" |
13 #include "base/callback_list.h" | 14 #include "base/callback_list.h" |
14 #include "base/containers/hash_tables.h" | |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "base/threading/non_thread_safe.h" | 16 #include "base/threading/non_thread_safe.h" |
17 #include "chromeos/settings/cros_settings_names.h" | 17 #include "chromeos/settings/cros_settings_names.h" |
18 #include "chromeos/settings/cros_settings_provider.h" | 18 #include "chromeos/settings/cros_settings_provider.h" |
19 | 19 |
20 namespace base { | 20 namespace base { |
21 class DictionaryValue; | 21 class DictionaryValue; |
22 class ListValue; | 22 class ListValue; |
23 class Value; | 23 class Value; |
24 } | 24 } |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 friend class CrosSettingsTest; | 124 friend class CrosSettingsTest; |
125 | 125 |
126 // Fires system setting change callback. | 126 // Fires system setting change callback. |
127 void FireObservers(const std::string& path); | 127 void FireObservers(const std::string& path); |
128 | 128 |
129 // List of ChromeOS system settings providers. | 129 // List of ChromeOS system settings providers. |
130 std::vector<std::unique_ptr<CrosSettingsProvider>> providers_; | 130 std::vector<std::unique_ptr<CrosSettingsProvider>> providers_; |
131 | 131 |
132 // A map from settings names to a list of observers. Observers get fired in | 132 // A map from settings names to a list of observers. Observers get fired in |
133 // the order they are added. | 133 // the order they are added. |
134 base::hash_map<std::string, std::unique_ptr<base::CallbackList<void(void)>>> | 134 std::map<std::string, std::unique_ptr<base::CallbackList<void(void)>>> |
135 settings_observers_; | 135 settings_observers_; |
136 | 136 |
137 DISALLOW_COPY_AND_ASSIGN(CrosSettings); | 137 DISALLOW_COPY_AND_ASSIGN(CrosSettings); |
138 }; | 138 }; |
139 | 139 |
140 // Helper class for tests. Initializes the CrosSettings singleton on | 140 // Helper class for tests. Initializes the CrosSettings singleton on |
141 // construction and tears it down again on destruction. | 141 // construction and tears it down again on destruction. |
142 class ScopedTestCrosSettings { | 142 class ScopedTestCrosSettings { |
143 public: | 143 public: |
144 ScopedTestCrosSettings(); | 144 ScopedTestCrosSettings(); |
145 ~ScopedTestCrosSettings(); | 145 ~ScopedTestCrosSettings(); |
146 | 146 |
147 private: | 147 private: |
148 DISALLOW_COPY_AND_ASSIGN(ScopedTestCrosSettings); | 148 DISALLOW_COPY_AND_ASSIGN(ScopedTestCrosSettings); |
149 }; | 149 }; |
150 | 150 |
151 } // namespace chromeos | 151 } // namespace chromeos |
152 | 152 |
153 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_CROS_SETTINGS_H_ | 153 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_CROS_SETTINGS_H_ |
OLD | NEW |