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