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/sequence_checker.h" | 16 #include "base/sequence_checker.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 SEQUENCE_CHECKER(sequence_checker_); | 137 SEQUENCE_CHECKER(sequence_checker_); |
138 | 138 |
139 DISALLOW_COPY_AND_ASSIGN(CrosSettings); | 139 DISALLOW_COPY_AND_ASSIGN(CrosSettings); |
140 }; | 140 }; |
141 | 141 |
142 // Helper class for tests. Initializes the CrosSettings singleton on | 142 // Helper class for tests. Initializes the CrosSettings singleton on |
143 // construction and tears it down again on destruction. | 143 // construction and tears it down again on destruction. |
144 class ScopedTestCrosSettings { | 144 class ScopedTestCrosSettings { |
145 public: | 145 public: |
146 ScopedTestCrosSettings(); | 146 ScopedTestCrosSettings(); |
147 ~ScopedTestCrosSettings(); | 147 ~ScopedTestCrosSettings(); |
148 | 148 |
149 private: | 149 private: |
150 DISALLOW_COPY_AND_ASSIGN(ScopedTestCrosSettings); | 150 DISALLOW_COPY_AND_ASSIGN(ScopedTestCrosSettings); |
151 }; | 151 }; |
152 | 152 |
153 } // namespace chromeos | 153 } // namespace chromeos |
154 | 154 |
155 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_CROS_SETTINGS_H_ | 155 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_CROS_SETTINGS_H_ |
OLD | NEW |