summaryrefslogtreecommitdiffstats
path: root/chromium/chrome/browser/ui/webui/app_management/app_management.mojom
blob: 512730e314247fdf39fbef1949ec6fabb6089b41 (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
// 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 app_management.mojom;

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

struct App {
  string id;

  apps.mojom.AppType type;

  // The fields below may be omitted because this struct is also used to signal
  // updates.
  string? title;

  string? description;
  apps.mojom.OptionalBool is_pinned;
  apps.mojom.OptionalBool is_policy_pinned;
  string? version;
  string? size;
  map<uint32, apps.mojom.Permission> permissions;
  apps.mojom.InstallSource install_source;
  bool hide_more_settings;
  bool hide_pin_to_shelf;
};

// Extension-based apps primarily use install-time permissions that cannot be
// changed after installation. This struct is used for the page to receive
// string descriptions of those permissions to display to the user.
struct ExtensionAppPermissionMessage {
  string message;
  array<string> submessages;
};

interface PageHandlerFactory {
  CreatePageHandler(pending_remote<Page> page,
                    pending_receiver<PageHandler> handler);
};

// Browser interface.
interface PageHandler {
  GetApps() => (array<App> apps);
  GetExtensionAppPermissionMessages(string app_id) =>
      (array<ExtensionAppPermissionMessage> messages);
  SetPinned(string app_id, apps.mojom.OptionalBool pinned);
  SetPermission(string app_id,
                apps.mojom.Permission permission);
  Uninstall(string app_id);
  OpenNativeSettings(string app_id);
};

// Frontend interface.
interface Page {
  OnAppAdded(App app);
  OnAppChanged(App update);
  OnAppRemoved(string app_id);
  OnArcSupportChanged(bool supported);
};

// Permission Type Enums for each App Publisher. The App Publishers are
// required to provide these values so the WebUI can map permission ID to
// permission value.

// This enum shows the ARC permission values currently supported over the
// App Service. It should always match the AppPermission enum in
// app_permissions.mojom
enum ArcPermissionType {
  CAMERA          = 0,
  LOCATION        = 1,
  MICROPHONE      = 2,
  NOTIFICATIONS   = 3,
  CONTACTS        = 4,
  STORAGE         = 5,
};

// This enum takes the important permission values from the
// contents_settings_type.h ContentSettingsType enum.
enum PwaPermissionType {
  CONTENT_SETTINGS_TYPE_GEOLOCATION = 5,
  CONTENT_SETTINGS_TYPE_NOTIFICATIONS = 6,
  CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC = 9,
  CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA = 10,
};