summaryrefslogtreecommitdiffstats
path: root/chromium/chrome/services/app_service/public/mojom/app_service.mojom
blob: 20bc648f25db6dca925435c1e8013a2373758755 (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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
// Copyright 2018 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 apps.mojom;

import "chrome/services/app_service/public/mojom/types.mojom";

// An intermediary between M app consumers (e.g. app launcher UI, intent
// pickers) and N app providers (also known as app platforms, e.g. Android
// apps, Linux apps and Web apps). It abstracts over platform-specific
// implementations and allow consumers to issue generic queries (e.g. for an
// app's name and icon) that are satisfied by the appropriate provider.
//
// See chrome/services/app_service/README.md.
interface AppService {
  // App Registry methods.
  RegisterPublisher(Publisher publisher, AppType app_type);
  RegisterSubscriber(Subscriber subscriber, ConnectOptions? opts);

  // App Icon Factory methods.
  LoadIcon(
      AppType app_type,
      string app_id,
      IconKey icon_key,
      IconCompression icon_compression,
      int32 size_hint_in_dip,
      bool allow_placeholder_icon) => (IconValue icon_value);

  // App Runner methods.
  Launch(
      AppType app_type,
      string app_id,
      int32 event_flags,
      LaunchSource launch_source,
      int64 display_id);

  SetPermission(
      AppType app_type,
      string app_id,
      Permission permission);

  Uninstall(
      AppType app_type,
      string app_id);

  OpenNativeSettings(
      AppType app_type,
      string app_id);
};

interface Publisher {
  // App Registry methods.
  Connect(Subscriber subscriber, ConnectOptions? opts);

  // App Icon Factory methods.
  LoadIcon(
      string app_id,
      IconKey icon_key,
      IconCompression icon_compression,
      int32 size_hint_in_dip,
      bool allow_placeholder_icon) => (IconValue icon_value);

  // App Runner methods.
  Launch(
      string app_id,
      int32 event_flags,
      LaunchSource launch_source,
      int64 display_id);

  SetPermission(
      string app_id,
      Permission permission);

  Uninstall(
      string app_id);

  OpenNativeSettings(
      string app_id);
};

interface Subscriber {
  OnApps(array<App> deltas);

  // Binds this to the given request (message pipe endpoint), being to Mojo
  // interfaces what POSIX's dup is to file descriptors.
  //
  // See https://groups.google.com/a/chromium.org/d/msg/chromium-mojo/nFhBzGsb5Pg/V7t_8kNRAgAJ
  Clone(Subscriber& request);
};

struct ConnectOptions {
  // TODO: some way to represent l10n info such as the UI language.
};