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_PREFS_PREF_VALUE_STORE_H_ | 5 #ifndef CHROME_BROWSER_PREFS_PREF_VALUE_STORE_H_ |
6 #define CHROME_BROWSER_PREFS_PREF_VALUE_STORE_H_ | 6 #define CHROME_BROWSER_PREFS_PREF_VALUE_STORE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 // preference values. | 180 // preference values. |
181 // |extension_prefs| contains preference values set by extensions. | 181 // |extension_prefs| contains preference values set by extensions. |
182 // |command_line_prefs| contains preference values set by command-line | 182 // |command_line_prefs| contains preference values set by command-line |
183 // switches. | 183 // switches. |
184 // |user_prefs| contains all user-set preference values. | 184 // |user_prefs| contains all user-set preference values. |
185 // |recommended_prefs| contains all recommended (policy) preference values. | 185 // |recommended_prefs| contains all recommended (policy) preference values. |
186 // |default_prefs| contains application-default preference values. It must | 186 // |default_prefs| contains application-default preference values. It must |
187 // be non-null if any preferences are to be registered. | 187 // be non-null if any preferences are to be registered. |
188 // | 188 // |
189 // The |profile| parameter is used to construct a replacement device | 189 // The |profile| parameter is used to construct a replacement device |
190 // management pref store in case of policy refresh, may be NULL for the local | 190 // management pref store. This is done after policy refresh when we swap out |
191 // state preferences. | 191 // the policy pref stores for new ones, so the |profile| pointer needs to be |
| 192 // kept around for then. It is safe to pass a NULL pointer for local state |
| 193 // preferences. |
192 // | 194 // |
193 // TODO(mnissler, danno): Refactor the pref store interface and refresh logic | 195 // TODO(mnissler, danno): Refactor the pref store interface and refresh logic |
194 // so refreshes can be handled by the pref store itself and the profile | 196 // so refreshes can be handled by the pref store itself without swapping |
195 // parameter be removed here. | 197 // stores. This way we can get rid of the profile pointer here. |
196 // | 198 // |
197 // This constructor should only be used internally, or by subclasses in | 199 // This constructor should only be used internally, or by subclasses in |
198 // testing. The usual way to create a PrefValueStore is by creating a | 200 // testing. The usual way to create a PrefValueStore is by creating a |
199 // PrefService. | 201 // PrefService. |
200 PrefValueStore(PrefStore* managed_platform_prefs, | 202 PrefValueStore(PrefStore* managed_platform_prefs, |
201 PrefStore* device_management_prefs, | 203 PrefStore* device_management_prefs, |
202 PrefStore* extension_prefs, | 204 PrefStore* extension_prefs, |
203 PrefStore* command_line_prefs, | 205 PrefStore* command_line_prefs, |
204 PrefStore* user_prefs, | 206 PrefStore* user_prefs, |
205 PrefStore* recommended_prefs, | 207 PrefStore* recommended_prefs, |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 PrefStore* new_managed_platform_pref_store, | 242 PrefStore* new_managed_platform_pref_store, |
241 PrefStore* new_device_management_pref_store, | 243 PrefStore* new_device_management_pref_store, |
242 PrefStore* new_recommended_pref_store, | 244 PrefStore* new_recommended_pref_store, |
243 AfterRefreshCallback* callback); | 245 AfterRefreshCallback* callback); |
244 | 246 |
245 scoped_ptr<PrefStore> pref_stores_[PrefNotifier::PREF_STORE_TYPE_MAX + 1]; | 247 scoped_ptr<PrefStore> pref_stores_[PrefNotifier::PREF_STORE_TYPE_MAX + 1]; |
246 | 248 |
247 // A mapping of preference names to their registered types. | 249 // A mapping of preference names to their registered types. |
248 PrefTypeMap pref_types_; | 250 PrefTypeMap pref_types_; |
249 | 251 |
250 // The associated profile, if applicable. | 252 // The associated profile, in case this value store is associated with a |
| 253 // profile pref service. Used for recreating the device management pref store |
| 254 // upon policy refresh. |
251 Profile* profile_; | 255 Profile* profile_; |
252 | 256 |
253 DISALLOW_COPY_AND_ASSIGN(PrefValueStore); | 257 DISALLOW_COPY_AND_ASSIGN(PrefValueStore); |
254 }; | 258 }; |
255 | 259 |
256 #endif // CHROME_BROWSER_PREFS_PREF_VALUE_STORE_H_ | 260 #endif // CHROME_BROWSER_PREFS_PREF_VALUE_STORE_H_ |
OLD | NEW |