summaryrefslogtreecommitdiffstats
path: root/mojo/shell/public/interfaces/shell.mojom
blob: ed3cbd02a4096fc7faa4e157c47b2cfd72472b8d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// Copyright 2014 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";

// Specifies a whitelist of applications and services an application can connect
// to. Connections to applications not explicitly specified here as a key are
// rejected. Connections to services not specified in an application's allowed
// interfaces value are not made.
// A "*" value as the only key in an otherwise empty map means the application
// may connect to any other application.
// A "*" value as the only string in an otherwise empty array of interface names
// means the application may connect to any service in that application.
// An empty interface name array means the application may not connect to any
// services exposed by the application it is connecting to.
struct CapabilityFilter {
  map<string, array<string>> filter;
};

// An interface through which a Mojo application may communicate with the Mojo
// system and request connections to other applications.
interface Shell {
  const uint32 kInvalidApplicationID = 0;

  // Establishes a connection with another application ("target application")
  // (located at |url|) through which the calling application and the
  // target application may request services from one another.
  //
  // If the calling application would like to request services from the target
  // application, it should pass a valid interface request in the |services|
  // parameter (i.e. one containing a valid message pipe endpoint). If the
  // target application does not wish to offer services, it may either not bind
  // an implementation to the interface request, or else bind an implementation
  // that will reject some or all service requests.
  //
  // If the calling application would like to offer services to the target
  // application, it should pass a bound interface through the
  // |exposed_services| parameter. The target application may then request
  // services through that interface.
  //
  // At least one of |services| or |exposed_services| should be valid/bound in
  // the call.
  //
  // If the |application_url| does not contain a domain, but is of the form
  // "mojo:{service}", it is up to the Mojo shell to select an appropriate
  // application for the service. Currently, the shell does this based on the
  // value of its --origin flag.
  //
  // |filter| is a whitelist of application URLs and services that the target
  // application is permitted to connect to. See documentation for
  // CapabilityFilter above.
  Connect(string url,
          InterfaceProvider&? remote_interfaces,
          InterfaceProvider? local_interfaces,
          CapabilityFilter filter) => (uint32 application_id);

  // When there are no more instantiated services in an application, it should
  // start its shutdown process by calling this method. Additionally, it should
  // keep track of any new service requests that come in. The shell will then
  // call Application::OnQuitRequested and start queueing new service requests.
  // If the application didn't get any new service requests in the meantime, it
  // should call the callback with a true value. Otherwise it should call it
  // with false.
  QuitApplication();
};