OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_SERVICE_MANAGER_PUBLIC_CPP_INTERFACE_REGISTRY_H_ | 5 #ifndef SERVICES_SERVICE_MANAGER_PUBLIC_CPP_INTERFACE_REGISTRY_H_ |
6 #define SERVICES_SERVICE_MANAGER_PUBLIC_CPP_INTERFACE_REGISTRY_H_ | 6 #define SERVICES_SERVICE_MANAGER_PUBLIC_CPP_INTERFACE_REGISTRY_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <memory> | 9 #include <memory> |
10 #include <queue> | 10 #include <queue> |
11 #include <set> | 11 #include <set> |
12 #include <utility> | 12 #include <utility> |
13 | 13 |
14 #include "base/callback.h" | 14 #include "base/callback.h" |
15 #include "base/memory/ptr_util.h" | 15 #include "base/memory/ptr_util.h" |
16 #include "mojo/public/cpp/bindings/binding.h" | 16 #include "mojo/public/cpp/bindings/binding.h" |
17 #include "services/service_manager/public/cpp/identity.h" | 17 #include "services/service_manager/public/cpp/identity.h" |
18 #include "services/service_manager/public/cpp/interface_provider_spec.h" | 18 #include "services/service_manager/public/cpp/interface_provider_spec.h" |
19 #include "services/service_manager/public/cpp/lib/callback_binder.h" | 19 #include "services/service_manager/public/cpp/lib/callback_binder.h" |
20 #include "services/service_manager/public/cpp/lib/interface_factory_binder.h" | 20 #include "services/service_manager/public/cpp/lib/interface_factory_binder.h" |
21 #include "services/service_manager/public/interfaces/interface_provider.mojom.h" | 21 #include "services/service_manager/public/interfaces/interface_provider.mojom.h" |
22 | 22 |
23 namespace service_manager { | 23 namespace service_manager { |
24 class Connection; | 24 class Connection; |
25 class InterfaceBinder; | 25 class InterfaceBinder; |
26 | 26 |
27 // Returns the set of capabilities required from the target. | |
28 CapabilitySet GetRequestedCapabilities(const InterfaceProviderSpec& source_spec, | |
29 const Identity& target); | |
30 | |
31 // Generates a single set of interfaces that is the union of all interfaces | |
32 // exposed by the target for the capabilities requested by the source. | |
33 InterfaceSet GetInterfacesToExpose(const InterfaceProviderSpec& source_spec, | |
34 const Identity& target, | |
35 const InterfaceProviderSpec& target_spec); | |
36 | |
37 // An implementation of mojom::InterfaceProvider that allows the user to | 27 // An implementation of mojom::InterfaceProvider that allows the user to |
38 // register services to be exposed to another application. | 28 // register services to be exposed to another application. |
39 // | 29 // |
40 // To use, define a class that implements your specific interface. Then | 30 // To use, define a class that implements your specific interface. Then |
41 // implement an InterfaceFactory<Foo> that binds instances of FooImpl to | 31 // implement an InterfaceFactory<Foo> that binds instances of FooImpl to |
42 // InterfaceRequest<Foo>s and register that on the registry like this: | 32 // InterfaceRequest<Foo>s and register that on the registry like this: |
43 // | 33 // |
44 // registry.AddInterface(&factory); | 34 // registry.AddInterface(&factory); |
45 // | 35 // |
46 // Or, if you have multiple factories implemented by the same type, explicitly | 36 // Or, if you have multiple factories implemented by the same type, explicitly |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 std::list<base::Closure> connection_lost_closures_; | 217 std::list<base::Closure> connection_lost_closures_; |
228 | 218 |
229 base::WeakPtrFactory<InterfaceRegistry> weak_factory_; | 219 base::WeakPtrFactory<InterfaceRegistry> weak_factory_; |
230 | 220 |
231 DISALLOW_COPY_AND_ASSIGN(InterfaceRegistry); | 221 DISALLOW_COPY_AND_ASSIGN(InterfaceRegistry); |
232 }; | 222 }; |
233 | 223 |
234 } // namespace service_manager | 224 } // namespace service_manager |
235 | 225 |
236 #endif // SERVICES_SERVICE_MANAGER_PUBLIC_CPP_INTERFACE_REGISTRY_H_ | 226 #endif // SERVICES_SERVICE_MANAGER_PUBLIC_CPP_INTERFACE_REGISTRY_H_ |
OLD | NEW |