File: app_home.mojom

package info (click to toggle)
chromium 138.0.7204.183-1~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-proposed-updates
  • size: 6,080,960 kB
  • sloc: cpp: 34,937,079; ansic: 7,176,967; javascript: 4,110,704; python: 1,419,954; asm: 946,768; xml: 739,971; pascal: 187,324; sh: 89,623; perl: 88,663; objc: 79,944; sql: 50,304; cs: 41,786; fortran: 24,137; makefile: 21,811; php: 13,980; tcl: 13,166; yacc: 8,925; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (108 lines) | stat: -rw-r--r-- 3,830 bytes parent folder | download | duplicates (5)
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
// Copyright 2022 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_home.mojom;

import "url/mojom/url.mojom";

import "chrome/browser/web_applications/mojom/user_display_mode.mojom";

// The RunOnOsLoginModes must be kept in sync with RunOnOsLoginMode in
// chrome/browser/web_applications/web_app_constants.h
enum RunOnOsLoginMode {
  // kNotRun: The web app will not run during OS login.
  kNotRun = 0,
  // kWindowed: The web app will run during OS login and will be launched as
  // normal window. This is also the default launch mode for web apps.
  kWindowed = 1,
  // kMinimized: The web app will run during OS login and will be launched as a
  // minimized window.
  kMinimized = 2,
};

enum AppType {
  kWebApp = 0,
  kIsolatedWebApp = 1,
  kDeprecatedChromeApp = 2,
};

struct AppInfo {
  // The type of the app.
  AppType app_type;
  // The app id.
  string id;
  // The first url to load when app start launching.
  url.mojom.Url start_url;
  // The app's name.
  string name;
  // The app's icon url showing on `chrome://apps`.
  url.mojom.Url icon_url;
  // Whether need to show `RunOnOsLoginMode` menu item or not.
  bool may_show_run_on_os_login_mode;
  // Whether need to show `RunOnOsLoginMode` menu item checked or not.
  bool may_toggle_run_on_os_login_mode;
  // The app's `RunOnOsLoginMode`, including `RunOnOsLoginModeNotRun` and
  // `RunOnOsLoginModeWindowed`.
  RunOnOsLoginMode run_on_os_login_mode;
  // Whether the app is installed locally.
  bool is_locally_installed;
  // Whether the app open in a app window or as a browser tab.
  bool open_in_window;
  // Whether this app can be uninstalled by user.
  bool may_uninstall;
  // If this is an extension that came from the web store.
  url.mojom.Url? store_page_url;
};

struct ClickEvent {
  // TODO(crbug.com/40234138): Use enum class to represent button event.
  double button;
  bool alt_key;
  bool ctrl_key;
  bool meta_key;
  bool shift_key;
};

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

// Renderer to browser interface to support chrome://apps WebUI.
interface PageHandler {
  // Get all apps' information that defined in `AppInfo`.
  GetApps() => (array<AppInfo> app_list);
  // Gets the i18n'ed string for the label for removing deprecated apps.
  GetDeprecationLinkString() => (string link_string);
  // Uninstall app for specific `app_id`.
  UninstallApp(string app_id);
  // Open app’s site setting page.
  ShowAppSettings(string app_id);
  // Create shortcut link for app.
  CreateAppShortcut(string app_id) => ();
  // Launch app for specific `app_id`.
  // `source` is the launch source used for metrics reporting,
  // see `AppLaunchBucket` in extension_constants.h for more detail.
  // `click_event` is used for determining launch container for apps.
  LaunchApp(string app_id, ClickEvent? click_event);
  // Used to set the Run On OS Login Modes from the frontend of an app.
  SetRunOnOsLoginMode(string app_id, RunOnOsLoginMode run_on_os_login_mode);
  // Open the deprecated apps dialog.
  LaunchDeprecatedAppDialog();
  // Install app and set this app locally installed.
  // A locally installed app has shortcuts installed on various UI surfaces.
  InstallAppLocally(string app_id);
  // Set user display mode for web app.
  SetUserDisplayMode(string app_id, web_app.mojom.UserDisplayMode display_mode);
};

// The `Page` interface is used for sending mojom action messsage
// from backend to frontend.
interface Page {
  // Inform frontend that an app is successfully installed
  // and instruct frontend to update data.
  AddApp(AppInfo app_info);
  // Inform frontend that an app is uninstalled.
  RemoveApp(AppInfo app_info);
};