OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 module service_manager.mojom; | 5 module service_manager.mojom; |
6 | 6 |
7 import "services/service_manager/public/interfaces/connector.mojom"; | 7 import "services/service_manager/public/interfaces/connector.mojom"; |
8 import "services/service_manager/public/interfaces/interface_provider.mojom"; | 8 import "services/service_manager/public/interfaces/interface_provider.mojom"; |
9 import "services/service_manager/public/interfaces/interface_provider_spec.mojom
"; | 9 import "services/service_manager/public/interfaces/interface_provider_spec.mojom
"; |
10 | 10 |
| 11 // Metadata describing an instance of a service. |
| 12 struct ServiceInfo { |
| 13 // The service's identity. |
| 14 Identity identity; |
| 15 |
| 16 // The service's interface provider specs, from its manifest. |
| 17 map<string, InterfaceProviderSpec> interface_provider_specs; |
| 18 }; |
| 19 |
11 // Implemented by any service which is known to the Service Manager, for which | 20 // Implemented by any service which is known to the Service Manager, for which |
12 // instances may be tracked. It allows the implementor to receive lifecycle | 21 // instances may be tracked. It allows the implementor to receive lifecycle |
13 // events and service inbound connection attempts. | 22 // events and service inbound connection attempts. |
14 interface Service { | 23 interface Service { |
15 // Called by the service manager once an instance for this service has been | 24 // Called by the service manager once an instance for this service has been |
16 // created. This method will be called exactly once before any other method is | 25 // created. This method will be called exactly once before any other method is |
17 // called. | 26 // called. |
18 // | 27 // |
19 // Parameters: | 28 // Parameters: |
20 // | 29 // |
21 // identity | 30 // identity |
22 // The identity of this instance in the service manager. Includes: | 31 // The identity of this instance in the service manager. Includes: |
23 // * The resolved name used in the connection request that resulted in this | 32 // * The resolved name used in the connection request that resulted in this |
24 // instance being initialized. | 33 // instance being initialized. |
25 // * The user associated with this instance in the service manager. This | 34 // * The user associated with this instance in the service manager. This |
26 // will never be kInheritUserID. | 35 // will never be kInheritUserID. |
27 // * The instance group this instance belongs to. | 36 // * The instance group this instance belongs to. |
28 // | 37 // |
29 // Response parameters: | 38 // Response parameters: |
30 // | 39 // |
31 // connector_request | 40 // connector_request |
32 // An optional Connector request for the service manager to bind, allowing | 41 // An optional Connector request for the service manager to bind, allowing |
33 // the initialized client to connect to others. | 42 // the initialized client to connect to others. |
34 // | 43 // |
35 OnStart(Identity identity) => (Connector&? connector_request); | 44 OnStart(ServiceInfo info) => (Connector&? connector_request); |
36 | 45 |
37 // Called when another service attempts to open a connection to this | 46 // Called when another service attempts to open a connection to this |
38 // service. A service implements this method to complete the exchange | 47 // service. A service implements this method to complete the exchange |
39 // of interface implementations with the remote service. See also | 48 // of interface implementations with the remote service. See also |
40 // documentation in service_manager.mojom for Connect(). The service | 49 // documentation in service_manager.mojom for Connect(). The service |
41 // originating the request is referred to as the "source" and the one | 50 // originating the request is referred to as the "source" and the one |
42 // receiving the "target". | 51 // receiving the "target". |
43 // | 52 // |
44 // Parameters: | 53 // Parameters: |
45 // | 54 // |
46 // source | 55 // source_info |
47 // The identity of the instance originating the connection. | 56 // Contains the source identity and interface provider specs. |
48 // | 57 // |
49 // interfaces | 58 // interfaces |
50 // A request for an InterfaceProvider by which the source service may | 59 // A request for an InterfaceProvider by which the source service may |
51 // seek to bind interface implementations exported by the target. | 60 // seek to bind interface implementations exported by the target. |
52 // | 61 // |
53 // required_interfaces | 62 // required_interfaces |
54 // A whitelist of interface names that should be made available to the | 63 // A whitelist of interface names that should be made available to the |
55 // source that initiated the connection, in accordance to policy described | 64 // source that initiated the connection, in accordance to policy described |
56 // in the source & target's service manifests. Attempts to bind interfaces | 65 // in the source & target's service manifests. Attempts to bind interfaces |
57 // not in this whitelist must not be fulfilled. | 66 // not in this whitelist must not be fulfilled. |
58 // | 67 // |
59 // required_capabilities | 68 // required_capabilities |
60 // A set of the capability names required by the source initiating the | 69 // A set of the capability names required by the source initiating the |
61 // connection. |required_interfaces| controls interface binding, so this | 70 // connection. |required_interfaces| controls interface binding, so this |
62 // is useful mostly if the target wishes to control behavior based on the | 71 // is useful mostly if the target wishes to control behavior based on the |
63 // presence of a value in this set. | 72 // presence of a value in this set. |
64 // | 73 // |
65 OnConnect(Identity source, | 74 OnConnect(ServiceInfo source_info, |
66 InterfaceProvider&? interfaces, | 75 InterfaceProvider&? interfaces, |
67 InterfaceSet required_interfaces, | 76 InterfaceSet required_interfaces, |
68 CapabilitySet required_capabilities); | 77 CapabilitySet required_capabilities); |
69 }; | 78 }; |
OLD | NEW |