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 <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 // |pref_service|. Assumes that |pref_service| is backed by a PrefStore that | 71 // |pref_service|. Assumes that |pref_service| is backed by a PrefStore that |
72 // was built by ProfilePrefStoreManager. | 72 // was built by ProfilePrefStoreManager. |
73 // If no reset has occurred, returns a null |Time|. | 73 // If no reset has occurred, returns a null |Time|. |
74 static base::Time GetResetTime(PrefService* pref_service); | 74 static base::Time GetResetTime(PrefService* pref_service); |
75 | 75 |
76 // Clears the time of the last preference reset event, if any, for | 76 // Clears the time of the last preference reset event, if any, for |
77 // |pref_service|. Assumes that |pref_service| is backed by a PrefStore that | 77 // |pref_service|. Assumes that |pref_service| is backed by a PrefStore that |
78 // was built by ProfilePrefStoreManager. | 78 // was built by ProfilePrefStoreManager. |
79 static void ClearResetTime(PrefService* pref_service); | 79 static void ClearResetTime(PrefService* pref_service); |
80 | 80 |
81 // Deletes stored hashes for the managed profile. | |
82 void ResetPrefHashStore(); | |
83 | |
84 // Creates a PersistentPrefStore providing access to the user preferences of | 81 // Creates a PersistentPrefStore providing access to the user preferences of |
85 // the managed profile. An optional |validation_delegate| will be notified | 82 // the managed profile. An optional |validation_delegate| will be notified |
86 // of the status of each tracked preference as they are checked. | 83 // of the status of each tracked preference as they are checked. |
87 PersistentPrefStore* CreateProfilePrefStore( | 84 PersistentPrefStore* CreateProfilePrefStore( |
88 const scoped_refptr<base::SequencedTaskRunner>& io_task_runner, | 85 const scoped_refptr<base::SequencedTaskRunner>& io_task_runner, |
89 TrackedPreferenceValidationDelegate* validation_delegate); | 86 TrackedPreferenceValidationDelegate* validation_delegate); |
90 | 87 |
91 // Checks the presence/version of the hash store for the managed profile and | |
92 // creates or updates it if necessary. Completes asynchronously and is safe if | |
93 // the preferences/hash store are concurrently loaded/manipulated by another | |
94 // task. | |
95 void UpdateProfileHashStoreIfRequired( | |
96 const scoped_refptr<base::SequencedTaskRunner>& io_task_runner); | |
97 | |
98 // Initializes the preferences for the managed profile with the preference | 88 // Initializes the preferences for the managed profile with the preference |
99 // values in |master_prefs|. Acts synchronously, including blocking IO. | 89 // values in |master_prefs|. Acts synchronously, including blocking IO. |
100 // Returns true on success. | 90 // Returns true on success. |
101 bool InitializePrefsFromMasterPrefs( | 91 bool InitializePrefsFromMasterPrefs( |
102 const base::DictionaryValue& master_prefs); | 92 const base::DictionaryValue& master_prefs); |
103 | 93 |
104 // Creates a single-file PrefStore as was used in M34 and earlier. Used only | 94 // Creates a single-file PrefStore as was used in M34 and earlier. Used only |
105 // for testing migration. | 95 // for testing migration. |
106 PersistentPrefStore* CreateDeprecatedCombinedProfilePrefStore( | 96 PersistentPrefStore* CreateDeprecatedCombinedProfilePrefStore( |
107 const scoped_refptr<base::SequencedTaskRunner>& io_task_runner); | 97 const scoped_refptr<base::SequencedTaskRunner>& io_task_runner); |
108 | 98 |
109 private: | 99 private: |
110 // Returns a PrefHashStoreImpl for the managed profile. Should only be called | 100 // Returns a PrefHashStoreImpl for the managed profile. Should only be called |
111 // if |kPlatformSupportsPreferenceTracking|. | 101 // if |kPlatformSupportsPreferenceTracking|. |
112 scoped_ptr<PrefHashStoreImpl> GetPrefHashStoreImpl(); | 102 scoped_ptr<PrefHashStoreImpl> GetPrefHashStoreImpl(); |
113 | 103 |
114 const base::FilePath profile_path_; | 104 const base::FilePath profile_path_; |
115 const std::vector<PrefHashFilter::TrackedPreferenceMetadata> | 105 const std::vector<PrefHashFilter::TrackedPreferenceMetadata> |
116 tracking_configuration_; | 106 tracking_configuration_; |
117 const size_t reporting_ids_count_; | 107 const size_t reporting_ids_count_; |
118 const std::string seed_; | 108 const std::string seed_; |
119 const std::string device_id_; | 109 const std::string device_id_; |
120 PrefService* local_state_; | 110 PrefService* local_state_; |
121 | 111 |
122 DISALLOW_COPY_AND_ASSIGN(ProfilePrefStoreManager); | 112 DISALLOW_COPY_AND_ASSIGN(ProfilePrefStoreManager); |
123 }; | 113 }; |
124 | 114 |
125 #endif // CHROME_BROWSER_PREFS_PROFILE_PREF_STORE_MANAGER_H_ | 115 #endif // CHROME_BROWSER_PREFS_PROFILE_PREF_STORE_MANAGER_H_ |
OLD | NEW |