| 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 import "services/service_manager/public/interfaces/service_control.mojom"; | 10 import "services/service_manager/public/interfaces/service_control.mojom"; |
| 11 | 11 |
| 12 // Metadata describing an instance of a service. | 12 // Metadata describing an instance of a service that originated a call to |
| 13 struct ServiceInfo { | 13 // BindInterface(). |
| 14 struct BindSourceInfo { |
| 14 // The service's identity. | 15 // The service's identity. |
| 15 Identity identity; | 16 Identity identity; |
| 16 | 17 |
| 17 // The service's interface provider specs, from its manifest. | 18 // An array of the capabilities exposed by the target that are required by the |
| 18 map<string, InterfaceProviderSpec> interface_provider_specs; | 19 // source. |
| 20 CapabilitySet required_capabilities; |
| 19 }; | 21 }; |
| 20 | 22 |
| 21 // Implemented by any service which is known to the Service Manager, for which | 23 // Implemented by any service which is known to the Service Manager, for which |
| 22 // instances may be tracked. It allows the implementor to receive lifecycle | 24 // instances may be tracked. It allows the implementor to receive lifecycle |
| 23 // events and service inbound connection attempts. | 25 // events and service inbound connection attempts. |
| 24 interface Service { | 26 interface Service { |
| 25 // Called by the service manager once an instance for this service has been | 27 // Called by the service manager once an instance for this service has been |
| 26 // created. This method will be called exactly once before any other method is | 28 // created. This method will be called exactly once before any other method is |
| 27 // called. | 29 // called. |
| 28 // | 30 // |
| 29 // Parameters: | 31 // Parameters: |
| 30 // | 32 // |
| 31 // identity | 33 // identity |
| 32 // The identity of this instance in the service manager. Includes: | 34 // The identity of this instance in the service manager. Includes: |
| 33 // * The resolved name used in the connection request that resulted in this | 35 // * The resolved name used in the connection request that resulted in this |
| 34 // instance being initialized. | 36 // instance being initialized. |
| 35 // * The user associated with this instance in the service manager. This | 37 // * The user associated with this instance in the service manager. This |
| 36 // will never be kInheritUserID. | 38 // will never be kInheritUserID. |
| 37 // * The instance group this instance belongs to. | 39 // * The instance group this instance belongs to. |
| 38 // | 40 // |
| 39 // Response parameters: | 41 // Response parameters: |
| 40 // | 42 // |
| 41 // connector_request | 43 // connector_request |
| 42 // An optional Connector request for the service manager to bind, allowing | 44 // An optional Connector request for the service manager to bind, allowing |
| 43 // the initialized client to connect to others. | 45 // the initialized client to connect to others. |
| 44 // | 46 // |
| 45 // control_request | 47 // control_request |
| 46 // An optional associated ServiceControl request. | 48 // An optional associated ServiceControl request. |
| 47 // | 49 // |
| 48 OnStart(ServiceInfo info) => (Connector&? connector_request, | 50 OnStart(Identity identity) => (Connector&? connector_request, |
| 49 associated ServiceControl&? control_request); | 51 associated ServiceControl&? control_request); |
| 50 | 52 |
| 51 // Called when a request to bind an interface is received from another | 53 // Called when a request to bind an interface is received from another |
| 52 // ("source") service. This is the result of that service calling | 54 // ("source") service. This is the result of that service calling |
| 53 // BindInterface() on a Connector. By the time this method is called, the | 55 // BindInterface() on a Connector. By the time this method is called, the |
| 54 // service manager has already completed a policy check to determine that this | 56 // service manager has already completed a policy check to determine that this |
| 55 // interface can be bound. | 57 // interface can be bound. |
| 56 // | 58 // |
| 57 // The Service must respond to acknowledge receipt of the request. | 59 // The Service must respond to acknowledge receipt of the request. |
| 58 // | 60 // |
| 59 // Parameters: | 61 // Parameters: |
| 60 // | 62 // |
| 61 // source_info | 63 // source |
| 62 // Contains the source identity and interface provider specs. | 64 // Contains information about the source of the request. |
| 63 // | 65 // |
| 64 // interface_name | 66 // interface_name |
| 65 // The name of the interface to be bound. | 67 // The name of the interface to be bound. |
| 66 // | 68 // |
| 67 // interface_pipe | 69 // interface_pipe |
| 68 // The message pipe to bind the interface implementation to. | 70 // The message pipe to bind the interface implementation to. |
| 69 // | 71 // |
| 70 // TODO(beng): It occurs to me that |source_info| leaks all metadata about | 72 OnBindInterface(BindSourceInfo source, |
| 71 // the source's capability requirements to the target. This seems | |
| 72 // undesirable. The metadata supplied here should be germane to | |
| 73 // fulfilling this request and no more. | |
| 74 OnBindInterface(ServiceInfo source_info, | |
| 75 string interface_name, | 73 string interface_name, |
| 76 handle<message_pipe> interface_pipe) => (); | 74 handle<message_pipe> interface_pipe) => (); |
| 77 }; | 75 }; |
| OLD | NEW |