File: app_management.mojom

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (276 lines) | stat: -rw-r--r-- 9,854 bytes parent folder | download | duplicates (6)
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
// Copyright 2018 The Chromium Authors
// 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 "url/mojom/url.mojom";

// The types of apps available in the registry.
enum AppType {
  kUnknown = 0,
  kArc,                   // Android app.
  kCrostini,              // Linux (via Crostini) app.
  kChromeApp,             // Chrome app.
  kWeb,                   // Web app.
  kPluginVm,              // Plugin VM app, see go/pluginvm.
  kRemote,                // Remote app.
  kBorealis,              // Borealis app, see go/borealis-app.
  kSystemWeb,             // System web app.
  kExtension,             // Browser extension.
  kBruschetta,            // Bruschetta app, see go/bruschetta.
};

// The types of permissions in App Service.
enum PermissionType {
  kUnknown         = 0,
  kCamera          = 1,
  kLocation        = 2,
  kMicrophone      = 3,
  kNotifications   = 4,
  kContacts        = 5,
  kStorage         = 6,
  kPrinting        = 7,
  kFileHandling    = 8,
};

enum TriState {
  kAllow,
  kBlock,
  kAsk,
};

union PermissionValue {
  bool bool_value;
  TriState tristate_value;
};

struct Permission {
  PermissionType permission_type;
  PermissionValue value;
  // If the permission is managed by an enterprise policy.
  bool is_managed;
  string? details;
};

// How the app was installed.
// This should be kept in sync with histogram.xml, and InstallReason in
// enums.xml.
// Note the enumeration is used in UMA histogram so entries should not be
// re-ordered or removed. New entries should be added at the bottom.
enum InstallReason {
  kUnknown = 0,
  kSystem,      // Installed with the system and is considered a part of the OS.
  kPolicy,      // Installed by policy.
  kOem,         // Installed by an OEM.
  kDefault,     // Preinstalled by default, but is not considered a system app.
  kSync,        // Installed by sync.
  kUser,        // Installed by user action.
  kSubApp,      // Installed by the SubApp API call.
  kKiosk,       // Installed by Kiosk on Chrome OS.
  kCommandLine, // Deprecated, no longer used.
};

// Where the app was installed from.
// This should be kept in sync with histogram.xml, and InstallSource in
// enums.xml.
// Note the enumeration is used in UMA histogram so entries should not be
// re-ordered or removed. New entries should be added at the bottom.
enum InstallSource {
  kUnknown = 0,
  kSystem,          // Installed as part of Chrome OS.
  kSync,            // Installed from sync.
  kPlayStore,       // Installed from Play store.
  kChromeWebStore,  // Installed from Chrome web store.
  kBrowser,         // Installed from browser.
};

// The window mode that each app will open in.
enum WindowMode {
  kUnknown = 0,
  // Opens in a standalone window
  kWindow,
  // Opens in the default web browser
  kBrowser,
  // Opens in a tabbed app window
  kTabbedWindow,
};

// The RunOnOsLoginModes must be kept in sync with RunOnOsLoginMode in
// chrome/browser/web_applications/web_app_constants.h
enum RunOnOsLoginMode {
  kUnknown = 0,
  // App won't run on OS Login.
  kNotRun,
  // App will run in windowed mode on OS Login.
  kWindowed,
};

// RunOnOsLoginMode struct to be used to verify if the mode is set by policy
// or not.
struct RunOnOsLogin {
  RunOnOsLoginMode login_mode;
  // If the run on os login mode is policy
  // controlled or not.
  bool is_managed;
};

// Locale info including tag and readable name translated based on ICU-20273.
struct Locale {
  // Locale tag of the language, e.g. en_US.
  // Parsed based on IETF BCP 47, which will translate unknown format to
  // just be "und", which is safe to be displayed on HTML.
  string locale_tag;
  // Readable name of the locale, translated based on the system language.
  // Empty if `locale_tag` cannot be translated.
  string display_name;
  // Readable name of the locale, translated based on the `locale_tag`.
  // Empty if `locale_tag` cannot be translated.
  string native_display_name;
};

struct App {
  string id;

  AppType type;

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

