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 [DartPackage="mojo"] | 5 [DartPackage="mojo"] |
6 module mojo; | 6 module mojo; |
7 | 7 |
8 import "mojo/public/interfaces/application/service_provider.mojom"; | 8 import "mojo/public/interfaces/application/service_provider.mojom"; |
9 import "mojo/public/interfaces/application/shell.mojom"; | 9 import "mojo/public/interfaces/application/shell.mojom"; |
10 | 10 |
11 // This is the primary interface implemented by every Mojo application. It | 11 // This is the primary interface implemented by every Mojo application. It |
12 // allows the application to receive its startup arguments from the shell, and | 12 // allows the application to receive its startup arguments from the shell, and |
13 // to be notified of events that occur during its execution. | 13 // to be notified of events that occur during its execution. |
14 // | |
15 // TODO(aa): It would be good to reorder the parameters once we have interface | |
16 // versioning. | |
17 interface Application { | 14 interface Application { |
18 // Initializes the application with the specified arguments. This method is | 15 // Initializes the application with the specified arguments. This method is |
19 // guaranteed to be called before any other method is called, and will only be | 16 // guaranteed to be called before any other method is called, and will only be |
20 // called once. | 17 // called once. |
21 // | 18 // |
22 // The |url| parameter is the identity of the application as far as the shell | 19 // The |url| parameter is the identity of the application as far as the shell |
23 // is concerned. This will be the URL the application was found at, after all | 20 // is concerned. This will be the URL the application was found at, after all |
24 // mappings, resolution, and redirects. And it will not include the | 21 // mappings, resolution, and redirects. And it will not include the |
25 // querystring, since the querystring is not part of an application's | 22 // querystring, since the querystring is not part of an application's |
26 // identity. | 23 // identity. |
27 Initialize(Shell shell, array<string>? args, string url); | 24 Initialize(Shell shell, array<string>? args, string url); |
28 | 25 |
29 // Called when another application (identified by |requestor_url|) attempts to | 26 // Called when another application (identified by |requestor_url|) attempts to |
30 // open a connection to this application. | 27 // open a connection to this application. |
31 // | 28 // |
32 // If the other application wants to request services from this application, | |
33 // it will have passed a valid interface request through the |services| | |
34 // parameter (i.e. one containing a valid message pipe endpoint). This | |
35 // application may then bind an implementation of |ServiceProvider| to that | |
36 // request in order to make services available to the other application. | |
37 // | |
38 // If the other application wants to offer services to this application, it | |
39 // will have passed a bound interface through the |exposed_services| | |
40 // parameter. This application may then request services through that | |
41 // interface. | |
42 // | |
43 // It is possible that both parameters will be valid/bound if the other | |
44 // application wants to both request services from and offer services to this | |
45 // application. | |
46 // | |
47 // This application is free to ignore the |services| or |exposed_services| | |
48 // parameters if it does not wish to offer or request services. | |
49 // | |
50 // resolved_url is the URL that was requested to create this connection, after | 29 // resolved_url is the URL that was requested to create this connection, after |
51 // all mappings, resolutions, and redirects. This will include any querystring | 30 // all mappings, resolutions, and redirects. This will include any querystring |
52 // that was part of the request. | 31 // that was part of the request. |
53 // | |
54 // WARNING: |exposed_services| is deprecated and non-functional, and will be | |
55 // removed. Note that this also means that |services| will become required. | |
56 // https://github.com/domokit/mojo/issues/762 | |
57 AcceptConnection(string requestor_url, | 32 AcceptConnection(string requestor_url, |
58 ServiceProvider&? services, | 33 string resolved_url, |
59 ServiceProvider? exposed_services, | 34 ServiceProvider& services); |
60 string resolved_url); | |
61 | 35 |
62 // Called to request the application shut itself down gracefully. | 36 // Called to request the application shut itself down gracefully. |
63 RequestQuit(); | 37 RequestQuit(); |
64 }; | 38 }; |
OLD | NEW |