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 25569b6db1bc4837f09d9c7f44bccf6e026bdccb..32f3c077e72a36b3692f14883cb3dcf66ae45b06 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,9 @@ |
#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 "mojo/public/cpp/bindings/strong_binding.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 +104,42 @@ 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, |
- prefs::mojom::TrackedPreferenceValidationDelegate* validation_delegate) { |
- std::unique_ptr<PrefFilter> pref_filter; |
+ std::unique_ptr<prefs::mojom::TrackedPreferenceValidationDelegate>* |
+ validation_delegate) { |
+ DCHECK(validation_delegate); |
tibell
2017/03/08 03:39:54
Split this whole block out into a CreateProfilePre
|
+ 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::mojom::TrackedPreferenceValidationDelegatePtr |
+ validation_delegate_ptr; |
+ if (*validation_delegate) { |
+ mojo::MakeStrongBinding(std::move(*validation_delegate), |
+ mojo::MakeRequest(&validation_delegate_ptr)); |
+ } |
+ 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 |
+ std::move(validation_delegate_ptr), 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 +166,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 = |