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 PersistentPrefStore; | 20 class PersistentPrefStore; |
20 class PrefHashStore; | 21 class PrefHashStore; |
21 class PrefService; | 22 class PrefService; |
22 class TrackedPreferenceValidationDelegate; | 23 class TrackedPreferenceValidationDelegate; |
23 | 24 |
24 namespace base { | 25 namespace base { |
25 class DictionaryValue; | 26 class DictionaryValue; |
26 class SequencedTaskRunner; | 27 class SequencedTaskRunner; |
27 } // namespace base | 28 } // namespace base |
28 | 29 |
29 namespace user_prefs { | 30 namespace user_prefs { |
30 class PrefRegistrySyncable; | 31 class PrefRegistrySyncable; |
31 } // namespace user_prefs | 32 } // namespace user_prefs |
32 | 33 |
33 class PrefRegistrySimple; | 34 class PrefRegistrySimple; |
34 | 35 |
36 namespace chrome_prefs { | |
gab
2016/08/08 04:37:45
Make it a static method of ProfilePrefStoreManager
proberge
2016/08/31 17:30:16
Done.
| |
37 // Call before startup tasks kick in to use a different registry path for | |
38 // storing and validating tracked preference MACs. Callers are responsible | |
39 // for ensuring that the key is deleted on shutdown. For testing only. | |
40 void SetPreferenceValidationRegistryPathForTesting(base::string16 path); | |
gab
2016/08/08 04:37:45
Make this call OS_WIN only (registry isn't generic
gab
2016/08/08 04:37:45
Always pass strings by const&
proberge
2016/08/31 17:30:16
Done.
proberge
2016/08/31 17:30:16
Done.
| |
41 } | |
42 | |
35 // Provides a facade through which the user preference store may be accessed and | 43 // Provides a facade through which the user preference store may be accessed and |
36 // managed. | 44 // managed. |
37 class ProfilePrefStoreManager { | 45 class ProfilePrefStoreManager { |
38 public: | 46 public: |
39 // Instantiates a ProfilePrefStoreManager with the configuration required to | 47 // Instantiates a ProfilePrefStoreManager with the configuration required to |
40 // manage the user preferences of the profile at |profile_path|. | 48 // manage the user preferences of the profile at |profile_path|. |
41 // |tracking_configuration| is used for preference tracking. | 49 // |tracking_configuration| is used for preference tracking. |
42 // |reporting_ids_count| is the count of all possible tracked preference IDs | 50 // |reporting_ids_count| is the count of all possible tracked preference IDs |
43 // (possibly greater than |tracking_configuration.size()|). | 51 // (possibly greater than |tracking_configuration.size()|). |
44 // |seed| and |device_id| are used to track preference value changes and must | 52 // |seed| and |device_id| are used to track preference value changes and must |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
92 const scoped_refptr<base::SequencedTaskRunner>& io_task_runner); | 100 const scoped_refptr<base::SequencedTaskRunner>& io_task_runner); |
93 | 101 |
94 private: | 102 private: |
95 // Returns a PrefHashStore for the managed profile. Should only be called | 103 // Returns a PrefHashStore for the managed profile. Should only be called |
96 // if |kPlatformSupportsPreferenceTracking|. |use_super_mac| determines | 104 // if |kPlatformSupportsPreferenceTracking|. |use_super_mac| determines |
97 // whether the returned object will calculate, store, and validate super MACs | 105 // whether the returned object will calculate, store, and validate super MACs |
98 // (and, by extension, accept non-null newly protected preferences as | 106 // (and, by extension, accept non-null newly protected preferences as |
99 // TrustedInitialized). | 107 // TrustedInitialized). |
100 std::unique_ptr<PrefHashStore> GetPrefHashStore(bool use_super_mac); | 108 std::unique_ptr<PrefHashStore> GetPrefHashStore(bool use_super_mac); |
101 | 109 |
110 // Returns a PrefHashStore that can be used for extra out-of-band | |
111 // verifications on this platform (or null if none for this platform). | |
112 std::unique_ptr<PrefHashStore> GetExternalVerificationPrefHashStore(); | |
113 | |
114 // Returns a HashStoreContents that can be used for extra out-of-band | |
115 // verifications on this platform (or null if none for this platform). | |
116 std::unique_ptr<HashStoreContents> | |
117 GetExternalVerificationPrefHashStoreContents(); | |
118 | |
102 const base::FilePath profile_path_; | 119 const base::FilePath profile_path_; |
103 const std::vector<PrefHashFilter::TrackedPreferenceMetadata> | 120 const std::vector<PrefHashFilter::TrackedPreferenceMetadata> |
104 tracking_configuration_; | 121 tracking_configuration_; |
105 const size_t reporting_ids_count_; | 122 const size_t reporting_ids_count_; |
106 const std::string seed_; | 123 const std::string seed_; |
107 const std::string device_id_; | 124 const std::string device_id_; |
108 PrefService* local_state_; | 125 PrefService* local_state_; |
109 | 126 |
110 DISALLOW_COPY_AND_ASSIGN(ProfilePrefStoreManager); | 127 DISALLOW_COPY_AND_ASSIGN(ProfilePrefStoreManager); |
111 }; | 128 }; |
112 | 129 |
113 #endif // CHROME_BROWSER_PREFS_PROFILE_PREF_STORE_MANAGER_H_ | 130 #endif // CHROME_BROWSER_PREFS_PROFILE_PREF_STORE_MANAGER_H_ |
OLD | NEW |