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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
80 PrefHashFilter::ClearResetTime(pref_service); | 80 PrefHashFilter::ClearResetTime(pref_service); |
81 } | 81 } |
82 | 82 |
83 PersistentPrefStore* ProfilePrefStoreManager::CreateProfilePrefStore( | 83 PersistentPrefStore* ProfilePrefStoreManager::CreateProfilePrefStore( |
84 const scoped_refptr<base::SequencedTaskRunner>& io_task_runner, | 84 const scoped_refptr<base::SequencedTaskRunner>& io_task_runner, |
85 const base::Closure& on_reset_on_load, | 85 const base::Closure& on_reset_on_load, |
86 TrackedPreferenceValidationDelegate* validation_delegate) { | 86 TrackedPreferenceValidationDelegate* validation_delegate) { |
87 scoped_ptr<PrefFilter> pref_filter; | 87 scoped_ptr<PrefFilter> pref_filter; |
88 if (!kPlatformSupportsPreferenceTracking) { | 88 if (!kPlatformSupportsPreferenceTracking) { |
89 return new JsonPrefStore(GetPrefFilePathFromProfilePath(profile_path_), | 89 return new JsonPrefStore(GetPrefFilePathFromProfilePath(profile_path_), |
90 io_task_runner, | 90 io_task_runner.get(), |
gab
2014/08/26 19:29:56
JsonPrefStore's constructor should take a scoped_r
| |
91 scoped_ptr<PrefFilter>()); | 91 scoped_ptr<PrefFilter>()); |
92 } | 92 } |
93 | 93 |
94 std::vector<PrefHashFilter::TrackedPreferenceMetadata> | 94 std::vector<PrefHashFilter::TrackedPreferenceMetadata> |
95 unprotected_configuration; | 95 unprotected_configuration; |
96 std::vector<PrefHashFilter::TrackedPreferenceMetadata> | 96 std::vector<PrefHashFilter::TrackedPreferenceMetadata> |
97 protected_configuration; | 97 protected_configuration; |
98 std::set<std::string> protected_pref_names; | 98 std::set<std::string> protected_pref_names; |
99 std::set<std::string> unprotected_pref_names; | 99 std::set<std::string> unprotected_pref_names; |
100 for (std::vector<PrefHashFilter::TrackedPreferenceMetadata>::const_iterator | 100 for (std::vector<PrefHashFilter::TrackedPreferenceMetadata>::const_iterator |
(...skipping 24 matching lines...) Expand all Loading... | |
125 reporting_ids_count_, | 125 reporting_ids_count_, |
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, | 135 io_task_runner.get(), |
gab
2014/08/26 19:29:56
Same as above.
| |
136 unprotected_pref_hash_filter.PassAs<PrefFilter>())); | 136 unprotected_pref_hash_filter.PassAs<PrefFilter>())); |
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, | 142 io_task_runner.get(), |
gab
2014/08/26 19:29:56
Same as above.
| |
143 protected_pref_hash_filter.PassAs<PrefFilter>())); | 143 protected_pref_hash_filter.PassAs<PrefFilter>())); |
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, |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
213 profile_path_.AsUTF8Unsafe(), local_state_))); | 213 profile_path_.AsUTF8Unsafe(), local_state_))); |
214 pref_filter.reset( | 214 pref_filter.reset( |
215 new PrefHashFilter(pref_hash_store_impl.PassAs<PrefHashStore>(), | 215 new PrefHashFilter(pref_hash_store_impl.PassAs<PrefHashStore>(), |
216 tracking_configuration_, | 216 tracking_configuration_, |
217 base::Closure(), | 217 base::Closure(), |
218 NULL, | 218 NULL, |
219 reporting_ids_count_, | 219 reporting_ids_count_, |
220 false)); | 220 false)); |
221 } | 221 } |
222 return new JsonPrefStore(GetPrefFilePathFromProfilePath(profile_path_), | 222 return new JsonPrefStore(GetPrefFilePathFromProfilePath(profile_path_), |
223 io_task_runner, | 223 io_task_runner.get(), |
gab
2014/08/26 19:29:55
Same as above.
| |
224 pref_filter.Pass()); | 224 pref_filter.Pass()); |
225 } | 225 } |
226 | 226 |
227 scoped_ptr<PrefHashStore> ProfilePrefStoreManager::GetPrefHashStore( | 227 scoped_ptr<PrefHashStore> ProfilePrefStoreManager::GetPrefHashStore( |
228 bool use_super_mac) { | 228 bool use_super_mac) { |
229 DCHECK(kPlatformSupportsPreferenceTracking); | 229 DCHECK(kPlatformSupportsPreferenceTracking); |
230 | 230 |
231 return scoped_ptr<PrefHashStore>(new PrefHashStoreImpl( | 231 return scoped_ptr<PrefHashStore>(new PrefHashStoreImpl( |
232 seed_, | 232 seed_, |
233 device_id_, | 233 device_id_, |
234 use_super_mac)); | 234 use_super_mac)); |
235 } | 235 } |
OLD | NEW |