| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 namespace app.window { | 5 namespace app.window { |
| 6 dictionary Bounds { | 6 dictionary Bounds { |
| 7 long? left; | 7 long? left; |
| 8 long? top; | 8 long? top; |
| 9 long? width; | 9 long? width; |
| 10 long? height; | 10 long? height; |
| 11 }; | 11 }; |
| 12 | 12 |
| 13 // State of a window: normal, fullscreen, maximized, minimized. | 13 // State of a window: normal, fullscreen, maximized, minimized. |
| 14 enum State { normal, fullscreen, maximized, minimized }; | 14 enum State { normal, fullscreen, maximized, minimized }; |
| 15 | 15 |
| 16 // 'shell' is the default window type. 'panel' is managed by the OS | 16 // 'shell' is the default window type. 'panel' is managed by the OS |
| 17 // (Currently experimental, Ash only). | 17 // (Currently experimental, Ash only). |
| 18 [nodoc] enum WindowType { shell, panel }; | 18 [nodoc] enum WindowType { shell, panel }; |
| 19 | 19 |
| 20 dictionary CreateWindowOptions { | 20 dictionary CreateWindowOptions { |
| 21 // Id to identify the window. This will be used to remember the size | 21 // Id to identify the window. This will be used to remember the size |
| 22 // and position of the window and restore that geometry when a window | 22 // and position of the window and restore that geometry when a window |
| 23 // with the same id (and no explicit size or position) is later opened. | 23 // with the same id is later opened. |
| 24 DOMString? id; | 24 DOMString? id; |
| 25 | 25 |
| 26 // Default width of the window. (Deprecated; regular bounds act like this | 26 // Default width of the window. (Deprecated; regular bounds act like this |
| 27 // now.) | 27 // now.) |
| 28 [nodoc] long? defaultWidth; | 28 [nodoc] long? defaultWidth; |
| 29 | 29 |
| 30 // Default height of the window. (Deprecated; regular bounds act like this | 30 // Default height of the window. (Deprecated; regular bounds act like this |
| 31 // now.) | 31 // now.) |
| 32 [nodoc] long? defaultHeight; | 32 [nodoc] long? defaultHeight; |
| 33 | 33 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 62 | 62 |
| 63 // Maximum height for the lifetime of the window. | 63 // Maximum height for the lifetime of the window. |
| 64 long? maxHeight; | 64 long? maxHeight; |
| 65 | 65 |
| 66 // Type of window to create. | 66 // Type of window to create. |
| 67 [nodoc] WindowType? type; | 67 [nodoc] WindowType? type; |
| 68 | 68 |
| 69 // Frame type: 'none' or 'chrome' (defaults to 'chrome'). | 69 // Frame type: 'none' or 'chrome' (defaults to 'chrome'). |
| 70 DOMString? frame; | 70 DOMString? frame; |
| 71 | 71 |
| 72 // Size of the content in the window (excluding the titlebar). If specified | 72 // Size and position of the content in the window (excluding the titlebar). |
| 73 // in addition to any of the deprecated left/top/width/height parameters, | 73 // If an id is also specified and a window with a matching id has been shown |
| 74 // this field takes precedence. | 74 // before, the remembered bounds of the window will be used instead. |
| 75 Bounds? bounds; | 75 Bounds? bounds; |
| 76 | 76 |
| 77 // Enable window background transparency. | 77 // Enable window background transparency. |
| 78 // Only supported in ash. Requires experimental API permission. | 78 // Only supported in ash. Requires experimental API permission. |
| 79 boolean? transparentBackground; | 79 boolean? transparentBackground; |
| 80 | 80 |
| 81 // The initial state of the window, allowing it to be created already | 81 // The initial state of the window, allowing it to be created already |
| 82 // fullscreen, maximized, or minimized. Defaults to 'normal'. | 82 // fullscreen, maximized, or minimized. Defaults to 'normal'. |
| 83 State? state; | 83 State? state; |
| 84 | 84 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 // The JavaScript 'window' object for the created child. | 160 // The JavaScript 'window' object for the created child. |
| 161 [instanceOf=global] object contentWindow; | 161 [instanceOf=global] object contentWindow; |
| 162 }; | 162 }; |
| 163 | 163 |
| 164 interface Functions { | 164 interface Functions { |
| 165 // The size and position of a window can be specified in a number of | 165 // The size and position of a window can be specified in a number of |
| 166 // different ways. The most simple option is not specifying anything at | 166 // different ways. The most simple option is not specifying anything at |
| 167 // all, in which case a default size and platform dependent position will | 167 // all, in which case a default size and platform dependent position will |
| 168 // be used. | 168 // be used. |
| 169 // | 169 // |
| 170 // Another option is to use the top/left and width/height properties, | 170 // Another option is to use the bounds property, which will put the window |
| 171 // which will always put the window at the specified coordinates with the | 171 // at the specified coordinates with the specified size. If the window has |
| 172 // specified size. | 172 // a frame, it's total size will be the size given plus the size of the |
| 173 // frame; that is, the size in bounds is the content size, not the window |
| 174 // size. |
| 173 // | 175 // |
| 174 // Yet another option is to give the window a (unique) id. This id is then | 176 // To automatically remember the positions of windows you can give them ids. |
| 175 // used to remember the size and position of the window whenever it is | 177 // If a window has an id, This id is used to remember the size and position |
| 176 // moved or resized. This size and position is then used instead of the | 178 // of the window whenever it is moved or resized. This size and position is |
| 177 // specified bounds on subsequent opening of a window with the same id. If | 179 // then used instead of the specified bounds on subsequent opening of a |
| 178 // you need to open a window with an id at a location other than the | 180 // window with the same id. If you need to open a window with an id at a |
| 179 // remembered default, you can create it hidden, move it to the desired | 181 // location other than the remembered default, you can create it hidden, |
| 180 // location, then show it. | 182 // move it to the desired location, then show it. |
| 181 // | |
| 182 // You can also combine these various options, explicitly specifying for | |
| 183 // example the size while having the position be remembered or other | |
| 184 // combinations like that. Size and position are dealt with seperately, | |
| 185 // but individual coordinates are not. So if you specify a top (or left) | |
| 186 // coordinate, you should also specify a left (or top) coordinate, and | |
| 187 // similar for size. | |
| 188 // | |
| 189 // If you specify both a regular and a default value for the same option | |
| 190 // the regular value is the only one that takes effect. | |
| 191 static void create(DOMString url, | 183 static void create(DOMString url, |
| 192 optional CreateWindowOptions options, | 184 optional CreateWindowOptions options, |
| 193 optional CreateWindowCallback callback); | 185 optional CreateWindowCallback callback); |
| 194 | 186 |
| 195 // Returns an $ref:AppWindow object for the | 187 // Returns an $ref:AppWindow object for the |
| 196 // current script context (ie JavaScript 'window' object). This can also be | 188 // current script context (ie JavaScript 'window' object). This can also be |
| 197 // called on a handle to a script context for another page, for example: | 189 // called on a handle to a script context for another page, for example: |
| 198 // otherWindow.chrome.app.window.current(). | 190 // otherWindow.chrome.app.window.current(). |
| 199 [nocompile] static AppWindow current(); | 191 [nocompile] static AppWindow current(); |
| 200 [nocompile, nodoc] static void initializeAppWindow(object state); | 192 [nocompile, nodoc] static void initializeAppWindow(object state); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 213 // Fired when the window is maximized. | 205 // Fired when the window is maximized. |
| 214 [nocompile] static void onMaximized(); | 206 [nocompile] static void onMaximized(); |
| 215 | 207 |
| 216 // Fired when the window is minimized. | 208 // Fired when the window is minimized. |
| 217 [nocompile] static void onMinimized(); | 209 [nocompile] static void onMinimized(); |
| 218 | 210 |
| 219 // Fired when the window is restored from being minimized or maximized. | 211 // Fired when the window is restored from being minimized or maximized. |
| 220 [nocompile] static void onRestored(); | 212 [nocompile] static void onRestored(); |
| 221 }; | 213 }; |
| 222 }; | 214 }; |
| OLD | NEW |