Index: chrome/browser/prefs/profile_pref_store_manager.cc |
diff --git a/chrome/browser/prefs/profile_pref_store_manager.cc b/chrome/browser/prefs/profile_pref_store_manager.cc |
index 891e7be0844b4ae6ca38065342c3fe0ad4b4333d..29605bb20e047406bb869c87b3b096c9109f500b 100644 |
--- a/chrome/browser/prefs/profile_pref_store_manager.cc |
+++ b/chrome/browser/prefs/profile_pref_store_manager.cc |
@@ -23,6 +23,8 @@ |
#include "components/user_prefs/tracked/pref_hash_store_impl.h" |
#include "components/user_prefs/tracked/segregated_pref_store.h" |
#include "components/user_prefs/tracked/tracked_preferences_migration.h" |
+#include "services/preferences/public/cpp/tracked_persistent_pref_store_factory.h" |
+#include "services/preferences/public/interfaces/preferences_configuration.mojom.h" |
#if defined(OS_WIN) |
#include "chrome/install_static/install_util.h" |
@@ -31,14 +33,6 @@ |
namespace { |
-void RemoveValueSilently(const base::WeakPtr<JsonPrefStore> pref_store, |
- const std::string& key) { |
- if (pref_store) { |
- pref_store->RemoveValueSilently( |
- key, WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); |
- } |
-} |
- |
#if defined(OS_WIN) |
// Forces a different registry key to be used for storing preference validation |
// MACs. See |SetPreferenceValidationRegistryPathForTesting|. |
@@ -109,64 +103,18 @@ PersistentPrefStore* ProfilePrefStoreManager::CreateProfilePrefStore( |
io_task_runner.get(), |
std::unique_ptr<PrefFilter>()); |
} |
- |
- std::vector<PrefHashFilter::TrackedPreferenceMetadata> |
- unprotected_configuration; |
- std::vector<PrefHashFilter::TrackedPreferenceMetadata> |
- protected_configuration; |
- std::set<std::string> protected_pref_names; |
- std::set<std::string> unprotected_pref_names; |
- for (std::vector<PrefHashFilter::TrackedPreferenceMetadata>::const_iterator |
- it = tracking_configuration_.begin(); |
- it != tracking_configuration_.end(); |
- ++it) { |
- if (it->enforcement_level > PrefHashFilter::NO_ENFORCEMENT) { |
- protected_configuration.push_back(*it); |
- protected_pref_names.insert(it->name); |
- } else { |
- unprotected_configuration.push_back(*it); |
- unprotected_pref_names.insert(it->name); |
- } |
- } |
- |
- std::unique_ptr<PrefHashFilter> unprotected_pref_hash_filter( |
- new PrefHashFilter(GetPrefHashStore(false), |
- GetExternalVerificationPrefHashStorePair(), |
- unprotected_configuration, base::Closure(), |
- validation_delegate, reporting_ids_count_, false)); |
- std::unique_ptr<PrefHashFilter> protected_pref_hash_filter(new PrefHashFilter( |
- GetPrefHashStore(true), GetExternalVerificationPrefHashStorePair(), |
gab
2017/03/13 16:52:02
It's weird to drop usage of GetExternalVerificatio
Sam McNally
2017/03/14 02:01:35
In the longer term, the configuration will only be
|
- protected_configuration, on_reset_on_load, validation_delegate, |
- reporting_ids_count_, true)); |
- |
- PrefHashFilter* raw_unprotected_pref_hash_filter = |
- unprotected_pref_hash_filter.get(); |
- PrefHashFilter* raw_protected_pref_hash_filter = |
- protected_pref_hash_filter.get(); |
- |
- scoped_refptr<JsonPrefStore> unprotected_pref_store(new JsonPrefStore( |
- profile_path_.Append(chrome::kPreferencesFilename), io_task_runner.get(), |
- std::move(unprotected_pref_hash_filter))); |
- // TODO(gab): Remove kDeprecatedProtectedPreferencesFilename as an alternate |
gab
2017/03/13 16:52:01
Could you do this cleanup in a precursor CL (and a
Sam McNally
2017/03/14 02:01:35
https://codereview.chromium.org/2751603002/
|
- // file in M40+. |
- scoped_refptr<JsonPrefStore> protected_pref_store(new JsonPrefStore( |
+ return prefs::CreateTrackedPersistentPrefStore( |
+ io_task_runner, profile_path_.Append(chrome::kPreferencesFilename), |
profile_path_.Append(chrome::kSecurePreferencesFilename), |
- profile_path_.Append(chrome::kProtectedPreferencesFilenameDeprecated), |
- io_task_runner.get(), std::move(protected_pref_hash_filter))); |
- |
- SetupTrackedPreferencesMigration( |
- unprotected_pref_names, protected_pref_names, |
- base::Bind(&RemoveValueSilently, unprotected_pref_store->AsWeakPtr()), |
- base::Bind(&RemoveValueSilently, protected_pref_store->AsWeakPtr()), |
- base::Bind(&JsonPrefStore::RegisterOnNextSuccessfulWriteReply, |
- unprotected_pref_store->AsWeakPtr()), |
- base::Bind(&JsonPrefStore::RegisterOnNextSuccessfulWriteReply, |
- protected_pref_store->AsWeakPtr()), |
- GetPrefHashStore(false), GetPrefHashStore(true), |
- raw_unprotected_pref_hash_filter, raw_protected_pref_hash_filter); |
- |
- return new SegregatedPrefStore(unprotected_pref_store, protected_pref_store, |
- protected_pref_names); |
+ tracking_configuration_, reporting_ids_count_, seed_, legacy_device_id_, |
+#if defined(OS_WIN) |
+ g_preference_validation_registry_path_for_testing |
+ ? *g_preference_validation_registry_path_for_testing |
+ : install_static::GetRegistryPath(), |
+#else |
+ base::string16(), |
+#endif |
+ validation_delegate, on_reset_on_load); |
} |
bool ProfilePrefStoreManager::InitializePrefsFromMasterPrefs( |