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 const string kRootUserID = "505C0EE9-3013-43C0-82B0-A84F50CF8D84"; | 9 const string kRootUserID = "505C0EE9-3013-43C0-82B0-A84F50CF8D84"; |
10 const string kInheritUserID = "D26290E4-4485-4EAE-81A2-66D1EEB40A9D"; | 10 const string kInheritUserID = "D26290E4-4485-4EAE-81A2-66D1EEB40A9D"; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 // kInheritUserID. | 50 // kInheritUserID. |
51 string user_id; | 51 string user_id; |
52 | 52 |
53 // An application may spawn multiple instances with the same name,user_id | 53 // An application may spawn multiple instances with the same name,user_id |
54 // pair, provided they are started with unique values of this field. | 54 // pair, provided they are started with unique values of this field. |
55 // TODO(beng): enforce the emptiness of this parameter unless the client bears | 55 // TODO(beng): enforce the emptiness of this parameter unless the client bears |
56 // the appropriate capability. | 56 // the appropriate capability. |
57 string instance; | 57 string instance; |
58 }; | 58 }; |
59 | 59 |
| 60 // Implemented by an object in the shell associated with a specific instance. |
| 61 // Tells it the PID for a process launched by the client. See |
| 62 // ClientProcessConnection. |
| 63 interface PIDReceiver { |
| 64 SetPID(uint32 pid); |
| 65 }; |
| 66 |
| 67 // Typically, the shell will start a process for a service the first time it |
| 68 // receives a connection request for it. This struct allows a client to start |
| 69 // the process itself and provide the shell the pipes it needs to communicate |
| 70 // with it. When an instance of this struct is supplied to Connect(), the client |
| 71 // owns the lifetime of the child process, not the shell. The shell binds the |
| 72 // |shell_client_factory| pipe, and when it closes destroys the associated |
| 73 // instance but the process stays alive. |
| 74 struct ClientProcessConnection { |
| 75 // Provides the shell the ability to bind a ShellClientRequest from the client |
| 76 // process to the instance it creates. |
| 77 handle<message_pipe> shell_client_factory; |
| 78 |
| 79 // Allows the client process launcher to tell the shell the PID of the process |
| 80 // it created (the pid isn't supplied directly here as the process may not |
| 81 // have been launched by the time Connect() is called.) |
| 82 handle<message_pipe> pid_receiver_request; |
| 83 }; |
| 84 |
60 // Encapsulates establishing connections with other Mojo applications. | 85 // Encapsulates establishing connections with other Mojo applications. |
61 interface Connector { | 86 interface Connector { |
62 // Requests a connection with another application. The application originating | 87 // Requests a connection with another application. The application originating |
63 // the request is referred to as the "source" and the one receiving the | 88 // the request is referred to as the "source" and the one receiving the |
64 // "target". | 89 // "target". |
65 // | 90 // |
66 // The connection is embodied by a pair of message pipes binding the | 91 // The connection is embodied by a pair of message pipes binding the |
67 // InterfaceProvider interface, which allows both the source and target | 92 // InterfaceProvider interface, which allows both the source and target |
68 // applications to export interfaces to one another. The interfaces bound via | 93 // applications to export interfaces to one another. The interfaces bound via |
69 // these InterfaceProviders are brokered by the shell according to the | 94 // these InterfaceProviders are brokered by the shell according to the |
(...skipping 12 matching lines...) Expand all Loading... |
82 // exposed by the target application. The interfaces accessible via this | 107 // exposed by the target application. The interfaces accessible via this |
83 // InterfaceParameter are filtered by the security policy described by the | 108 // InterfaceParameter are filtered by the security policy described by the |
84 // source and target application manifests. | 109 // source and target application manifests. |
85 // | 110 // |
86 // local_interfaces | 111 // local_interfaces |
87 // Allows the remote application access to interface implementations | 112 // Allows the remote application access to interface implementations |
88 // exposed by the source application. The interfaces accessible via this | 113 // exposed by the source application. The interfaces accessible via this |
89 // InterfaceProvider are filtered by the security policy described by the | 114 // InterfaceProvider are filtered by the security policy described by the |
90 // source and target application manifests. | 115 // source and target application manifests. |
91 // | 116 // |
| 117 // client_process_connection |
| 118 // When non-null, supplies control pipes the shell can use to bind a |
| 119 // process created by the client, instead of creating one itself. |
| 120 // TODO(beng): access to this parameter should be restricted by a |
| 121 // capability. |
| 122 // |
92 // Response parameters: | 123 // Response parameters: |
93 // | 124 // |
94 // result | 125 // result |
95 // Indicates the result of the Connect() operation. | 126 // Indicates the result of the Connect() operation. |
96 // | 127 // |
97 // user_id | 128 // user_id |
98 // The user id the shell ran the target application as. Typically a client | 129 // The user id the shell ran the target application as. Typically a client |
99 // passes kInheritUserID as the user id to Connect() which is resolved by | 130 // passes kInheritUserID as the user id to Connect() which is resolved by |
100 // the shell into a valid user id returned through this callback. | 131 // the shell into a valid user id returned through this callback. |
101 // | 132 // |
102 // application_id | 133 // application_id |
103 // A unique identifier for the instance that was connected to. | 134 // A unique identifier for the instance that was connected to. |
104 // | 135 // |
105 Connect(Identity target, | 136 Connect(Identity target, |
106 InterfaceProvider&? remote_interfaces, | 137 InterfaceProvider&? remote_interfaces, |
107 InterfaceProvider? local_interfaces) => (ConnectResult result, | 138 InterfaceProvider? local_interfaces, |
108 string user_id, | 139 ClientProcessConnection? client_process_connection) => |
109 uint32 application_id); | 140 (ConnectResult result, string user_id, uint32 application_id); |
110 | 141 |
111 // Clones this Connector so it can be passed to another thread. | 142 // Clones this Connector so it can be passed to another thread. |
112 Clone(Connector& request); | 143 Clone(Connector& request); |
113 }; | 144 }; |
OLD | NEW |