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 #ifndef COMPONENTS_SYNC_PREFERENCES_PREF_SERVICE_SYNCABLE_FACTORY_H_ | 5 #ifndef COMPONENTS_SYNC_PREFERENCES_PREF_SERVICE_SYNCABLE_FACTORY_H_ |
6 #define COMPONENTS_SYNC_PREFERENCES_PREF_SERVICE_SYNCABLE_FACTORY_H_ | 6 #define COMPONENTS_SYNC_PREFERENCES_PREF_SERVICE_SYNCABLE_FACTORY_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "components/prefs/pref_service_factory.h" | 11 #include "components/prefs/pref_service_factory.h" |
12 | 12 |
13 namespace policy { | 13 namespace policy { |
14 class BrowserPolicyConnector; | 14 class BrowserPolicyConnector; |
15 class PolicyService; | 15 class PolicyService; |
16 } | 16 } |
17 | 17 |
| 18 namespace service_manager { |
| 19 class Connector; |
| 20 } |
| 21 |
18 namespace user_prefs { | 22 namespace user_prefs { |
19 class PrefRegistrySyncable; | 23 class PrefRegistrySyncable; |
20 } | 24 } |
21 | 25 |
22 namespace sync_preferences { | 26 namespace sync_preferences { |
23 | 27 |
24 class PrefModelAssociatorClient; | 28 class PrefModelAssociatorClient; |
25 class PrefServiceSyncable; | 29 class PrefServiceSyncable; |
26 | 30 |
27 // A PrefServiceFactory that also knows how to build a | 31 // A PrefServiceFactory that also knows how to build a |
28 // PrefServiceSyncable, and may know about Chrome concepts such as | 32 // PrefServiceSyncable, and may know about Chrome concepts such as |
29 // PolicyService. | 33 // PolicyService. |
30 class PrefServiceSyncableFactory : public PrefServiceFactory { | 34 class PrefServiceSyncableFactory : public PrefServiceFactory { |
31 public: | 35 public: |
32 PrefServiceSyncableFactory(); | 36 PrefServiceSyncableFactory(); |
33 ~PrefServiceSyncableFactory() override; | 37 ~PrefServiceSyncableFactory() override; |
34 | 38 |
35 // Set up policy pref stores using the given policy service and connector. | 39 // Set up policy pref stores using the given policy service and connector. |
36 // These will assert when policy is not used. | 40 // These will assert when policy is not used. |
37 void SetManagedPolicies(policy::PolicyService* service, | 41 void SetManagedPolicies(policy::PolicyService* service, |
38 policy::BrowserPolicyConnector* connector); | 42 policy::BrowserPolicyConnector* connector); |
39 void SetRecommendedPolicies(policy::PolicyService* service, | 43 void SetRecommendedPolicies(policy::PolicyService* service, |
40 policy::BrowserPolicyConnector* connector); | 44 policy::BrowserPolicyConnector* connector); |
41 | 45 |
42 void SetPrefModelAssociatorClient( | 46 void SetPrefModelAssociatorClient( |
43 PrefModelAssociatorClient* pref_model_associator_client); | 47 PrefModelAssociatorClient* pref_model_associator_client); |
44 | 48 |
| 49 // |connector| might be null during test or if we're not using the Mojo pref |
| 50 // |service. |
45 std::unique_ptr<PrefServiceSyncable> CreateSyncable( | 51 std::unique_ptr<PrefServiceSyncable> CreateSyncable( |
46 user_prefs::PrefRegistrySyncable* registry); | 52 user_prefs::PrefRegistrySyncable* registry, |
| 53 service_manager::Connector* connector = nullptr); |
47 | 54 |
48 private: | 55 private: |
49 PrefModelAssociatorClient* pref_model_associator_client_; | 56 PrefModelAssociatorClient* pref_model_associator_client_; |
50 | 57 |
51 DISALLOW_COPY_AND_ASSIGN(PrefServiceSyncableFactory); | 58 DISALLOW_COPY_AND_ASSIGN(PrefServiceSyncableFactory); |
52 }; | 59 }; |
53 | 60 |
54 } // namespace sync_preferences | 61 } // namespace sync_preferences |
55 | 62 |
56 #endif // COMPONENTS_SYNC_PREFERENCES_PREF_SERVICE_SYNCABLE_FACTORY_H_ | 63 #endif // COMPONENTS_SYNC_PREFERENCES_PREF_SERVICE_SYNCABLE_FACTORY_H_ |
OLD | NEW |