Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Unified Diff: components/sync_preferences/pref_service_syncable_factory.cc

Issue 2767743003: Pref service: Merge connectors and send a PrefRegistry in Connect(). (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/prefs/profile_pref_store_manager_unittest.cc ('k') | services/preferences/manifest.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/sync_preferences/pref_service_syncable_factory.cc
diff --git a/components/sync_preferences/pref_service_syncable_factory.cc b/components/sync_preferences/pref_service_syncable_factory.cc
index 9e5989aa0a25a3ab6c66017eed0e5127e28669f4..ba3f40fd7b86273383395b1aef9cc5e0c9176725 100644
--- a/components/sync_preferences/pref_service_syncable_factory.cc
+++ b/components/sync_preferences/pref_service_syncable_factory.cc
@@ -11,6 +11,7 @@
#include "components/prefs/pref_notifier_impl.h"
#include "components/prefs/pref_value_store.h"
#include "components/sync_preferences/pref_service_syncable.h"
+#include "services/preferences/public/cpp/persistent_pref_store_client.h"
#include "services/preferences/public/cpp/pref_store_adapter.h"
#include "services/preferences/public/interfaces/preferences.mojom.h"
#include "services/service_manager/public/cpp/connector.h"
@@ -83,6 +84,14 @@ std::unique_ptr<PrefServiceSyncable> PrefServiceSyncableFactory::CreateSyncable(
TRACE_EVENT0("browser", "PrefServiceSyncableFactory::CreateSyncable");
PrefNotifierImpl* pref_notifier = new PrefNotifierImpl();
+ if (!user_prefs_) {
+ prefs::mojom::PrefStoreConnectorPtr pref_connector;
+ connector->BindInterface(prefs::mojom::kPrefStoreServiceName,
+ &pref_connector);
+ user_prefs_ = new prefs::PersistentPrefStoreClient(
+ std::move(pref_connector), make_scoped_refptr(pref_registry));
+ }
+
// Expose all read-only stores through the prefs service.
auto managed = CreateRegisteredPrefStore(connector, managed_prefs_,
PrefValueStore::MANAGED_STORE);
« no previous file with comments | « chrome/browser/prefs/profile_pref_store_manager_unittest.cc ('k') | services/preferences/manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698