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 98f85db941adbc593d951c97aaad3117be85cc6a..a7834f1dcb79013d9fd9feeb0dbedbc5b15643c5 100644 |
--- a/chrome/browser/prefs/profile_pref_store_manager.cc |
+++ b/chrome/browser/prefs/profile_pref_store_manager.cc |
@@ -16,6 +16,7 @@ |
#include "base/sequenced_task_runner.h" |
#include "build/build_config.h" |
#include "chrome/common/chrome_constants.h" |
+#include "chrome/common/chrome_features.h" |
#include "components/pref_registry/pref_registry_syncable.h" |
#include "components/prefs/json_pref_store.h" |
#include "components/prefs/persistent_pref_store.h" |
@@ -23,6 +24,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/persistent_pref_store_mojo.h" |
+#include "services/preferences/public/cpp/user_prefs_impl.h" |
#if defined(OS_WIN) |
#include "chrome/installer/util/browser_distribution.h" |
@@ -100,10 +103,34 @@ void ProfilePrefStoreManager::SetPreferenceValidationRegistryPathForTesting( |
#endif // OS_WIN |
PersistentPrefStore* ProfilePrefStoreManager::CreateProfilePrefStore( |
+ const scoped_refptr<base::SingleThreadTaskRunner>& pref_task_runner, |
const scoped_refptr<base::SequencedTaskRunner>& io_task_runner, |
const base::Closure& on_reset_on_load, |
- TrackedPreferenceValidationDelegate* validation_delegate) { |
- std::unique_ptr<PrefFilter> pref_filter; |
+ base::WeakPtr<TrackedPreferenceValidationDelegate> validation_delegate) { |
+ prefs::mojom::PersistentPrefStoreConnectorPtr connector; |
+ if (base::FeatureList::IsEnabled(features::kPrefService)) { |
+ if (!kPlatformSupportsPreferenceTracking) { |
+ prefs::CreateUserPrefs(profile_path_.Append(chrome::kPreferencesFilename), |
+ pref_task_runner, io_task_runner, |
+ mojo::MakeRequest(&connector)); |
+ } else { |
+ prefs::CreateSegregatedUserPrefs( |
+ profile_path_.Append(chrome::kPreferencesFilename), |
+ profile_path_.Append(chrome::kSecurePreferencesFilename), |
+ 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 |
+ : BrowserDistribution::GetDistribution()->GetRegistryPath(), |
+#else |
+ base::string16(), |
+#endif |
+ validation_delegate, on_reset_on_load, pref_task_runner, |
+ io_task_runner, mojo::MakeRequest(&connector)); |
+ } |
+ return new prefs::PersistentPrefStoreMojo(std::move(connector)); |
+ } |
if (!kPlatformSupportsPreferenceTracking) { |
return new JsonPrefStore(profile_path_.Append(chrome::kPreferencesFilename), |
io_task_runner.get(), |
@@ -130,13 +157,13 @@ PersistentPrefStore* ProfilePrefStoreManager::CreateProfilePrefStore( |
} |
std::unique_ptr<PrefHashFilter> unprotected_pref_hash_filter( |
- new PrefHashFilter(GetPrefHashStore(false), |
- GetExternalVerificationPrefHashStorePair(), |
- unprotected_configuration, base::Closure(), |
- validation_delegate, reporting_ids_count_, false)); |
+ new PrefHashFilter( |
+ GetPrefHashStore(false), GetExternalVerificationPrefHashStorePair(), |
+ unprotected_configuration, base::Closure(), validation_delegate.get(), |
+ reporting_ids_count_, false)); |
std::unique_ptr<PrefHashFilter> protected_pref_hash_filter(new PrefHashFilter( |
GetPrefHashStore(true), GetExternalVerificationPrefHashStorePair(), |
- protected_configuration, on_reset_on_load, validation_delegate, |
+ protected_configuration, on_reset_on_load, validation_delegate.get(), |
reporting_ids_count_, true)); |
PrefHashFilter* raw_unprotected_pref_hash_filter = |