OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_PROFILE_PREF_STORE_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_PREFS_PROFILE_PREF_STORE_MANAGER_H_ |
6 #define CHROME_BROWSER_PREFS_PROFILE_PREF_STORE_MANAGER_H_ | 6 #define CHROME_BROWSER_PREFS_PROFILE_PREF_STORE_MANAGER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
17 #include "components/user_prefs/tracked/pref_hash_filter.h" | 17 #include "components/user_prefs/tracked/pref_hash_filter.h" |
18 | 18 |
19 class HashStoreContents; | 19 class HashStoreContents; |
20 class PersistentPrefStore; | 20 class PersistentPrefStore; |
21 class PrefHashStore; | 21 class PrefHashStore; |
22 class PrefService; | 22 class PrefService; |
23 class TrackedPreferenceValidationDelegate; | 23 class TrackedPreferenceValidationDelegate; |
24 | 24 |
25 namespace base { | 25 namespace base { |
26 class DictionaryValue; | 26 class DictionaryValue; |
27 class SequencedTaskRunner; | 27 class SequencedTaskRunner; |
| 28 class SingleThreadTaskRunner; |
28 } // namespace base | 29 } // namespace base |
29 | 30 |
30 namespace user_prefs { | 31 namespace user_prefs { |
31 class PrefRegistrySyncable; | 32 class PrefRegistrySyncable; |
32 } // namespace user_prefs | 33 } // namespace user_prefs |
33 | 34 |
34 // Provides a facade through which the user preference store may be accessed and | 35 // Provides a facade through which the user preference store may be accessed and |
35 // managed. | 36 // managed. |
36 class ProfilePrefStoreManager { | 37 class ProfilePrefStoreManager { |
37 public: | 38 public: |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 static void SetPreferenceValidationRegistryPathForTesting( | 78 static void SetPreferenceValidationRegistryPathForTesting( |
78 const base::string16* path); | 79 const base::string16* path); |
79 #endif | 80 #endif |
80 | 81 |
81 // Creates a PersistentPrefStore providing access to the user preferences of | 82 // Creates a PersistentPrefStore providing access to the user preferences of |
82 // the managed profile. If |on_reset| is provided, it will be invoked if a | 83 // the managed profile. If |on_reset| is provided, it will be invoked if a |
83 // reset occurs as a result of loading the profile's prefs. | 84 // reset occurs as a result of loading the profile's prefs. |
84 // An optional |validation_delegate| will be notified | 85 // An optional |validation_delegate| will be notified |
85 // of the status of each tracked preference as they are checked. | 86 // of the status of each tracked preference as they are checked. |
86 PersistentPrefStore* CreateProfilePrefStore( | 87 PersistentPrefStore* CreateProfilePrefStore( |
| 88 const scoped_refptr<base::SingleThreadTaskRunner>& pref_task_runner, |
87 const scoped_refptr<base::SequencedTaskRunner>& io_task_runner, | 89 const scoped_refptr<base::SequencedTaskRunner>& io_task_runner, |
88 const base::Closure& on_reset_on_load, | 90 const base::Closure& on_reset_on_load, |
89 TrackedPreferenceValidationDelegate* validation_delegate); | 91 base::WeakPtr<TrackedPreferenceValidationDelegate> validation_delegate); |
90 | 92 |
91 // Initializes the preferences for the managed profile with the preference | 93 // Initializes the preferences for the managed profile with the preference |
92 // values in |master_prefs|. Acts synchronously, including blocking IO. | 94 // values in |master_prefs|. Acts synchronously, including blocking IO. |
93 // Returns true on success. | 95 // Returns true on success. |
94 bool InitializePrefsFromMasterPrefs( | 96 bool InitializePrefsFromMasterPrefs( |
95 const base::DictionaryValue& master_prefs); | 97 const base::DictionaryValue& master_prefs); |
96 | 98 |
97 // Creates a single-file PrefStore as was used in M34 and earlier. Used only | 99 // Creates a single-file PrefStore as was used in M34 and earlier. Used only |
98 // for testing migration. | 100 // for testing migration. |
99 PersistentPrefStore* CreateDeprecatedCombinedProfilePrefStore( | 101 PersistentPrefStore* CreateDeprecatedCombinedProfilePrefStore( |
(...skipping 18 matching lines...) Expand all Loading... |
118 tracking_configuration_; | 120 tracking_configuration_; |
119 const size_t reporting_ids_count_; | 121 const size_t reporting_ids_count_; |
120 const std::string seed_; | 122 const std::string seed_; |
121 const std::string legacy_device_id_; | 123 const std::string legacy_device_id_; |
122 PrefService* local_state_; | 124 PrefService* local_state_; |
123 | 125 |
124 DISALLOW_COPY_AND_ASSIGN(ProfilePrefStoreManager); | 126 DISALLOW_COPY_AND_ASSIGN(ProfilePrefStoreManager); |
125 }; | 127 }; |
126 | 128 |
127 #endif // CHROME_BROWSER_PREFS_PROFILE_PREF_STORE_MANAGER_H_ | 129 #endif // CHROME_BROWSER_PREFS_PROFILE_PREF_STORE_MANAGER_H_ |
OLD | NEW |