| 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/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/json/json_file_value_serializer.h" | 10 #include "base/json/json_file_value_serializer.h" |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 true)); | 126 true)); |
| 127 | 127 |
| 128 PrefHashFilter* raw_unprotected_pref_hash_filter = | 128 PrefHashFilter* raw_unprotected_pref_hash_filter = |
| 129 unprotected_pref_hash_filter.get(); | 129 unprotected_pref_hash_filter.get(); |
| 130 PrefHashFilter* raw_protected_pref_hash_filter = | 130 PrefHashFilter* raw_protected_pref_hash_filter = |
| 131 protected_pref_hash_filter.get(); | 131 protected_pref_hash_filter.get(); |
| 132 | 132 |
| 133 scoped_refptr<JsonPrefStore> unprotected_pref_store( | 133 scoped_refptr<JsonPrefStore> unprotected_pref_store( |
| 134 new JsonPrefStore(GetPrefFilePathFromProfilePath(profile_path_), | 134 new JsonPrefStore(GetPrefFilePathFromProfilePath(profile_path_), |
| 135 io_task_runner.get(), | 135 io_task_runner.get(), |
| 136 unprotected_pref_hash_filter.PassAs<PrefFilter>())); | 136 unprotected_pref_hash_filter.Pass())); |
| 137 // TODO(gab): Remove kDeprecatedProtectedPreferencesFilename as an alternate | 137 // TODO(gab): Remove kDeprecatedProtectedPreferencesFilename as an alternate |
| 138 // file in M40+. | 138 // file in M40+. |
| 139 scoped_refptr<JsonPrefStore> protected_pref_store(new JsonPrefStore( | 139 scoped_refptr<JsonPrefStore> protected_pref_store(new JsonPrefStore( |
| 140 profile_path_.Append(chrome::kSecurePreferencesFilename), | 140 profile_path_.Append(chrome::kSecurePreferencesFilename), |
| 141 profile_path_.Append(chrome::kProtectedPreferencesFilenameDeprecated), | 141 profile_path_.Append(chrome::kProtectedPreferencesFilenameDeprecated), |
| 142 io_task_runner.get(), | 142 io_task_runner.get(), |
| 143 protected_pref_hash_filter.PassAs<PrefFilter>())); | 143 protected_pref_hash_filter.Pass())); |
| 144 | 144 |
| 145 SetupTrackedPreferencesMigration( | 145 SetupTrackedPreferencesMigration( |
| 146 unprotected_pref_names, | 146 unprotected_pref_names, |
| 147 protected_pref_names, | 147 protected_pref_names, |
| 148 base::Bind(&JsonPrefStore::RemoveValueSilently, | 148 base::Bind(&JsonPrefStore::RemoveValueSilently, |
| 149 unprotected_pref_store->AsWeakPtr()), | 149 unprotected_pref_store->AsWeakPtr()), |
| 150 base::Bind(&JsonPrefStore::RemoveValueSilently, | 150 base::Bind(&JsonPrefStore::RemoveValueSilently, |
| 151 protected_pref_store->AsWeakPtr()), | 151 protected_pref_store->AsWeakPtr()), |
| 152 base::Bind(&JsonPrefStore::RegisterOnNextSuccessfulWriteCallback, | 152 base::Bind(&JsonPrefStore::RegisterOnNextSuccessfulWriteCallback, |
| 153 unprotected_pref_store->AsWeakPtr()), | 153 unprotected_pref_store->AsWeakPtr()), |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 PersistentPrefStore* | 204 PersistentPrefStore* |
| 205 ProfilePrefStoreManager::CreateDeprecatedCombinedProfilePrefStore( | 205 ProfilePrefStoreManager::CreateDeprecatedCombinedProfilePrefStore( |
| 206 const scoped_refptr<base::SequencedTaskRunner>& io_task_runner) { | 206 const scoped_refptr<base::SequencedTaskRunner>& io_task_runner) { |
| 207 scoped_ptr<PrefFilter> pref_filter; | 207 scoped_ptr<PrefFilter> pref_filter; |
| 208 if (kPlatformSupportsPreferenceTracking) { | 208 if (kPlatformSupportsPreferenceTracking) { |
| 209 scoped_ptr<PrefHashStoreImpl> pref_hash_store_impl( | 209 scoped_ptr<PrefHashStoreImpl> pref_hash_store_impl( |
| 210 new PrefHashStoreImpl(seed_, device_id_, true)); | 210 new PrefHashStoreImpl(seed_, device_id_, true)); |
| 211 pref_hash_store_impl->set_legacy_hash_store_contents( | 211 pref_hash_store_impl->set_legacy_hash_store_contents( |
| 212 scoped_ptr<HashStoreContents>(new PrefServiceHashStoreContents( | 212 scoped_ptr<HashStoreContents>(new PrefServiceHashStoreContents( |
| 213 profile_path_.AsUTF8Unsafe(), local_state_))); | 213 profile_path_.AsUTF8Unsafe(), local_state_))); |
| 214 pref_filter.reset( | 214 pref_filter.reset(new PrefHashFilter(pref_hash_store_impl.Pass(), |
| 215 new PrefHashFilter(pref_hash_store_impl.PassAs<PrefHashStore>(), | 215 tracking_configuration_, |
| 216 tracking_configuration_, | 216 base::Closure(), |
| 217 base::Closure(), | 217 NULL, |
| 218 NULL, | 218 reporting_ids_count_, |
| 219 reporting_ids_count_, | 219 false)); |
| 220 false)); | |
| 221 } | 220 } |
| 222 return new JsonPrefStore(GetPrefFilePathFromProfilePath(profile_path_), | 221 return new JsonPrefStore(GetPrefFilePathFromProfilePath(profile_path_), |
| 223 io_task_runner.get(), | 222 io_task_runner.get(), |
| 224 pref_filter.Pass()); | 223 pref_filter.Pass()); |
| 225 } | 224 } |
| 226 | 225 |
| 227 scoped_ptr<PrefHashStore> ProfilePrefStoreManager::GetPrefHashStore( | 226 scoped_ptr<PrefHashStore> ProfilePrefStoreManager::GetPrefHashStore( |
| 228 bool use_super_mac) { | 227 bool use_super_mac) { |
| 229 DCHECK(kPlatformSupportsPreferenceTracking); | 228 DCHECK(kPlatformSupportsPreferenceTracking); |
| 230 | 229 |
| 231 return scoped_ptr<PrefHashStore>(new PrefHashStoreImpl( | 230 return scoped_ptr<PrefHashStore>(new PrefHashStoreImpl( |
| 232 seed_, | 231 seed_, |
| 233 device_id_, | 232 device_id_, |
| 234 use_super_mac)); | 233 use_super_mac)); |
| 235 } | 234 } |
| OLD | NEW |