  string? description;
  bool? is_pinned;
  bool? is_policy_pinned;
  string? version;
  string? size;
  map<PermissionType, Permission> permissions;
  InstallReason install_reason;
  InstallSource install_source;
  bool hide_more_settings;
  bool hide_pin_to_shelf;
  bool is_preferred_app;
  WindowMode window_mode;
  bool hide_window_mode;
  bool resize_locked;
  bool hide_resize_locked;
  array<string> supported_links;
  RunOnOsLogin? run_on_os_login;
  FileHandlingState? file_handling_state;
  string? app_size;
  string? data_size;
  string publisher_id;
  // A string of the formatted origin URL where it is no longer a valid URL,
  // such as "foo.com".
  string? formatted_origin;
  // A list of formatted origins from the "scope_extensions" field in web app
  // manifest that are no longer valid URLs, such as "foo.com", "app.foo.com",
  // "*.foo2.com".
  array<string> scope_extensions;
  array<Locale> supported_locales;
  Locale? selected_locale;
  // Set to true to include a link using the
  //"appManagementNotificationsDescription" string to the system level
  // notification settings for this app.
  bool show_system_notifications_settings_link;
  // Whether to allow uninstall of the app.
  bool allow_uninstall;
  // Whether to disable the user choice area to set navigation capturing for
  // an app.
  bool disable_user_choice_navigation_capturing;
};

// 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);
  // Returns null if the app is not found.
  GetApp(string app_id) => (App? app);
  // Maps app IDs to their parent apps' app ID. The return value omits apps
  // that do not have a parent.
  GetSubAppToParentMap() => (map<string, string> sub_app_to_parent_map);
  GetExtensionAppPermissionMessages(string app_id) =>
      (array<ExtensionAppPermissionMessage> messages);
  // Pins or unpins for an app identified with `app_id`.
  SetPinned(string app_id, bool pinned);
  // Sets `permission` for an app identified with `app_id`.
  SetPermission(string app_id,
                Permission permission);
  // Enables resize lock mode for the app identified by `app_id`.
  SetResizeLocked(string app_id, bool locked);
  Uninstall(string app_id);
  OpenNativeSettings(string app_id);
  // On ChromeOS, this updates the preferred apps list for `app_id`.
  // On Windows, Mac and Linux, this is used to update the
  // user_link_capturing_preference_ flag on the web_app DB
  // for the `app_id`. If the app_id is set as a preferred app,
  // then it resets user_link_capturing_preference_
  // for all other apps if that is set.
  SetPreferredApp(string app_id, bool is_preferred_app);
  // On ChromeOS: Returns a list of |app_ids| that are currently set
  // as preferred apps and have overlapping intent filters with |app_id|.
  // On Windows, Mac and Linux, this returns a list of |app_ids| that
  // are currently set as preferred apps and satisfy the following
  // conditions:
  // 1. Scope of each app_id in the array matches the scope of
  // the input app_id and has an http or https scheme.
  // 2. The app opens in a separate window.
  // 3. The app is not a shortcut app.
  GetOverlappingPreferredApps(string app_id) => (array<string> app_ids);
  // Called when an app's settings is viewed, to start the calculation of
  // the app's size to be displayed.
  UpdateAppSize(string app_id);
  // Used to set the Window Mode from the frontend inside
  // app_management_page_handler.
  SetWindowMode(string app_id, WindowMode window_mode);
  // Used to set the Run On OS Login Modes from the frontend
  // of an app via app_management_page_handler.
  SetRunOnOsLoginMode(string app_id, RunOnOsLoginMode run_on_os_login_mode);
  // Used to set the state of the File Handling API from the frontend inside
  // app_management_page_handler.
  SetFileHandlingEnabled(string app_id, bool enabled);
  // Called when the second link in the File Handling section is clicked, iff
  // that link's URL is not valid (i.e. `learn_more_url` was empty). If it's a
  // valid URL instead, this won't be called.
  ShowDefaultAppAssociationsUi();
  // Opens the store page for an app with the given |app_id|.
  OpenStorePage(string app_id);
  // Sets app locale for an app with the given |app_id|. Empty |locale_tag|
  // indicates system language being chosen.
  SetAppLocale(string app_id, string locale_tag);
  // Called when the user clicks on the system notification settings link for an
  // app with the given `app_id`, when that link was displayed because
  // `show_system_notifications_settings_link` was true for the app.
  [EnableIf=is_mac]
  OpenSystemNotificationSettings(string app_id);
};

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

struct FileHandlingState {
  bool enabled;
  bool is_managed;
  // A list of all file type associations, such as "MD, TXT, CSV".
  string user_visible_types;
  // A label that displays a possibly truncated list of file type associations
  // and may be linkified to display overflow.
  string user_visible_types_label;
  // The URL for the learn more link. If null, the link defaults to "#".
  url.mojom.Url? learn_more_url;
};