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 BASE_PREFS_PREF_VALUE_STORE_H_ |
6 #define CHROME_BROWSER_PREFS_PREF_VALUE_STORE_H_ | 6 #define BASE_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/base_prefs_export.h" |
16 #include "base/prefs/pref_store.h" | 17 #include "base/prefs/pref_store.h" |
17 #include "base/values.h" | 18 #include "base/values.h" |
18 | 19 |
19 class PrefNotifier; | 20 class PrefNotifier; |
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 BASE_PREFS_EXPORT PrefValueStore { |
30 public: | 31 public: |
31 typedef base::Callback<void(const std::string&)> PrefChangedCallback; | 32 typedef base::Callback<void(const std::string&)> PrefChangedCallback; |
32 | 33 |
33 // In decreasing order of precedence: | 34 // In decreasing order of precedence: |
34 // |managed_prefs| contains all preferences from mandatory policies. | 35 // |managed_prefs| contains all preferences from mandatory policies. |
35 // |extension_prefs| contains preference values set by extensions. | 36 // |extension_prefs| contains preference values set by extensions. |
36 // |command_line_prefs| contains preference values set by command-line | 37 // |command_line_prefs| contains preference values set by command-line |
37 // switches. | 38 // switches. |
38 // |user_prefs| contains all user-set preference values. | 39 // |user_prefs| contains all user-set preference values. |
39 // |recommended_prefs| contains all preferences from recommended policies. | 40 // |recommended_prefs| contains all preferences from recommended policies. |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 | 250 |
250 // A mapping of preference names to their registered types. | 251 // A mapping of preference names to their registered types. |
251 PrefTypeMap pref_types_; | 252 PrefTypeMap pref_types_; |
252 | 253 |
253 // True if not all of the PrefStores were initialized successfully. | 254 // True if not all of the PrefStores were initialized successfully. |
254 bool initialization_failed_; | 255 bool initialization_failed_; |
255 | 256 |
256 DISALLOW_COPY_AND_ASSIGN(PrefValueStore); | 257 DISALLOW_COPY_AND_ASSIGN(PrefValueStore); |
257 }; | 258 }; |
258 | 259 |
259 #endif // CHROME_BROWSER_PREFS_PREF_VALUE_STORE_H_ | 260 #endif // BASE_PREFS_PREF_VALUE_STORE_H_ |
OLD | NEW |