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.shell</code> API to watch for launch events and create
6 // windows. The <code>createWindow</code> API is a subset of
7 // <code>chrome.app.window.create</code>.
10 [noinline_doc] dictionary CreateWindowOptions {
11 // Stub for the id of a window. This parameter is ignored in app_shell but
12 // provided for compatibility with apps running in Chrome.
15 // Stubs for the bounds of a window; these parameters are ignored in
16 // app_shell but are provided for compatibility with apps running in Chrome.
17 // The created window will always fill the root window of the default
23 // Called in the creating window (parent) before the load event is called in
24 // the created window (child). The parent can set fields or functions on the
25 // child usable from onload. E.g. background.js:<br>
26 // <code>function(createdWindow) { createdWindow.contentWindow.foo =
27 // function () { }; };</code>
29 // <code>window.onload = function () { foo(); }</code>
30 callback CreateWindowCallback =
31 void ([instanceOf=AppWindow] object createdWindow);
33 [noinline_doc] dictionary AppWindow {
34 // The JavaScript 'window' object for the created child.
35 [instanceOf=Window] object contentWindow;
39 // Creates a fullscreen window on the default display. Options for id and
40 // bounds are ignored.
41 static void createWindow(DOMString url,
42 optional CreateWindowOptions options,
43 optional CreateWindowCallback callback);
45 // Returns an $(ref:AppWindow) object for the current script context
46 // (i.e. JavaScript 'window' object).
47 [nocompile] static AppWindow currentWindow();
48 [nocompile, nodoc] static void initializeAppWindow();
52 // Fired when the app is launched at app_shell startup.
53 static void onLaunched(optional object launchDataPlaceholder);