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.
40 // Optional data for the launch. Either <code>items</code>, or
41 // the pair (<code>url, referrerUrl</code>) can be present for any given
43 [inline_doc
] dictionary LaunchData
{
44 // The ID of the file or URL handler that the app is being invoked with.
45 // Handler IDs are the top-level keys in the <code>file_handlers</code>
46 // and/or <code>url_handlers</code> dictionaries in the manifest.
49 // The file entries for the <code>onLaunched</code> event triggered by a
50 // matching file handler in the <code>file_handlers</code> manifest key.
53 // The URL for the <code>onLaunched</code> event triggered by a matching
54 // URL handler in the <code>url_handlers</code> manifest key.
57 // The referrer URL for the <code>onLaunched</code> event triggered by a
58 // matching URL handler in the <code>url_handlers</code> manifest key.
59 DOMString? referrerUrl
;
61 // Whether the app is being launched in a <a
62 // href="https://support.google.com/chromebook/answer/3134673">Chrome OS
64 boolean? isKioskSession
;
66 // Where the app is launched from.
70 // This object specifies details and operations to perform on the embedding
71 // request. The app to be embedded can make a decision on whether or not to
72 // allow the embedding and what to embed based on the embedder making the
74 dictionary EmbedRequest
{
77 // Optional developer specified data that the app to be embedded can use
78 // when making an embedding decision.
81 // Allows <code>embedderId</code> to embed this app in an <appview>
82 // element. The <code>url</code> specifies the content to embed.
83 [nocompile
] static
void allow
(DOMString url
);
85 // Prevents <code> embedderId</code> from embedding this app in an
86 // <appview> element.
87 [nocompile
] static
void deny
();
91 // Fired when an embedding app requests to embed this app. This event is
92 // only available on dev channel with the flag --enable-app-view.
93 static
void onEmbedRequested
(EmbedRequest request
);
95 // Fired when an app is launched from the launcher.
96 static
void onLaunched
(optional LaunchData launchData
);
98 // Fired at Chrome startup to apps that were running when Chrome last shut
99 // down, or when apps have been requested to restart from their previous
100 // state for other reasons (e.g. when the user revokes access to an app's
101 // retained files the runtime will restart the app). In these situations if
102 // apps do not have an <code>onRestarted</code> handler they will be sent
103 // an <code>onLaunched </code> event instead.
104 static
void onRestarted
();