OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 [DartPackage="mojo", JavaPackage="org.chromium.mojo.bindings"] | 5 [DartPackage="mojo", |
| 6 JavaPackage="org.chromium.mojo.bindings"] |
6 // TODO(rudominer) Move this file into the module mojo.bindings when | 7 // TODO(rudominer) Move this file into the module mojo.bindings when |
7 // https://github.com/domokit/mojo/issues/435 is fixed. | 8 // https://github.com/domokit/mojo/issues/435 is fixed. |
8 module mojo.bindings.types; | 9 module mojo.bindings.types; |
9 | 10 |
10 import "mojom_types.mojom"; | 11 import "mojom_types.mojom"; |
11 | 12 |
12 // This is a companion interface to ServiceProvider. An implementation of | 13 // This is a companion interface to ServiceProvider. An implementation of |
13 // ServiceProvider may optionally offer descriptions of the services it | 14 // ServiceProvider may optionally offer descriptions of the services it |
14 // provides by making this interface available. A client obtains access | 15 // provides by making this interface available. A client obtains access |
15 // to a ServiceDescriber service by invoking | 16 // to a ServiceDescriber service by invoking |
16 // ServiceProvider.ConnectToService(SERVICE_DESCRIBER_INTERFACE_NAME, pipe). | 17 // ServiceProvider.ConnectToService(SERVICE_DESCRIBER_INTERFACE_NAME, pipe). |
17 [ServiceName="mojo::bindings::types::ServiceDescriber"] | 18 [ServiceName="mojo::bindings::types::ServiceDescriber"] |
18 interface ServiceDescriber { | 19 interface ServiceDescriber { |
19 // Requests access to a ServiceDescription for the service with the | 20 // Requests access to a ServiceDescription for the service with the |
20 // given name. The |interface_name| is the same string that would be passed | 21 // given name. The |interface_name| is the same string that would be passed |
21 // to ServiceProvider.ConnectToService() in order to request the service | 22 // to ServiceProvider.ConnectToService() in order to request the service |
22 // with the given name. If the host is not willing or able to describe the | 23 // with the given name. If the host is not willing or able to describe the |
23 // service with the given name it will close the |description_request| pipe. | 24 // service with the given name it will close the |description_request| pipe. |
24 DescribeService(string interface_name, | 25 DescribeService(string interface_name, |
25 ServiceDescription& description_request); | 26 ServiceDescription& description_request); |
26 }; | 27 }; |
27 | 28 |
28 // A ServiceDescription allows a client to request information about the Mojom | 29 // A ServiceDescription allows a client to request information about the Mojom |
29 // types used to implement a particular Mojo service. | 30 // types used to implement a particular Mojo service. |
30 // | 31 // |
31 // A Mojo service has a *top-level* interface: the interface that is bound to | 32 // A Mojo service has a *top-level* interface: the interface that is bound to |
32 // the message pipe |pipe| as a result of calling | 33 // the message pipe |pipe| as a result of calling |
33 // ServiceProvider.ConnectToService(). | 34 // ServiceProvider.ConnectToService(). |
34 // | 35 // |
35 // The *complete type set* of a Mojo service is the closure of this top-level | 36 // The *complete type set* of a Mojo service is the closure of this top-level |
36 // interface under type reference. That is, the complete type set includes all | 37 // interface under type reference. That is, the complete type set includes all |
37 // of the types referenced directly in the definition of the top-level interface | 38 // of the types referenced directly in the definition of the top-level interface |
38 // and the types referenced by those types etc. The complete type set of a Mojo | 39 // and the types referenced by those types etc. The complete type set of a Mojo |
39 // service may include other interfaces besides the top-level interface. | 40 // service may include other interfaces besides the top-level interface. |
40 // | 41 // |
41 // An implementation of ServiceDescription contains information about all | 42 // An implementation of ServiceDescription contains information about all |
42 // of the types in the complete type set of the service. | 43 // of the types in the complete type set of the service. |
43 interface ServiceDescription { | 44 interface ServiceDescription { |
44 // Returns a MojomInterface for the top-level interface of this service. | 45 // Returns a MojomInterface for the top-level interface of this service. |
45 GetTopLevelInterface() => (MojomInterface mojomInterface); | 46 GetTopLevelInterface() => (MojomInterface mojomInterface); |
46 | 47 |
47 // Returns the |UserDefinedType| for the given |type_key|. Valid keys are | 48 // Returns the |UserDefinedType| for the given |type_key|. Valid keys are |
48 // those that are embedded in the structures returned from earlier queries | 49 // those that are embedded in the structures returned from earlier queries |
49 // of this ServiceDescription. If the key is invalid then |type| will be null. | 50 // of this ServiceDescription. If the key is invalid then |type| will be null. |
50 GetTypeDefinition(string type_key) => | 51 GetTypeDefinition(string type_key) |
51 (mojo.bindings.types.UserDefinedType? type); | 52 => (mojo.bindings.types.UserDefinedType? type); |
52 | 53 |
53 // Returns all the data queryable via GetTypeDefinition in a single | 54 // Returns all the data queryable via GetTypeDefinition in a single |
54 // structure, or null if the implementation is not willing or not able to | 55 // structure, or null if the implementation is not willing or not able to |
55 // provide all of the data at once. | 56 // provide all of the data at once. |
56 GetAllTypeDefinitions() => (map<string, UserDefinedType>? definitions); | 57 GetAllTypeDefinitions() => (map<string, UserDefinedType>? definitions); |
57 }; | 58 }; |
OLD | NEW |