| 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"; |
| 10 const string kInheritUserID = "D26290E4-4485-4EAE-81A2-66D1EEB40A9D"; |
| 11 |
| 9 // Encapsulates establishing connections with other Mojo applications. | 12 // Encapsulates establishing connections with other Mojo applications. |
| 10 interface Connector { | 13 interface Connector { |
| 11 const uint32 kInvalidApplicationID = 0; | 14 const uint32 kInvalidApplicationID = 0; |
| 12 const uint32 kUserRoot = 0; | |
| 13 const uint32 kUserInherit = 1; | |
| 14 | 15 |
| 15 // Requests a connection with another application. The application originating | 16 // Requests a connection with another application. The application originating |
| 16 // the request is referred to as the "source" and the one receiving the | 17 // the request is referred to as the "source" and the one receiving the |
| 17 // "target". | 18 // "target". |
| 18 // | 19 // |
| 19 // The connection is embodied by a pair of message pipes binding the | 20 // The connection is embodied by a pair of message pipes binding the |
| 20 // InterfaceProvider interface, which allows both the source and target | 21 // InterfaceProvider interface, which allows both the source and target |
| 21 // applications to export interfaces to one another. The interfaces bound via | 22 // applications to export interfaces to one another. The interfaces bound via |
| 22 // these InterfaceProviders are brokered by the shell according to the | 23 // these InterfaceProviders are brokered by the shell according to the |
| 23 // security policy defined by each application in its manifest . | 24 // security policy defined by each application in its manifest . |
| 24 // | 25 // |
| 25 // If the target application is not running, the shell will run it, calling | 26 // If the target application is not running, the shell will run it, calling |
| 26 // its Initialize() method before completing the connection. | 27 // its Initialize() method before completing the connection. |
| 27 // | 28 // |
| 28 // Parameters: | 29 // Parameters: |
| 29 // | 30 // |
| 30 // name | 31 // name |
| 31 // A mojo: or exe: name identifying the target application. | 32 // A mojo: or exe: name identifying the target application. |
| 32 // | 33 // |
| 33 // user_id | 34 // user_id |
| 34 // The user id of the target application instance to connect to. If no such | 35 // The user id of the target application instance to connect to. If no such |
| 35 // instance exists, the shell may start one. This user id will be passed | 36 // instance exists, the shell may start one. This user id will be passed |
| 36 // to the new instance via Initialize(). Applications must generally set | 37 // to the new instance via Initialize(). Applications must generally pass |
| 37 // this to kUserInherit, and the shell will either connect to an existing | 38 // kInheritUserID for this value, and the shell will either connect to an |
| 38 // instance matching the caller's user id, create a new instance matching | 39 // existing instance matching the caller's user id, create a new instance |
| 39 // the caller's user id, or connect to an existing instance running as | 40 // matching the caller's user id, or connect to an existing instance |
| 40 // kUserRoot. By default, applications do not have the ability to pass | 41 // running as kRootUserID. By default, applications do not have the ability |
| 41 // arbitrary values to this method, and doing so will result in a | 42 // to pass arbitrary values to this method, and doing so will result in a |
| 42 // connection error on the remote service provider. An application with | 43 // connection error on the remote service provider. An application with |
| 43 // the ability to launch applications with arbitrary user ids (e.g. a login | 44 // the ability to launch applications with arbitrary user ids (e.g. a login |
| 44 // app) may set this value to something meaningful to it. | 45 // app) may set this value to something meaningful to it. The user id |
| 46 // string is a valid guid of the form "%08X-%04X-%04X-%04X-%012llX", and |
| 47 // (aside from the root user whose guid is defined above) intended to be |
| 48 // not-guessable. |
| 45 // | 49 // |
| 46 // remote_interfaces | 50 // remote_interfaces |
| 47 // Allows the source application access to interface implementations | 51 // Allows the source application access to interface implementations |
| 48 // exposed by the target application. The interfaces accessible via this | 52 // exposed by the target application. The interfaces accessible via this |
| 49 // InterfaceParameter are filtered by the security policy described by the | 53 // InterfaceParameter are filtered by the security policy described by the |
| 50 // source and target application manifests. | 54 // source and target application manifests. |
| 51 // | 55 // |
| 52 // local_interfaces | 56 // local_interfaces |
| 53 // Allows the remote application access to interface implementations | 57 // Allows the remote application access to interface implementations |
| 54 // exposed by the source application. The interfaces accessible via this | 58 // exposed by the source application. The interfaces accessible via this |
| 55 // InterfaceProvider are filtered by the security policy described by the | 59 // InterfaceProvider are filtered by the security policy described by the |
| 56 // source and target application manifests. | 60 // source and target application manifests. |
| 57 // | 61 // |
| 58 // Response parameters: | 62 // Response parameters: |
| 59 // | 63 // |
| 64 // user_id |
| 65 // The user id the shell ran the target application as. Typically a client |
| 66 // passes kInheritUserID as the user id to Connect() which is resolved by |
| 67 // the shell into a valid user id returned through this callback. |
| 68 // |
| 60 // application_id | 69 // application_id |
| 61 // A unique identifier for the instance that was connected to. | 70 // A unique identifier for the instance that was connected to. |
| 62 // | 71 // |
| 63 // user_id | |
| 64 // The user id the shell ran the target application as. Typically a client | |
| 65 // passes kUserInherit to Connect(), which is an invalid user id, so this | |
| 66 // value in the response is guaranteed to be a valid user id, either the | |
| 67 // id connected to, or kUserRoot if no user-specific instance was located. | |
| 68 // | |
| 69 Connect(string name, | 72 Connect(string name, |
| 70 uint32 user_id, | 73 string user_id, |
| 71 InterfaceProvider&? remote_interfaces, | 74 InterfaceProvider&? remote_interfaces, |
| 72 InterfaceProvider? local_interfaces) => (uint32 application_id, | 75 InterfaceProvider? local_interfaces) => (string user_id, |
| 73 uint32 user_id); | 76 uint32 application_id); |
| 74 | 77 |
| 75 // Clones this Connector so it can be passed to another thread. | 78 // Clones this Connector so it can be passed to another thread. |
| 76 Clone(Connector& request); | 79 Clone(Connector& request); |
| 77 }; | 80 }; |
| OLD | NEW |