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_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 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/callback.h" | 13 #include "base/callback.h" |
14 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
16 #include "base/prefs/pref_store.h" | 16 #include "base/prefs/pref_store.h" |
17 #include "base/values.h" | 17 #include "base/values.h" |
18 | 18 |
19 class PrefNotifier; | 19 class PrefNotifier; |
20 class PrefRegistry; | |
20 class PrefStore; | 21 class PrefStore; |
21 | 22 |
22 // The PrefValueStore manages various sources of values for Preferences | 23 // The PrefValueStore manages various sources of values for Preferences |
23 // (e.g., configuration policies, extensions, and user settings). It returns | 24 // (e.g., configuration policies, extensions, and user settings). It returns |
24 // the value of a Preference from the source with the highest priority, and | 25 // the value of a Preference from the source with the highest priority, and |
25 // allows setting user-defined values for preferences that are not managed. | 26 // allows setting user-defined values for preferences that are not managed. |
26 // | 27 // |
27 // Unless otherwise explicitly noted, all of the methods of this class must | 28 // Unless otherwise explicitly noted, all of the methods of this class must |
28 // be called on the UI thread. | 29 // be called on the UI thread. |
29 class PrefValueStore { | 30 class PrefValueStore { |
(...skipping 12 matching lines...) Expand all Loading... | |
42 // | 43 // |
43 // |pref_notifier| facilitates broadcasting preference change notifications | 44 // |pref_notifier| facilitates broadcasting preference change notifications |
44 // to the world. | 45 // to the world. |
45 PrefValueStore(PrefStore* managed_prefs, | 46 PrefValueStore(PrefStore* managed_prefs, |
46 PrefStore* extension_prefs, | 47 PrefStore* extension_prefs, |
47 PrefStore* command_line_prefs, | 48 PrefStore* command_line_prefs, |
48 PrefStore* user_prefs, | 49 PrefStore* user_prefs, |
49 PrefStore* recommended_prefs, | 50 PrefStore* recommended_prefs, |
50 PrefStore* default_prefs, | 51 PrefStore* default_prefs, |
51 PrefNotifier* pref_notifier); | 52 PrefNotifier* pref_notifier); |
53 // Same except retrieves default_prefs from PrefRegistry. | |
54 PrefValueStore(PrefStore* managed_prefs, | |
55 PrefStore* extension_prefs, | |
56 PrefStore* command_line_prefs, | |
57 PrefStore* user_prefs, | |
58 PrefStore* recommended_prefs, | |
59 PrefRegistry* pref_registry, | |
Mattias Nissler (ping if slow)
2013/01/25 14:57:11
PrefValueStore shouldn't have to know about PrefRe
Jói
2013/01/29 16:10:02
Done.
| |
60 PrefNotifier* pref_notifier); | |
52 virtual ~PrefValueStore(); | 61 virtual ~PrefValueStore(); |
53 | 62 |
54 // Creates a clone of this PrefValueStore with PrefStores overwritten | 63 // Creates a clone of this PrefValueStore with PrefStores overwritten |
55 // by the parameters passed, if unequal NULL. | 64 // by the parameters passed, if unequal NULL. |
56 PrefValueStore* CloneAndSpecialize(PrefStore* managed_prefs, | 65 PrefValueStore* CloneAndSpecialize(PrefStore* managed_prefs, |
57 PrefStore* extension_prefs, | 66 PrefStore* extension_prefs, |
58 PrefStore* command_line_prefs, | 67 PrefStore* command_line_prefs, |
59 PrefStore* user_prefs, | 68 PrefStore* user_prefs, |
60 PrefStore* recommended_prefs, | 69 PrefStore* recommended_prefs, |
61 PrefStore* default_prefs, | 70 PrefStore* default_prefs, |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
250 // A mapping of preference names to their registered types. | 259 // A mapping of preference names to their registered types. |
251 PrefTypeMap pref_types_; | 260 PrefTypeMap pref_types_; |
252 | 261 |
253 // True if not all of the PrefStores were initialized successfully. | 262 // True if not all of the PrefStores were initialized successfully. |
254 bool initialization_failed_; | 263 bool initialization_failed_; |
255 | 264 |
256 DISALLOW_COPY_AND_ASSIGN(PrefValueStore); | 265 DISALLOW_COPY_AND_ASSIGN(PrefValueStore); |
257 }; | 266 }; |
258 | 267 |
259 #endif // CHROME_BROWSER_PREFS_PREF_VALUE_STORE_H_ | 268 #endif // CHROME_BROWSER_PREFS_PREF_VALUE_STORE_H_ |
OLD | NEW |