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/shell/public/interfaces/service_provider.mojom"; | 7 import "mojo/shell/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 | 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 | 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 | 12 // rejected. Connections to services not specified in an application's allowed |
13 // interfaces value are not made. | 13 // interfaces value are not made. |
14 // A "*" value as the only key in an otherwise empty map means the application | 14 // A "*" value as the only key in an otherwise empty map means the application |
15 // may connect to any other application. | 15 // may connect to any other application. |
16 // A "*" value as the only string in an otherwise empty array of interface names | 16 // A "*" value as the only string in an otherwise empty array of interface names |
17 // means the application may connect to any service in that application. | 17 // means the application may connect to any service in that application. |
18 // An empty interface name array means the application may not connect to any | 18 // An empty interface name array means the application may not connect to any |
19 // services exposed by the application it is connecting to. | 19 // services exposed by the application it is connecting to. |
20 struct CapabilityFilter { | 20 struct CapabilityFilter { |
21 map<string, array<string>> filter; | 21 map<string, array<string>> filter; |
22 }; | 22 }; |
23 | 23 |
24 // An interface through which a Mojo application may communicate with the Mojo | 24 // An interface through which a Mojo application may communicate with the Mojo |
25 // system and request connections to other applications. | 25 // system and request connections to other applications. |
26 interface Shell { | 26 interface Shell { |
27 // Used to indicate the app was not launched by a content handler. | 27 const uint32 kInvalidApplicationID = 0; |
28 const uint32 kInvalidContentHandlerID = 0; | |
29 | 28 |
30 // Establishes a connection with another application ("target application") | 29 // Establishes a connection with another application ("target application") |
31 // (located at |request->url|) through which the calling application and the | 30 // (located at |request->url|) through which the calling application and the |
32 // target application may request services from one another. | 31 // target application may request services from one another. |
33 // |application_url| is a URLRequest in case this is called for an HTTP | 32 // |application_url| is a URLRequest in case this is called for an HTTP |
34 // navigation, in which case HTTP specific information like POST data, | 33 // navigation, in which case HTTP specific information like POST data, |
35 // referrer header etc... needed. | 34 // referrer header etc... needed. |
36 // | 35 // |
37 // If the calling application would like to request services from the target | 36 // If the calling application would like to request services from the target |
38 // application, it should pass a valid interface request in the |services| | 37 // application, it should pass a valid interface request in the |services| |
(...skipping 15 matching lines...) Expand all Loading... |
54 // application for the service. Currently, the shell does this based on the | 53 // application for the service. Currently, the shell does this based on the |
55 // value of its --origin flag. | 54 // value of its --origin flag. |
56 // | 55 // |
57 // |filter| is a whitelist of application URLs and services that the target | 56 // |filter| is a whitelist of application URLs and services that the target |
58 // application is permitted to connect to. See documentation for | 57 // application is permitted to connect to. See documentation for |
59 // CapabilityFilter above. | 58 // CapabilityFilter above. |
60 // | 59 // |
61 // If the connection to |application_url| involves a content handler, then | 60 // If the connection to |application_url| involves a content handler, then |
62 // |content_handler_id| is the id of the deepest content handler used to | 61 // |content_handler_id| is the id of the deepest content handler used to |
63 // establish the connection to |application_url|. If no content handler is | 62 // establish the connection to |application_url|. If no content handler is |
64 // used |content_handler_id| is kInvalidContentHandlerID. | 63 // used |content_handler_id| is kInvalidApplicationID. |
65 // TODO(beng): determine if we need to expose the target application id also. | |
66 ConnectToApplication(URLRequest application_url, | 64 ConnectToApplication(URLRequest application_url, |
67 ServiceProvider&? services, | 65 ServiceProvider&? services, |
68 ServiceProvider? exposed_services, | 66 ServiceProvider? exposed_services, |
69 CapabilityFilter filter) => (uint32 content_handler_id); | 67 CapabilityFilter filter) => |
| 68 (uint32 application_id, uint32 content_handler_id); |
70 | 69 |
71 // When there are no more instantiated services in an application, it should | 70 // When there are no more instantiated services in an application, it should |
72 // start its shutdown process by calling this method. Additionally, it should | 71 // start its shutdown process by calling this method. Additionally, it should |
73 // keep track of any new service requests that come in. The shell will then | 72 // keep track of any new service requests that come in. The shell will then |
74 // call Application::OnQuitRequested and start queueing new service requests. | 73 // call Application::OnQuitRequested and start queueing new service requests. |
75 // If the application didn't get any new service requests in the meantime, it | 74 // If the application didn't get any new service requests in the meantime, it |
76 // should call the callback with a true value. Otherwise it should call it | 75 // should call the callback with a true value. Otherwise it should call it |
77 // with false. | 76 // with false. |
78 QuitApplication(); | 77 QuitApplication(); |
79 }; | 78 }; |
OLD | NEW |