Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(498)

Side by Side Diff: mojo/shell/public/interfaces/shell.mojom

Issue 1719193003: Add a user id parameter to connections (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 // Requests a connection with another application. The application originating
29 // (located at |url|) through which the calling application and the 31 // the request is referred to as the "source" and the one receiving the
30 // target application may request services from one another. 32 // "target".
31 // 33 //
32 // If the calling application would like to request services from the target 34 // The connection is embodied by a pair of message pipes binding the
33 // application, it should pass a valid interface request in the |services| 35 // InterfaceProvider interface, which allows both the source and target
34 // parameter (i.e. one containing a valid message pipe endpoint). If the 36 // applications to export interfaces to one another. The interfaces bound via
35 // target application does not wish to offer services, it may either not bind 37 // these InterfaceProviders are brokered by the shell according to the
36 // an implementation to the interface request, or else bind an implementation 38 // security policy defined by each application in its manifest .
37 // that will reject some or all service requests.
38 // 39 //
39 // If the calling application would like to offer services to the target 40 // If the target application is not running, the shell will run it, calling
40 // application, it should pass a bound interface through the 41 // its Initialize() method before completing the connection.
41 // |exposed_services| parameter. The target application may then request
42 // services through that interface.
43 // 42 //
44 // At least one of |services| or |exposed_services| should be valid/bound in 43 // Parameters:
45 // the call.
46 // 44 //
47 // If the |application_url| does not contain a domain, but is of the form 45 // url
48 // "mojo:{service}", it is up to the Mojo shell to select an appropriate 46 // A mojo: or exe: URL identifying the target application.
49 // application for the service. Currently, the shell does this based on the
50 // value of its --origin flag.
51 // 47 //
52 // |filter| is a whitelist of application URLs and services that the target 48 // user_id
53 // application is permitted to connect to. See documentation for 49 // The user id of the target application instance to connect to. If no such
54 // CapabilityFilter above. 50 // instance exists, the shell may start one. This user id will be passed
51 // to the new instance via Initialize(). Applications must generally set
52 // this to kUserInherit, and the shell will either connect to an existing
53 // instance matching the caller's user id, create a new instance matching
54 // the caller's user id, or connect to an existing instance running as
55 // kUserRoot. By default, applications do not have the ability to pass
56 // arbitrary values to this method, and doing so will result in a
57 // connection error on the remote service provider. An application with
58 // the ability to launch applications with arbitrary user ids (e.g. a login
59 // app) may set this value to something meaningful to it.
60 //
61 // remote_interfaces
62 // Allows the source application access to interface implementations
63 // exposed by the target application. The interfaces accessible via this
64 // InterfaceParameter are filtered by the security policy described by the
65 // source and target application manifests.
66 //
67 // local_interfaces
68 // Allows the remote application access to interface implementations
69 // exposed by the source application. The interfaces accessible via this
70 // InterfaceProvider are filtered by the security policy described by the
71 // source and target application manifests.
72 //
73 // filter
74 // Deprecated, to be removed.
75 //
76 // Response: (application_id)
77 // The shell responds with a unique identifier for the instance that was
78 // connected to.
79 //
55 Connect(string url, 80 Connect(string url,
81 uint32 user_id,
56 InterfaceProvider&? remote_interfaces, 82 InterfaceProvider&? remote_interfaces,
57 InterfaceProvider? local_interfaces, 83 InterfaceProvider? local_interfaces,
58 CapabilityFilter filter) => (uint32 application_id); 84 CapabilityFilter filter) => (uint32 application_id);
59 85
60 // When there are no more instantiated services in an application, it should 86 // When there are no more instantiated services in an application, it should
61 // start its shutdown process by calling this method. Additionally, it should 87 // 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 88 // keep track of any new service requests that come in. The shell will then
63 // call Application::OnQuitRequested and start queueing new service requests. 89 // call Application::OnQuitRequested and start queueing new service requests.
64 // If the application didn't get any new service requests in the meantime, it 90 // 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 91 // should call the callback with a true value. Otherwise it should call it
66 // with false. 92 // with false.
67 QuitApplication(); 93 QuitApplication();
68 }; 94 };
OLDNEW
« no previous file with comments | « mojo/shell/public/cpp/shell_connection.h ('k') | mojo/shell/public/interfaces/shell_client.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698