File: app_runtime.webidl

package info (click to toggle)
chromium 145.0.7632.159-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,976,224 kB
  • sloc: cpp: 36,198,469; ansic: 7,634,080; javascript: 3,564,060; python: 1,649,622; xml: 838,470; asm: 717,087; pascal: 185,708; sh: 88,786; perl: 88,718; objc: 79,984; sql: 59,811; cs: 42,452; fortran: 24,101; makefile: 21,144; tcl: 15,277; php: 14,022; yacc: 9,066; ruby: 7,553; awk: 3,720; lisp: 3,233; lex: 1,328; ada: 727; jsp: 228; sed: 36
file content (165 lines) | stat: -rw-r--r-- 5,619 bytes parent folder | download | duplicates (8)
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
// Copyright 2025 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

dictionary LaunchItem {
  // Entry for the item.
  [instanceOf=Entry] required object entry;

  // The MIME type of the file.
  DOMString type;
};

// Enumeration of app launch sources.
// This should be kept in sync with AppLaunchSource in
// components/services/app_service/public/mojom/types.mojom, and
// GetLaunchSourceEnum() in
// extensions/browser/api/app_runtime/app_runtime_api.cc.
// Note the enumeration is used in UMA histogram so entries
// should not be re-ordered or removed.
enum LaunchSource {
  "untracked",
  "app_launcher",
  "new_tab_page",
  "reload",
  "restart",
  "load_and_launch",
  "command_line",
  "file_handler",
  "url_handler",
  "system_tray",
  "about_page",
  "keyboard",
  "extensions_page",
  "management_api",
  "ephemeral_app",
  "background",
  "kiosk",
  "chrome_internal",
  "test",
  "installed_notification",
  "context_menu",
  "arc",
  "intent_url",
  "app_home_page",
  "focus_mode",
  "sparky"
};

// Optional data for the launch. Either <code>items</code>, or
// the pair (<code>url, referrerUrl</code>) can be present for any given
// launch.
[inline_doc] dictionary LaunchData {
  // The ID of the file or URL handler that the app is being invoked with.
  // Handler IDs are the top-level keys in the <code>file_handlers</code>
  // and/or <code>url_handlers</code> dictionaries in the manifest.
  DOMString id;

  // The file entries for the <code>onLaunched</code> event triggered by a
  // matching file handler in the <code>file_handlers</code> manifest key.
  sequence<LaunchItem> items;

  // The URL for the <code>onLaunched</code> event triggered by a matching
  // URL handler in the <code>url_handlers</code> manifest key.
  DOMString url;

  // The referrer URL for the <code>onLaunched</code> event triggered by a
  // matching URL handler in the <code>url_handlers</code> manifest key.
  DOMString referrerUrl;

  // Whether the app is launched in a Chrome OS Demo Mode session. Used for
  // default-installed Demo Mode Chrome apps.
  [nodoc] boolean isDemoSession;

  // Whether the app is being launched in a <a
  // href="https://support.google.com/chromebook/answer/3134673">Chrome OS
  // kiosk session</a>.
  boolean isKioskSession;

  // Whether the app is being launched in a <a
  // href="https://support.google.com/chrome/a/answer/3017014">Chrome OS
  // public session</a>.
  boolean isPublicSession;

  // Where the app is launched from.
  LaunchSource source;
};

callback AllowCallback = undefined(DOMString url);
callback DenyCallback = undefined();

// This object specifies details and operations to perform on the embedding
// request. The app to be embedded can make a decision on whether or not to
// allow the embedding and what to embed based on the embedder making the
// request.
dictionary EmbedRequest {
  required DOMString embedderId;

  // Optional developer specified data that the app to be embedded can use
  // when making an embedding decision.
  any data;

  // Allows <code>embedderId</code> to embed this app in an &lt;appview&gt;
  // element. The <code>url</code> specifies the content to embed.
  [nocompile] required AllowCallback allow;


  // Prevents <code> embedderId</code> from embedding this app in an
  // &lt;appview&gt; element.
  [nocompile] required DenyCallback deny;
};

// Listener callback for the onEmbedRequested event.
callback OnEmbedRequestedListener = undefined(EmbedRequest request);

interface OnEmbedRequestedEvent : ExtensionEvent {
  static undefined addListener(OnEmbedRequestedListener listener);
  static undefined removeListener(OnEmbedRequestedListener listener);
  static boolean hasListener(OnEmbedRequestedListener listener);
};

// Listener callback for the onLaunched event.
callback OnLaunchedListener = undefined(optional LaunchData launchData);

interface OnLaunchedEvent : ExtensionEvent {
  static undefined addListener(OnLaunchedListener listener);
  static undefined removeListener(OnLaunchedListener listener);
  static boolean hasListener(OnLaunchedListener listener);
};

// Listener callback for the onRestarted event.
callback OnRestartedListener = undefined();

interface OnRestartedEvent : ExtensionEvent {
  static undefined addListener(OnRestartedListener listener);
  static undefined removeListener(OnRestartedListener listener);
  static boolean hasListener(OnRestartedListener listener);
};

// Use the <code>chrome.app.runtime</code> API to manage the app lifecycle.
// The app runtime manages app installation, controls the event page, and can
// shut down the app at anytime.
interface Runtime {
  // Fired when an embedding app requests to embed this app. This event is
  // only available on dev channel with the flag --enable-app-view.
  static attribute OnEmbedRequestedEvent onEmbedRequested;

  // Fired when an app is launched from the launcher.
  static attribute OnLaunchedEvent onLaunched;

  // Fired at Chrome startup to apps that were running when Chrome last shut
  // down, or when apps have been requested to restart from their previous
  // state for other reasons (e.g. when the user revokes access to an app's
  // retained files the runtime will restart the app). In these situations if
  // apps do not have an <code>onRestarted</code> handler they will be sent
  // an <code>onLaunched </code> event instead.
  static attribute OnRestartedEvent onRestarted;
};

partial interface App {
  static attribute Runtime runtime;
};

partial interface Browser {
  static attribute App app;
};