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> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
15 #include "base/ref_counted.h" | 15 #include "base/ref_counted.h" |
16 #include "base/scoped_ptr.h" | 16 #include "base/scoped_ptr.h" |
17 #include "base/values.h" | 17 #include "base/values.h" |
18 #include "chrome/browser/browser_thread.h" | 18 #include "chrome/browser/browser_thread.h" |
19 #include "chrome/common/pref_store.h" | 19 #include "chrome/common/pref_store.h" |
20 | 20 |
21 class FilePath; | 21 class FilePath; |
22 class PrefNotifier; | 22 class PrefNotifier; |
23 class PrefStore; | 23 class PrefStore; |
24 class Profile; | |
25 | 24 |
26 // The PrefValueStore manages various sources of values for Preferences | 25 // The PrefValueStore manages various sources of values for Preferences |
27 // (e.g., configuration policies, extensions, and user settings). It returns | 26 // (e.g., configuration policies, extensions, and user settings). It returns |
28 // the value of a Preference from the source with the highest priority, and | 27 // the value of a Preference from the source with the highest priority, and |
29 // allows setting user-defined values for preferences that are not managed. | 28 // allows setting user-defined values for preferences that are not managed. |
30 // | 29 // |
31 // Unless otherwise explicitly noted, all of the methods of this class must | 30 // Unless otherwise explicitly noted, all of the methods of this class must |
32 // be called on the UI thread. | 31 // be called on the UI thread. |
33 class PrefValueStore : public base::RefCountedThreadSafe<PrefValueStore> { | 32 class PrefValueStore : public base::RefCountedThreadSafe<PrefValueStore> { |
34 public: | 33 public: |
35 // In decreasing order of precedence: | 34 // In decreasing order of precedence: |
36 // |managed_platform_prefs| contains all managed platform (non-cloud policy) | 35 // |managed_platform_prefs| contains all managed platform (non-cloud policy) |
37 // preference values. | 36 // preference values. |
38 // |device_management_prefs| contains all device management (cloud policy) | 37 // |device_management_prefs| contains all device management (cloud policy) |
39 // preference values. | 38 // preference values. |
40 // |extension_prefs| contains preference values set by extensions. | 39 // |extension_prefs| contains preference values set by extensions. |
41 // |command_line_prefs| contains preference values set by command-line | 40 // |command_line_prefs| contains preference values set by command-line |
42 // switches. | 41 // switches. |
43 // |user_prefs| contains all user-set preference values. | 42 // |user_prefs| contains all user-set preference values. |
44 // |recommended_prefs| contains all recommended (policy) preference values. | 43 // |recommended_prefs| contains all recommended (policy) preference values. |
45 // |default_prefs| contains application-default preference values. It must | 44 // |default_prefs| contains application-default preference values. It must |
46 // be non-null if any preferences are to be registered. | 45 // be non-null if any preferences are to be registered. |
47 // | 46 // |
48 // |pref_notifier| facilitates broadcasting preference change notifications | 47 // |pref_notifier| facilitates broadcasting preference change notifications |
49 // to the world. | 48 // to the world. |
50 // | |
51 // The |profile| parameter is used to construct a replacement device | |
52 // management pref store. This is done after policy refresh when we swap out | |
53 // the policy pref stores for new ones, so the |profile| pointer needs to be | |
54 // kept around for then. It is safe to pass a NULL pointer for local state | |
55 // preferences. | |
56 PrefValueStore(PrefStore* managed_platform_prefs, | 49 PrefValueStore(PrefStore* managed_platform_prefs, |
57 PrefStore* device_management_prefs, | 50 PrefStore* device_management_prefs, |
58 PrefStore* extension_prefs, | 51 PrefStore* extension_prefs, |
59 PrefStore* command_line_prefs, | 52 PrefStore* command_line_prefs, |
60 PrefStore* user_prefs, | 53 PrefStore* user_prefs, |
61 PrefStore* recommended_prefs, | 54 PrefStore* recommended_prefs, |
62 PrefStore* default_prefs, | 55 PrefStore* default_prefs, |
63 PrefNotifier* pref_notifier); | 56 PrefNotifier* pref_notifier); |
64 virtual ~PrefValueStore(); | 57 virtual ~PrefValueStore(); |
65 | 58 |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 // corresponding PrefService. | 234 // corresponding PrefService. |
242 PrefNotifier* pref_notifier_; | 235 PrefNotifier* pref_notifier_; |
243 | 236 |
244 // A mapping of preference names to their registered types. | 237 // A mapping of preference names to their registered types. |
245 PrefTypeMap pref_types_; | 238 PrefTypeMap pref_types_; |
246 | 239 |
247 DISALLOW_COPY_AND_ASSIGN(PrefValueStore); | 240 DISALLOW_COPY_AND_ASSIGN(PrefValueStore); |
248 }; | 241 }; |
249 | 242 |
250 #endif // CHROME_BROWSER_PREFS_PREF_VALUE_STORE_H_ | 243 #endif // CHROME_BROWSER_PREFS_PREF_VALUE_STORE_H_ |
OLD | NEW |