| Index: mojo/shell/public/interfaces/shell.mojom
|
| diff --git a/mojo/shell/public/interfaces/shell.mojom b/mojo/shell/public/interfaces/shell.mojom
|
| index 9702d48b992a680be784db4b77532ab2ad6eed90..1cd41ad95d4830207150f3778def4d4aaf426c65 100644
|
| --- a/mojo/shell/public/interfaces/shell.mojom
|
| +++ b/mojo/shell/public/interfaces/shell.mojom
|
| @@ -1,10 +1,48 @@
|
| -// Copyright 2014 The Chromium Authors. All rights reserved.
|
| +// Copyright 2015 The Chromium Authors. All rights reserved.
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| module mojo.shell.mojom;
|
|
|
| -import "mojo/shell/public/interfaces/interface_provider.mojom";
|
| +import "mojo/shell/public/interfaces/connector.mojom";
|
| +import "mojo/shell/public/interfaces/shell_client_factory.mojom";
|
| +
|
| +struct InstanceInfo {
|
| + uint32 id;
|
| + string name;
|
| + string qualifier;
|
| + uint32 pid;
|
| +};
|
| +
|
| +// Implemented by a client that wishes to be informed when the list of running
|
| +// instances changes.
|
| +interface InstanceListener {
|
| + // Called once when the listener is added via Shell::AddInstanceListener() to
|
| + // provide the initial list of instances that the listener observes changes
|
| + // against.
|
| + SetExistingInstances(array<InstanceInfo> instances);
|
| +
|
| + // Called when the shell has started tracking an instance. This happens when
|
| + // the shell first handles a request to launch the instance, before any
|
| + // process is created for it.
|
| + InstanceCreated(InstanceInfo instance);
|
| +
|
| + // Called when the shell has stopped tracking an instance. (i.e. when it has
|
| + // ended/quit).
|
| + InstanceDestroyed(uint32 id);
|
| +
|
| + // Called when a pid is available for the instance. This could be because a
|
| + // process was created by the runner for it, or because an existing content
|
| + // handler process was assigned.
|
| + InstancePIDAvailable(uint32 id, uint32 pid);
|
| +};
|
| +
|
| +// Implemented by an object in the shell associated with a specific instance.
|
| +// Tells it the PID for a process launched by the client. This interface is only
|
| +// available to callers of Shell::CreateInstanceForFactory().
|
| +interface PIDReceiver {
|
| + SetPID(uint32 pid);
|
| +};
|
|
|
| // Specifies a whitelist of applications and services an application can connect
|
| // to. Connections to applications not explicitly specified here as a key are
|
| @@ -20,72 +58,18 @@ struct CapabilityFilter {
|
| map<string, array<string>> filter;
|
| };
|
|
|
| -// Encapsulates establishing connections with other Mojo applications.
|
| -interface Connector {
|
| - const uint32 kInvalidApplicationID = 0;
|
| - const uint32 kUserRoot = 0;
|
| - const uint32 kUserInherit = 1;
|
| -
|
| - // Requests a connection with another application. The application originating
|
| - // the request is referred to as the "source" and the one receiving the
|
| - // "target".
|
| - //
|
| - // The connection is embodied by a pair of message pipes binding the
|
| - // InterfaceProvider interface, which allows both the source and target
|
| - // applications to export interfaces to one another. The interfaces bound via
|
| - // these InterfaceProviders are brokered by the shell according to the
|
| - // security policy defined by each application in its manifest .
|
| - //
|
| - // If the target application is not running, the shell will run it, calling
|
| - // its Initialize() method before completing the connection.
|
| - //
|
| - // Parameters:
|
| - //
|
| - // name
|
| - // A mojo: or exe: name identifying the target application.
|
| - //
|
| - // user_id
|
| - // The user id of the target application instance to connect to. If no such
|
| - // instance exists, the shell may start one. This user id will be passed
|
| - // to the new instance via Initialize(). Applications must generally set
|
| - // this to kUserInherit, and the shell will either connect to an existing
|
| - // instance matching the caller's user id, create a new instance matching
|
| - // the caller's user id, or connect to an existing instance running as
|
| - // kUserRoot. By default, applications do not have the ability to pass
|
| - // arbitrary values to this method, and doing so will result in a
|
| - // connection error on the remote service provider. An application with
|
| - // the ability to launch applications with arbitrary user ids (e.g. a login
|
| - // app) may set this value to something meaningful to it.
|
| - //
|
| - // remote_interfaces
|
| - // Allows the source application access to interface implementations
|
| - // exposed by the target application. The interfaces accessible via this
|
| - // InterfaceParameter are filtered by the security policy described by the
|
| - // source and target application manifests.
|
| - //
|
| - // local_interfaces
|
| - // Allows the remote application access to interface implementations
|
| - // exposed by the source application. The interfaces accessible via this
|
| - // InterfaceProvider are filtered by the security policy described by the
|
| - // source and target application manifests.
|
| - //
|
| - // Response parameters:
|
| - //
|
| - // application_id
|
| - // A unique identifier for the instance that was connected to.
|
| - //
|
| - // user_id
|
| - // The user id the shell ran the target application as. Typically a client
|
| - // passes kUserInherit to Connect(), which is an invalid user id, so this
|
| - // value in the response is guaranteed to be a valid user id, either the
|
| - // id connected to, or kUserRoot if no user-specific instance was located.
|
| - //
|
| - Connect(string name,
|
| - uint32 user_id,
|
| - InterfaceProvider&? remote_interfaces,
|
| - InterfaceProvider? local_interfaces) => (uint32 application_id,
|
| - uint32 user_id);
|
| +interface Shell {
|
| + // Instructs the Shell to create an instance for an existing process at the
|
| + // other end of |factory|, and perform applicable initialization. |user_id| is
|
| + // the user the instance should be created as. This is typically set to
|
| + // Connector::kUserInherit, unless the application has the ability to connect
|
| + // as other users.
|
| + CreateInstanceForFactory(ShellClientFactory factory,
|
| + string name,
|
| + uint32 user_id,
|
| + CapabilityFilter filter,
|
| + PIDReceiver& pid_receiver);
|
|
|
| - // Clones this Connector so it can be passed to another thread.
|
| - Clone(Connector& request);
|
| + // The listener is removed when the |listener| pipe is closed.
|
| + AddInstanceListener(InstanceListener listener);
|
| };
|
|
|