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/public/interfaces/application/service_provider.mojom"; | 7 import "mojo/public/interfaces/application/service_provider.mojom"; |
| 8 import "mojo/public/interfaces/application/shell.mojom"; |
8 | 9 |
9 // This is the primary interface implemented by every Mojo application. It | 10 // This is the primary interface implemented by every Mojo application. It |
10 // allows the application to receive its startup arguments from the shell, and | 11 // allows the application to receive its startup arguments from the shell, and |
11 // to be notified of events that occur during its execution. | 12 // to be notified of events that occur during its execution. |
12 interface Application { | 13 interface Application { |
13 // Initializes the application with the specified arguments. This method is | 14 // Initializes the application with the specified arguments. This method is |
14 // guaranteed to be called before any other method is called, and will only be | 15 // guaranteed to be called before any other method is called, and will only be |
15 // called once. | 16 // called once. |
16 Initialize(array<string>? args); | 17 Initialize(Shell shell, array<string>? args); |
17 | 18 |
18 // Called when another application (identified by |requestor_url|) attempts to | 19 // Called when another application (identified by |requestor_url|) attempts to |
19 // open a connection to this application. | 20 // open a connection to this application. |
20 // | 21 // |
21 // If the other application wants to request services from this application, | 22 // If the other application wants to request services from this application, |
22 // it will have passed a valid interface request through the |services| | 23 // it will have passed a valid interface request through the |services| |
23 // parameter (i.e. one containing a valid message pipe endpoint). This | 24 // parameter (i.e. one containing a valid message pipe endpoint). This |
24 // application may then bind an implementation of |ServiceProvider| to that | 25 // application may then bind an implementation of |ServiceProvider| to that |
25 // request in order to make services available to the other application. | 26 // request in order to make services available to the other application. |
26 // | 27 // |
27 // If the other application wants to offer services to this application, it | 28 // If the other application wants to offer services to this application, it |
28 // will have passed a bound interface through the |exposed_services| | 29 // will have passed a bound interface through the |exposed_services| |
29 // parameter. This application may then request services through that | 30 // parameter. This application may then request services through that |
30 // interface. | 31 // interface. |
31 // | 32 // |
32 // It is possible that both parameters will be valid/bound if the other | 33 // It is possible that both parameters will be valid/bound if the other |
33 // application wants to both request services from and offer services to this | 34 // application wants to both request services from and offer services to this |
34 // application. | 35 // application. |
35 // | 36 // |
36 // This application is free to ignore the |services| or |exposed_services| | 37 // This application is free to ignore the |services| or |exposed_services| |
37 // parameters if it does not wish to offer or request services. | 38 // parameters if it does not wish to offer or request services. |
38 AcceptConnection(string requestor_url, | 39 AcceptConnection(string requestor_url, |
39 ServiceProvider&? services, | 40 ServiceProvider&? services, |
40 ServiceProvider? exposed_services); | 41 ServiceProvider? exposed_services); |
41 | 42 |
42 // Called to request the application shut itself down gracefully. | 43 // Called to request the application shut itself down gracefully. |
43 RequestQuit(); | 44 RequestQuit(); |
44 }; | 45 }; |
OLD | NEW |