1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // Use the <code>chrome.app.runtime</code> API to manage the app lifecycle.
6 // The app runtime manages app installation, controls the event page, and can
7 // shut down the app at anytime.
8 namespace app.runtime
{
10 [inline_doc
] dictionary LaunchItem
{
11 // FileEntry for the file.
12 [instanceOf
=FileEntry
] object entry;
14 // The MIME type of the file.
18 // Enumeration of app launch sources.
39 // Optional data for the launch. Either <code>items</code>, or
40 // the pair (<code>url, referrerUrl</code>) can be present for any given
42 [inline_doc
] dictionary LaunchData
{
43 // The ID of the file or URL handler that the app is being invoked with.
44 // Handler IDs are the top-level keys in the <code>file_handlers</code>
45 // and/or <code>url_handlers</code> dictionaries in the manifest.
48 // The file entries for the <code>onLaunched</code> event triggered by a
49 // matching file handler in the <code>file_handlers</code> manifest key.
52 // The URL for the <code>onLaunched</code> event triggered by a matching
53 // URL handler in the <code>url_handlers</code> manifest key.
56 // The referrer URL for the <code>onLaunched</code> event triggered by a
57 // matching URL handler in the <code>url_handlers</code> manifest key.
58 DOMString? referrerUrl
;
60 // Whether the app is being launched in a <a
61 // href="https://support.google.com/chromebook/answer/3134673">Chrome OS
63 boolean? isKioskSession
;
65 // Where the app is launched from.
69 // This object specifies details and operations to perform on the embedding
70 // request. The app to be embedded can make a decision on whether or not to
71 // allow the embedding and what to embed based on the embedder making the
73 dictionary EmbedRequest
{
76 // Optional developer specified data that the app to be embedded can use
77 // when making an embedding decision.
80 // Allows <code>embedderId</code> to embed this app in an <appview>
81 // element. The <code>url</code> specifies the content to embed.
82 [nocompile
] static
void allow
(DOMString url
);
84 // Prevents <code> embedderId</code> from embedding this app in an
85 // <appview> element.
86 [nocompile
] static
void deny
();
90 // Fired when an embedding app requests to embed this app. This event is
91 // only available on dev channel with the flag --enable-app-view.
92 static
void onEmbedRequested
(EmbedRequest request
);
94 // Fired when an app is launched from the launcher.
95 static
void onLaunched
(optional LaunchData launchData
);
97 // Fired at Chrome startup to apps that were running when Chrome last shut
98 // down, or when apps have been requested to restart from their previous
99 // state for other reasons (e.g. when the user revokes access to an app's
100 // retained files the runtime will restart the app). In these situations if
101 // apps do not have an <code>onRestarted</code> handler they will be sent
102 // an <code>onLaunched </code> event instead.
103 static
void onRestarted
();