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 mojo.shell.mojom; | 5 module mojo.shell.mojom; |
6 | 6 |
7 import "mojo/shell/public/interfaces/interface_provider.mojom"; | 7 import "mojo/shell/public/interfaces/interface_provider.mojom"; |
8 | 8 |
9 // Specifies a whitelist of applications and services an application can connect | 9 // Specifies a whitelist of applications and services an application can connect |
10 // to. Connections to applications not explicitly specified here as a key are | 10 // to. Connections to applications not explicitly specified here as a key are |
11 // rejected. Connections to services not specified in an application's allowed | 11 // rejected. Connections to services not specified in an application's allowed |
12 // interfaces value are not made. | 12 // interfaces value are not made. |
13 // A "*" value as the only key in an otherwise empty map means the application | 13 // A "*" value as the only key in an otherwise empty map means the application |
14 // may connect to any other application. | 14 // may connect to any other application. |
15 // A "*" value as the only string in an otherwise empty array of interface names | 15 // A "*" value as the only string in an otherwise empty array of interface names |
16 // means the application may connect to any service in that application. | 16 // means the application may connect to any service in that application. |
17 // An empty interface name array means the application may not connect to any | 17 // An empty interface name array means the application may not connect to any |
18 // services exposed by the application it is connecting to. | 18 // services exposed by the application it is connecting to. |
19 struct CapabilityFilter { | 19 struct CapabilityFilter { |
20 map<string, array<string>> filter; | 20 map<string, array<string>> filter; |
21 }; | 21 }; |
22 | 22 |
23 // An interface through which a Mojo application may communicate with the Mojo | 23 // Encapsulates establishing connections with other Mojo applications. |
24 // system and request connections to other applications. | 24 interface Connector { |
25 interface Shell { | |
26 const uint32 kInvalidApplicationID = 0; | 25 const uint32 kInvalidApplicationID = 0; |
27 const uint32 kUserRoot = 0; | 26 const uint32 kUserRoot = 0; |
28 const uint32 kUserInherit = 1; | 27 const uint32 kUserInherit = 1; |
29 | 28 |
30 // Requests a connection with another application. The application originating | 29 // Requests a connection with another application. The application originating |
31 // the request is referred to as the "source" and the one receiving the | 30 // the request is referred to as the "source" and the one receiving the |
32 // "target". | 31 // "target". |
33 // | 32 // |
34 // The connection is embodied by a pair of message pipes binding the | 33 // The connection is embodied by a pair of message pipes binding the |
35 // InterfaceProvider interface, which allows both the source and target | 34 // InterfaceProvider interface, which allows both the source and target |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 // Response: (application_id) | 75 // Response: (application_id) |
77 // The shell responds with a unique identifier for the instance that was | 76 // The shell responds with a unique identifier for the instance that was |
78 // connected to. | 77 // connected to. |
79 // | 78 // |
80 Connect(string url, | 79 Connect(string url, |
81 uint32 user_id, | 80 uint32 user_id, |
82 InterfaceProvider&? remote_interfaces, | 81 InterfaceProvider&? remote_interfaces, |
83 InterfaceProvider? local_interfaces, | 82 InterfaceProvider? local_interfaces, |
84 CapabilityFilter filter) => (uint32 application_id); | 83 CapabilityFilter filter) => (uint32 application_id); |
85 | 84 |
| 85 // Clones this Connector so it can be passed to another thread. |
| 86 Clone(Connector& request); |
| 87 }; |
| 88 |
| 89 // Wraps functionality exposed by the Shell to a Mojo application instance. |
| 90 interface Shell { |
| 91 // Obtain a Connector that can be used to create connections with other |
| 92 // applications. The connector is bound in the shell to the instance that |
| 93 // vended this Shell interface, all connectors created and cloned frmo this |
| 94 // one are bound to the lifetime of this instance. |
| 95 GetConnector(Connector& connector); |
| 96 |
86 // When there are no more instantiated services in an application, it should | 97 // When there are no more instantiated services in an application, it should |
87 // start its shutdown process by calling this method. Additionally, it should | 98 // start its shutdown process by calling this method. Additionally, it should |
88 // keep track of any new service requests that come in. The shell will then | 99 // keep track of any new service requests that come in. The shell will then |
89 // call Application::OnQuitRequested and start queueing new service requests. | 100 // call Application::OnQuitRequested and start queueing new service requests. |
90 // If the application didn't get any new service requests in the meantime, it | 101 // If the application didn't get any new service requests in the meantime, it |
91 // should call the callback with a true value. Otherwise it should call it | 102 // should call the callback with a true value. Otherwise it should call it |
92 // with false. | 103 // with false. |
93 QuitApplication(); | 104 QuitApplication(); |
94 }; | 105 }; |
OLD | NEW |