OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 SERVICES_PREFERENCES_PREF_STORE_MANAGER_IMPL_H_ | 5 #ifndef SERVICES_PREFERENCES_PREF_STORE_MANAGER_IMPL_H_ |
6 #define SERVICES_PREFERENCES_PREF_STORE_MANAGER_IMPL_H_ | 6 #define SERVICES_PREFERENCES_PREF_STORE_MANAGER_IMPL_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <set> | 9 #include <set> |
10 #include <unordered_map> | 10 #include <unordered_map> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
16 #include "components/prefs/pref_value_store.h" | 16 #include "components/prefs/pref_value_store.h" |
17 #include "mojo/public/cpp/bindings/binding_set.h" | 17 #include "mojo/public/cpp/bindings/binding_set.h" |
18 #include "services/preferences/public/interfaces/preferences.mojom.h" | 18 #include "services/preferences/public/interfaces/preferences.mojom.h" |
| 19 #include "services/service_manager/public/cpp/binder_registry.h" |
19 #include "services/service_manager/public/cpp/interface_factory.h" | 20 #include "services/service_manager/public/cpp/interface_factory.h" |
20 #include "services/service_manager/public/cpp/service.h" | 21 #include "services/service_manager/public/cpp/service.h" |
21 | 22 |
22 class DefaultPrefStore; | 23 class DefaultPrefStore; |
23 | 24 |
24 namespace base { | 25 namespace base { |
25 class SequencedWorkerPool; | 26 class SequencedWorkerPool; |
26 } | 27 } |
27 | 28 |
28 namespace prefs { | 29 namespace prefs { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 | 78 |
78 // service_manager::InterfaceFactory<PrefServiceControl>: | 79 // service_manager::InterfaceFactory<PrefServiceControl>: |
79 void Create(const service_manager::Identity& remote_identity, | 80 void Create(const service_manager::Identity& remote_identity, |
80 prefs::mojom::PrefServiceControlRequest request) override; | 81 prefs::mojom::PrefServiceControlRequest request) override; |
81 | 82 |
82 // PrefServiceControl: | 83 // PrefServiceControl: |
83 void Init(mojom::PersistentPrefStoreConfigurationPtr configuration) override; | 84 void Init(mojom::PersistentPrefStoreConfigurationPtr configuration) override; |
84 | 85 |
85 // service_manager::Service: | 86 // service_manager::Service: |
86 void OnStart() override; | 87 void OnStart() override; |
87 bool OnConnect(const service_manager::ServiceInfo& remote_info, | 88 void OnBindInterface(const service_manager::ServiceInfo& source_info, |
88 service_manager::InterfaceRegistry* registry) override; | 89 const std::string& interface_name, |
| 90 mojo::ScopedMessagePipeHandle interface_pipe) override; |
89 | 91 |
90 // Called when a PrefStore previously registered using |Register| disconnects. | 92 // Called when a PrefStore previously registered using |Register| disconnects. |
91 void OnPrefStoreDisconnect(PrefValueStore::PrefStoreType type); | 93 void OnPrefStoreDisconnect(PrefValueStore::PrefStoreType type); |
92 | 94 |
93 // Have all the expected PrefStores connected? | 95 // Have all the expected PrefStores connected? |
94 bool AllConnected() const; | 96 bool AllConnected() const; |
95 | 97 |
96 void ProcessPendingConnects(); | 98 void ProcessPendingConnects(); |
97 | 99 |
98 void ConnectImpl( | 100 void ConnectImpl( |
(...skipping 18 matching lines...) Expand all Loading... |
117 mojo::BindingSet<mojom::PrefStoreConnector> connector_bindings_; | 119 mojo::BindingSet<mojom::PrefStoreConnector> connector_bindings_; |
118 mojo::BindingSet<mojom::PrefStoreRegistry> registry_bindings_; | 120 mojo::BindingSet<mojom::PrefStoreRegistry> registry_bindings_; |
119 std::unique_ptr<PersistentPrefStoreImpl> persistent_pref_store_; | 121 std::unique_ptr<PersistentPrefStoreImpl> persistent_pref_store_; |
120 mojo::Binding<mojom::PrefServiceControl> init_binding_; | 122 mojo::Binding<mojom::PrefServiceControl> init_binding_; |
121 | 123 |
122 const scoped_refptr<DefaultPrefStore> defaults_; | 124 const scoped_refptr<DefaultPrefStore> defaults_; |
123 const std::unique_ptr<PrefStoreImpl> defaults_wrapper_; | 125 const std::unique_ptr<PrefStoreImpl> defaults_wrapper_; |
124 | 126 |
125 const scoped_refptr<base::SequencedWorkerPool> worker_pool_; | 127 const scoped_refptr<base::SequencedWorkerPool> worker_pool_; |
126 | 128 |
| 129 service_manager::BinderRegistry registry_; |
| 130 |
127 DISALLOW_COPY_AND_ASSIGN(PrefStoreManagerImpl); | 131 DISALLOW_COPY_AND_ASSIGN(PrefStoreManagerImpl); |
128 }; | 132 }; |
129 | 133 |
130 } // namespace prefs | 134 } // namespace prefs |
131 | 135 |
132 #endif // SERVICES_PREFERENCES_PREF_STORE_MANAGER_IMPL_H_ | 136 #endif // SERVICES_PREFERENCES_PREF_STORE_MANAGER_IMPL_H_ |
OLD | NEW |