Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / apps / shell / common / api / shell.idl
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>.
8 namespace shell {
9
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.
13     DOMString? id;
14
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
18     // display.
19     object? innerBounds;
20     object? outerBounds;
21   };
22
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>
28   // <br>window.js:<br>
29   // <code>window.onload = function () { foo(); }</code>
30   callback CreateWindowCallback =
31       void ([instanceOf=AppWindow] object createdWindow);
32
33   [noinline_doc] dictionary AppWindow {
34     // The JavaScript 'window' object for the created child.
35     [instanceOf=Window] object contentWindow;
36   };
37
38   interface Functions {
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);
44
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();
49   };
50
51   interface Events {
52     // Fired when the app is launched at app_shell startup.
53     static void onLaunched(optional object launchDataPlaceholder);
54   };
55 };