| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2012 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 namespace app.window { |
| 6 dictionary Bounds { |
| 7 long? left; |
| 8 long? top; |
| 9 long? width; |
| 10 long? height; |
| 11 }; |
| 12 |
| 13 dictionary CreateWindowOptions { |
| 14 // Id to identify the window. This will be used to remember the size |
| 15 // and position of the window and restore that geometry when a window |
| 16 // with the same id (and no explicit size or position) is later opened. |
| 17 DOMString? id; |
| 18 |
| 19 // Default width of the window. (Deprecated; regular bounds act like this |
| 20 // now.) |
| 21 [nodoc] long? defaultWidth; |
| 22 |
| 23 // Default height of the window. (Deprecated; regular bounds act like this |
| 24 // now.) |
| 25 [nodoc] long? defaultHeight; |
| 26 |
| 27 // Default X coordinate of the window. (Deprecated; regular bounds act like |
| 28 // this now.) |
| 29 [nodoc] long? defaultLeft; |
| 30 |
| 31 // Default Y coordinate of the window. (Deprecated; regular bounds act like |
| 32 // this now.) |
| 33 [nodoc] long? defaultTop; |
| 34 |
| 35 // Width of the window. (Deprecated; use 'bounds'.) |
| 36 [nodoc] long? width; |
| 37 |
| 38 // Height of the window. (Deprecated; use 'bounds'.) |
| 39 [nodoc] long? height; |
| 40 |
| 41 // X coordinate of the window. (Deprecated; use 'bounds'.) |
| 42 [nodoc] long? left; |
| 43 |
| 44 // Y coordinate of the window. (Deprecated; use 'bounds'.) |
| 45 [nodoc] long? top; |
| 46 |
| 47 // Minimum width of the window. |
| 48 long? minWidth; |
| 49 |
| 50 // Minimum height of the window. |
| 51 long? minHeight; |
| 52 |
| 53 // Maximum width of the window. |
| 54 long? maxWidth; |
| 55 |
| 56 // Maximum height of the window. |
| 57 long? maxHeight; |
| 58 |
| 59 // Window type: |
| 60 // 'shell' - the default window type |
| 61 // 'panel' - a panel, managed by the OS (Currently experimental, Ash only) |
| 62 [nodoc] DOMString? type; |
| 63 |
| 64 // Frame type: 'none' or 'chrome' (defaults to 'chrome'). |
| 65 DOMString? frame; |
| 66 |
| 67 // Size of the content in the window (excluding the titlebar). If specified |
| 68 // in addition to any of the left/top/width/height parameters, this field |
| 69 // takes precedence. If a frameBounds is specified, the frameBounds take |
| 70 // precedence. |
| 71 Bounds? bounds; |
| 72 |
| 73 // Enable window background transparency. |
| 74 // Only supported in ash. Requires experimental API permission. |
| 75 boolean? transparentBackground; |
| 76 |
| 77 // If true, the window will be created in a hidden state. Call show() on |
| 78 // the window to show it once it has been created. Defaults to false. |
| 79 boolean? hidden; |
| 80 |
| 81 // By default if you specify an id for the window, the window will only be |
| 82 // created if another window with the same id doesn't already exist. If a |
| 83 // window with the same id already exists that window is activated instead. |
| 84 // If you do want to create multiple windows with the same id, you can |
| 85 // set this property to false. |
| 86 boolean? singleton; |
| 87 }; |
| 88 |
| 89 callback CreateWindowCallback = |
| 90 void ([instanceOf=AppWindow] object created_window); |
| 91 |
| 92 dictionary AppWindow { |
| 93 // Focus the window. |
| 94 static void focus(); |
| 95 |
| 96 // Minimize the window. |
| 97 static void minimize(); |
| 98 |
| 99 // Is the window minimized? |
| 100 static boolean isMinimized(); |
| 101 |
| 102 // Maximize the window. |
| 103 static void maximize(); |
| 104 |
| 105 // Is the window maximized? |
| 106 static bool isMaximized(); |
| 107 |
| 108 // Restore the window. |
| 109 static void restore(); |
| 110 |
| 111 // Move the window to the position (|left|, |top|). |
| 112 static void moveTo(long left, long top); |
| 113 |
| 114 // Resize the window to |width|x|height| pixels in size. |
| 115 static void resizeTo(long width, long height); |
| 116 |
| 117 // Draw attention to the window. |
| 118 static void drawAttention(); |
| 119 |
| 120 // Clear attention to the window. |
| 121 static void clearAttention(); |
| 122 |
| 123 // Close the window. |
| 124 static void close(); |
| 125 |
| 126 // Show the window. Does nothing if the window is already visible. |
| 127 static void show(); |
| 128 |
| 129 // Hide the window. Does nothing if the window is already hidden. |
| 130 static void hide(); |
| 131 |
| 132 // Get the window's bounds as a $ref:Bounds object. |
| 133 [nocompile] static Bounds getBounds(); |
| 134 |
| 135 // Set the window's bounds. |
| 136 static void setBounds(Bounds bounds); |
| 137 |
| 138 // Set the app icon for the window (experimental). |
| 139 // Currently this is only being implemented on Ash. |
| 140 // TODO(stevenjb): Investigate implementing this on Windows and OSX. |
| 141 [nodoc] static void setIcon(DOMString icon_url); |
| 142 |
| 143 // The JavaScript 'window' object for the created child. |
| 144 [instanceOf=global] object contentWindow; |
| 145 }; |
| 146 |
| 147 interface Functions { |
| 148 // The size and position of a window can be specified in a number of |
| 149 // different ways. The most simple option is not specifying anything at |
| 150 // all, in which case a default size and platform dependent position will |
| 151 // be used. |
| 152 // |
| 153 // Another option is to use the top/left and width/height properties, |
| 154 // which will always put the window at the specified coordinates with the |
| 155 // specified size. |
| 156 // |
| 157 // Yet another option is to give the window a (unique) id. This id is then |
| 158 // used to remember the size and position of the window whenever it is |
| 159 // moved or resized. This size and position is then used instead of the |
| 160 // specified bounds on subsequent opening of a window with the same id. If |
| 161 // you need to open a window with an id at a location other than the |
| 162 // remembered default, you can create it hidden, move it to the desired |
| 163 // location, then show it. |
| 164 // |
| 165 // You can also combine these various options, explicitly specifying for |
| 166 // example the size while having the position be remembered or other |
| 167 // combinations like that. Size and position are dealt with seperately, |
| 168 // but individual coordinates are not. So if you specify a top (or left) |
| 169 // coordinate, you should also specify a left (or top) coordinate, and |
| 170 // similar for size. |
| 171 // |
| 172 // If you specify both a regular and a default value for the same option |
| 173 // the regular value is the only one that takes effect. |
| 174 static void create(DOMString url, |
| 175 optional CreateWindowOptions options, |
| 176 optional CreateWindowCallback callback); |
| 177 |
| 178 // Returns an $ref:AppWindow object for the |
| 179 // current script context (ie JavaScript 'window' object). This can also be |
| 180 // called on a handle to a script context for another page, for example: |
| 181 // otherWindow.chrome.app.window.current(). |
| 182 [nocompile] static AppWindow current(); |
| 183 [nocompile, nodoc] static void initializeAppWindow(object state); |
| 184 }; |
| 185 |
| 186 interface Events { |
| 187 // Fired when the window is resized. |
| 188 [nocompile] static void onBoundsChanged(); |
| 189 |
| 190 // Fired when the window is closed. |
| 191 [nocompile] static void onClosed(); |
| 192 |
| 193 // Fired when the window is maximized. |
| 194 [nocompile] static void onMaximized(); |
| 195 |
| 196 // Fired when the window is minimized. |
| 197 [nocompile] static void onMinimized(); |
| 198 |
| 199 // Fired when the window is restored from being minimized or maximized. |
| 200 [nocompile] static void onRestored(); |
| 201 }; |
| 202 }; |
| OLD | NEW |