Chromium Code Reviews| 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 // An interface through which a Mojo application may communicate with the Mojo |
| 24 // system and request connections to other applications. | 24 // system and request connections to other applications. |
| 25 interface Shell { | 25 interface Shell { |
| 26 const uint32 kInvalidApplicationID = 0; | 26 const uint32 kInvalidApplicationID = 0; |
| 27 const uint32 kUserRoot = 0; | |
| 28 const uint32 kUserInherit = 1; | |
| 27 | 29 |
| 28 // Establishes a connection with another application ("target application") | 30 // Establishes a connection with another application ("target application") |
| 29 // (located at |url|) through which the calling application and the | 31 // (located at |url|) through which the calling application and the |
| 30 // target application may request services from one another. | 32 // target application may request services from one another. |
| 31 // | 33 // |
| 32 // If the calling application would like to request services from the target | 34 // If the calling application would like to request services from the target |
| 33 // application, it should pass a valid interface request in the |services| | 35 // application, it should pass a valid interface request in the |services| |
| 34 // parameter (i.e. one containing a valid message pipe endpoint). If the | 36 // parameter (i.e. one containing a valid message pipe endpoint). If the |
| 35 // target application does not wish to offer services, it may either not bind | 37 // target application does not wish to offer services, it may either not bind |
| 36 // an implementation to the interface request, or else bind an implementation | 38 // an implementation to the interface request, or else bind an implementation |
| 37 // that will reject some or all service requests. | 39 // that will reject some or all service requests. |
| 38 // | 40 // |
| 39 // If the calling application would like to offer services to the target | 41 // If the calling application would like to offer services to the target |
| 40 // application, it should pass a bound interface through the | 42 // application, it should pass a bound interface through the |
| 41 // |exposed_services| parameter. The target application may then request | 43 // |exposed_services| parameter. The target application may then request |
| 42 // services through that interface. | 44 // services through that interface. |
| 43 // | 45 // |
| 44 // At least one of |services| or |exposed_services| should be valid/bound in | 46 // At least one of |services| or |exposed_services| should be valid/bound in |
| 45 // the call. | 47 // the call. |
| 46 // | 48 // |
| 47 // If the |application_url| does not contain a domain, but is of the form | 49 // If the |application_url| does not contain a domain, but is of the form |
| 48 // "mojo:{service}", it is up to the Mojo shell to select an appropriate | 50 // "mojo:{service}", it is up to the Mojo shell to select an appropriate |
| 49 // application for the service. Currently, the shell does this based on the | 51 // application for the service. Currently, the shell does this based on the |
| 50 // value of its --origin flag. | 52 // value of its --origin flag. |
| 51 // | 53 // |
| 52 // |filter| is a whitelist of application URLs and services that the target | 54 // |filter| is a whitelist of application URLs and services that the target |
| 53 // application is permitted to connect to. See documentation for | 55 // application is permitted to connect to. See documentation for |
| 54 // CapabilityFilter above. | 56 // CapabilityFilter above. |
| 55 Connect(string url, | 57 Connect(string url, |
| 58 uint32 user_id, | |
|
sky
2016/02/23 21:15:13
Document what user_id means and how it's used.
| |
| 56 InterfaceProvider&? remote_interfaces, | 59 InterfaceProvider&? remote_interfaces, |
| 57 InterfaceProvider? local_interfaces, | 60 InterfaceProvider? local_interfaces, |
| 58 CapabilityFilter filter) => (uint32 application_id); | 61 CapabilityFilter filter) => (uint32 application_id); |
| 59 | 62 |
| 60 // When there are no more instantiated services in an application, it should | 63 // When there are no more instantiated services in an application, it should |
| 61 // start its shutdown process by calling this method. Additionally, it should | 64 // start its shutdown process by calling this method. Additionally, it should |
| 62 // keep track of any new service requests that come in. The shell will then | 65 // keep track of any new service requests that come in. The shell will then |
| 63 // call Application::OnQuitRequested and start queueing new service requests. | 66 // call Application::OnQuitRequested and start queueing new service requests. |
| 64 // If the application didn't get any new service requests in the meantime, it | 67 // If the application didn't get any new service requests in the meantime, it |
| 65 // should call the callback with a true value. Otherwise it should call it | 68 // should call the callback with a true value. Otherwise it should call it |
| 66 // with false. | 69 // with false. |
| 67 QuitApplication(); | 70 QuitApplication(); |
| 68 }; | 71 }; |
| OLD | NEW |