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 #include "chrome/browser/prefs/profile_pref_store_manager.h" | 5 #include "chrome/browser/prefs/profile_pref_store_manager.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/json/json_file_value_serializer.h" | 8 #include "base/json/json_file_value_serializer.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
151 return profile_path.Append(chrome::kPreferencesFilename); | 151 return profile_path.Append(chrome::kPreferencesFilename); |
152 } | 152 } |
153 | 153 |
154 // static | 154 // static |
155 void ProfilePrefStoreManager::ResetAllPrefHashStores(PrefService* local_state) { | 155 void ProfilePrefStoreManager::ResetAllPrefHashStores(PrefService* local_state) { |
156 PrefServiceHashStoreContents::ResetAllPrefHashStores(local_state); | 156 PrefServiceHashStoreContents::ResetAllPrefHashStores(local_state); |
157 } | 157 } |
158 | 158 |
159 // static | 159 // static |
160 base::Time ProfilePrefStoreManager::GetResetTime(PrefService* pref_service) { | 160 base::Time ProfilePrefStoreManager::GetResetTime(PrefService* pref_service) { |
161 // It's a bit of a coincidence that this (and ClearResetTime) work(s). The | |
gab
2014/04/01 18:55:06
:( -- to avoid all of this madness how about we us
erikwright (departed)
2014/04/01 19:46:08
The current implementation is cleaner, easier to u
gab
2014/04/02 17:02:03
Okay, makes sense, I agree with you now that I und
| |
162 // PrefHashFilter attached to the protected pref store will store the reset | |
163 // time directly in the protected pref store without going through the | |
164 // SegregatedPrefStore. | |
165 | |
166 // PrefHashFilter::GetResetTime will read the value through the pref service, | |
167 // and thus through the SegregatedPrefStore. Even though it's not listed as | |
168 // "protected" it will be read from the protected store prefentially to the | |
gab
2014/04/01 18:55:06
s/prefentially/preferentially
| |
169 // (NULL) value in the unprotected pref store. | |
161 return PrefHashFilter::GetResetTime(pref_service); | 170 return PrefHashFilter::GetResetTime(pref_service); |
162 } | 171 } |
163 | 172 |
164 // static | 173 // static |
165 void ProfilePrefStoreManager::ClearResetTime(PrefService* pref_service) { | 174 void ProfilePrefStoreManager::ClearResetTime(PrefService* pref_service) { |
175 // PrefHashFilter::ClearResetTime will clear the value through the pref | |
176 // service, and thus through the SegregatedPrefStore. Since it's not listed as | |
177 // "protected" it will be migrated from the protected store to the unprotected | |
178 // pref store before being deleted from the latter. | |
166 PrefHashFilter::ClearResetTime(pref_service); | 179 PrefHashFilter::ClearResetTime(pref_service); |
167 } | 180 } |
168 | 181 |
169 void ProfilePrefStoreManager::ResetPrefHashStore() { | 182 void ProfilePrefStoreManager::ResetPrefHashStore() { |
170 if (kPlatformSupportsPreferenceTracking) | 183 if (kPlatformSupportsPreferenceTracking) |
171 GetPrefHashStoreImpl()->Reset(); | 184 GetPrefHashStoreImpl()->Reset(); |
172 } | 185 } |
173 | 186 |
174 PersistentPrefStore* ProfilePrefStoreManager::CreateProfilePrefStore( | 187 PersistentPrefStore* ProfilePrefStoreManager::CreateProfilePrefStore( |
175 const scoped_refptr<base::SequencedTaskRunner>& io_task_runner) { | 188 const scoped_refptr<base::SequencedTaskRunner>& io_task_runner) { |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
242 | 255 |
243 scoped_ptr<PrefHashStoreImpl> ProfilePrefStoreManager::GetPrefHashStoreImpl() { | 256 scoped_ptr<PrefHashStoreImpl> ProfilePrefStoreManager::GetPrefHashStoreImpl() { |
244 DCHECK(kPlatformSupportsPreferenceTracking); | 257 DCHECK(kPlatformSupportsPreferenceTracking); |
245 | 258 |
246 return make_scoped_ptr(new PrefHashStoreImpl( | 259 return make_scoped_ptr(new PrefHashStoreImpl( |
247 seed_, | 260 seed_, |
248 device_id_, | 261 device_id_, |
249 scoped_ptr<HashStoreContents>(new PrefServiceHashStoreContents( | 262 scoped_ptr<HashStoreContents>(new PrefServiceHashStoreContents( |
250 profile_path_.AsUTF8Unsafe(), local_state_)))); | 263 profile_path_.AsUTF8Unsafe(), local_state_)))); |
251 } | 264 } |
OLD | NEW |