• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
4
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>.
8namespace shell {
9
10  // Called in the creating window (parent) before the load event is called in
11  // the created window (child). The parent can set fields or functions on the
12  // child usable from onload. E.g. background.js:<br>
13  // <code>function(createdWindow) { createdWindow.contentWindow.foo =
14  // function () { }; };</code>
15  // <br>window.js:<br>
16  // <code>window.onload = function () { foo(); }</code>
17  callback CreateWindowCallback =
18      void ([instanceOf=AppWindow] object createdWindow);
19
20  [noinline_doc] dictionary AppWindow {
21    // The JavaScript 'window' object for the created child.
22    [instanceOf=Window] object contentWindow;
23  };
24
25  interface Functions {
26    // Creates a fullscreen window on the default display. Options are ignored.
27    static void createWindow(DOMString url,
28                             optional object optionsPlaceholder,
29                             optional CreateWindowCallback callback);
30
31    // Returns an $(ref:AppWindow) object for the current script context
32    // (i.e. JavaScript 'window' object).
33    [nocompile] static AppWindow currentWindow();
34    [nocompile, nodoc] static void initializeAppWindow();
35  };
36
37  interface Events {
38    // Fired when the app is launched at app_shell startup.
39    static void onLaunched(optional object launchDataPlaceholder);
40  };
41};
42