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; | 5 module mojo; |
6 | 6 |
7 import "mojo/application/public/interfaces/service_provider.mojom"; | 7 import "mojo/application/public/interfaces/service_provider.mojom"; |
8 import "network/public/interfaces/url_loader.mojom"; | 8 import "network/public/interfaces/url_loader.mojom"; |
9 | 9 |
10 // Specifies a whitelist of applications and services an application can connect | |
11 // to. Connections to applications not explicitly specified here as a key are | |
12 // rejected. Connections to services not specified in an application's allowed | |
13 // interfaces value are not made. | |
14 // A "*" value as the only key in an otherwise empty map means the application | |
15 // may connect to any other application and potentially any service that is | |
yzshen1
2015/07/22 22:26:47
Should it be {"*": [ "*" ]} to mean that it allows
| |
16 // exposed. | |
17 // A "*" value as the only string in an otherwise empty array of interface names | |
18 // means the application may connect to any service in that application. | |
19 struct CapabilityFilter { | |
20 map<string, array<string>> filter; | |
21 }; | |
22 | |
10 // 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 |
11 // system and request connections to other applications. | 24 // system and request connections to other applications. |
12 interface Shell { | 25 interface Shell { |
13 // Establishes a connection with another application (located at | 26 // Establishes a connection with another application ("target application") |
14 // |request->url|) through which the calling application and the other | 27 // (located at |request->url|) through which the calling application and the |
15 // application may request services from one another. |application_url| is a | 28 // target application may request services from one another. |
16 // URLRequest in case this is called for an HTTP navigation, in which case | 29 // |application_url| is a URLRequest in case this is called for an HTTP |
17 // HTTP specific information like POST data, referrer header etc... needed. | 30 // navigation, in which case HTTP specific information like POST data, |
31 // referrer header etc... needed. | |
18 // | 32 // |
19 // If the calling application would like to request services from the other | 33 // If the calling application would like to request services from the target |
20 // application, it should pass a valid interface request in the |services| | 34 // application, it should pass a valid interface request in the |services| |
21 // parameter (i.e. one containing a valid message pipe endpoint). If the other | 35 // parameter (i.e. one containing a valid message pipe endpoint). If the |
22 // application does not wish to offer services, it may either not bind an | 36 // target application does not wish to offer services, it may either not bind |
23 // implementation to the interface request, or else bind an implementation | 37 // an implementation to the interface request, or else bind an implementation |
24 // that will reject some or all service requests. | 38 // that will reject some or all service requests. |
25 // | 39 // |
26 // If the calling application would like to offer services to the other | 40 // If the calling application would like to offer services to the target |
27 // application, it should pass a bound interface through the | 41 // application, it should pass a bound interface through the |
28 // |exposed_services| parameter. The other application may then request | 42 // |exposed_services| parameter. The target application may then request |
29 // services through that interface. | 43 // services through that interface. |
30 // | 44 // |
31 // At least one of |services| or |exposed_services| should be valid/bound in | 45 // At least one of |services| or |exposed_services| should be valid/bound in |
32 // the call. | 46 // the call. |
33 // | 47 // |
34 // If the |application_url| does not contain a domain, but is of the form | 48 // If the |application_url| does not contain a domain, but is of the form |
35 // "mojo:{service}", it is up to the Mojo shell to select an appropriate | 49 // "mojo:{service}", it is up to the Mojo shell to select an appropriate |
36 // application for the service. Currently, the shell does this based on the | 50 // application for the service. Currently, the shell does this based on the |
37 // value of its --origin flag. | 51 // value of its --origin flag. |
52 // | |
53 // |filter| is a whitelist of application URLs and services that the target | |
54 // application is permitted to connect to. See documentation for | |
55 // CapabilityFilter above. Note also that this parameter may be NULL, which | |
56 // has the same meaning as allowing the target application to connect to | |
57 // any application and service. | |
38 ConnectToApplication(URLRequest application_url, | 58 ConnectToApplication(URLRequest application_url, |
39 ServiceProvider&? services, | 59 ServiceProvider&? services, |
40 ServiceProvider? exposed_services); | 60 ServiceProvider? exposed_services, |
61 CapabilityFilter? filter); | |
41 | 62 |
42 // 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 |
43 // start its shutdown process by calling this method. Additionally, it should | 64 // start its shutdown process by calling this method. Additionally, it should |
44 // 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 |
45 // call Application::OnQuitRequested and start queueing new service requests. | 66 // call Application::OnQuitRequested and start queueing new service requests. |
46 // 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 |
47 // 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 |
48 // with false. | 69 // with false. |
49 QuitApplication(); | 70 QuitApplication(); |
50 }; | 71 }; |
OLD | NEW |