OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/sync_preferences/pref_service_syncable_factory.h" | 5 #include "components/sync_preferences/pref_service_syncable_factory.h" |
6 | 6 |
7 #include "base/trace_event/trace_event.h" | 7 #include "base/trace_event/trace_event.h" |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 #include "components/pref_registry/pref_registry_syncable.h" | 9 #include "components/pref_registry/pref_registry_syncable.h" |
10 #include "components/prefs/default_pref_store.h" | 10 #include "components/prefs/default_pref_store.h" |
11 #include "components/prefs/pref_notifier_impl.h" | 11 #include "components/prefs/pref_notifier_impl.h" |
12 #include "components/prefs/pref_value_store.h" | 12 #include "components/prefs/pref_value_store.h" |
13 #include "components/sync_preferences/pref_service_syncable.h" | 13 #include "components/sync_preferences/pref_service_syncable.h" |
| 14 #include "services/preferences/public/cpp/persistent_pref_store_mojo.h" |
14 | 15 |
15 #if !defined(OS_IOS) | 16 #if !defined(OS_IOS) |
16 #include "components/policy/core/browser/browser_policy_connector.h" | 17 #include "components/policy/core/browser/browser_policy_connector.h" |
17 #include "components/policy/core/browser/configuration_policy_pref_store.h" | 18 #include "components/policy/core/browser/configuration_policy_pref_store.h" |
18 #include "components/policy/core/common/policy_service.h" // nogncheck | 19 #include "components/policy/core/common/policy_service.h" // nogncheck |
19 #include "components/policy/core/common/policy_types.h" // nogncheck | 20 #include "components/policy/core/common/policy_types.h" // nogncheck |
20 #endif | 21 #endif |
21 | 22 |
22 namespace sync_preferences { | 23 namespace sync_preferences { |
23 | 24 |
(...skipping 22 matching lines...) Expand all Loading... |
46 NOTREACHED(); | 47 NOTREACHED(); |
47 #endif | 48 #endif |
48 } | 49 } |
49 | 50 |
50 void PrefServiceSyncableFactory::SetPrefModelAssociatorClient( | 51 void PrefServiceSyncableFactory::SetPrefModelAssociatorClient( |
51 PrefModelAssociatorClient* pref_model_associator_client) { | 52 PrefModelAssociatorClient* pref_model_associator_client) { |
52 pref_model_associator_client_ = pref_model_associator_client; | 53 pref_model_associator_client_ = pref_model_associator_client; |
53 } | 54 } |
54 | 55 |
55 std::unique_ptr<PrefServiceSyncable> PrefServiceSyncableFactory::CreateSyncable( | 56 std::unique_ptr<PrefServiceSyncable> PrefServiceSyncableFactory::CreateSyncable( |
56 user_prefs::PrefRegistrySyncable* pref_registry) { | 57 user_prefs::PrefRegistrySyncable* pref_registry, |
| 58 prefs::mojom::PersistentPrefStoreConnectorPtr connector) { |
57 TRACE_EVENT0("browser", "PrefServiceSyncableFactory::CreateSyncable"); | 59 TRACE_EVENT0("browser", "PrefServiceSyncableFactory::CreateSyncable"); |
| 60 DCHECK(!connector || !user_prefs_); |
| 61 if (connector) |
| 62 user_prefs_ = new prefs::PersistentPrefStoreMojo(std::move(connector)); |
58 PrefNotifierImpl* pref_notifier = new PrefNotifierImpl(); | 63 PrefNotifierImpl* pref_notifier = new PrefNotifierImpl(); |
59 std::unique_ptr<PrefServiceSyncable> pref_service(new PrefServiceSyncable( | 64 std::unique_ptr<PrefServiceSyncable> pref_service(new PrefServiceSyncable( |
60 pref_notifier, | 65 pref_notifier, |
61 new PrefValueStore(managed_prefs_.get(), supervised_user_prefs_.get(), | 66 new PrefValueStore(managed_prefs_.get(), supervised_user_prefs_.get(), |
62 extension_prefs_.get(), command_line_prefs_.get(), | 67 extension_prefs_.get(), command_line_prefs_.get(), |
63 user_prefs_.get(), recommended_prefs_.get(), | 68 user_prefs_.get(), recommended_prefs_.get(), |
64 pref_registry->defaults().get(), pref_notifier), | 69 pref_registry->defaults().get(), pref_notifier), |
65 user_prefs_.get(), pref_registry, pref_model_associator_client_, | 70 user_prefs_.get(), pref_registry, pref_model_associator_client_, |
66 read_error_callback_, async_)); | 71 read_error_callback_, async_)); |
67 return pref_service; | 72 return pref_service; |
68 } | 73 } |
69 | 74 |
70 } // namespace sync_preferences | 75 } // namespace sync_preferences |
OLD | NEW |