| 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 // Use the <code>chrome.app.window</code> API to create windows. Windows | 5 // Use the <code>chrome.app.window</code> API to create windows. Windows |
| 6 // have an optional frame with title bar and size controls. They are not | 6 // have an optional frame with title bar and size controls. They are not |
| 7 // associated with any Chrome browser windows. See the <a | 7 // associated with any Chrome browser windows. See the <a |
| 8 // href="https://github.com/GoogleChrome/chrome-app-samples/tree/master/window-s
tate"> | 8 // href="https://github.com/GoogleChrome/chrome-app-samples/tree/master/window-s
tate"> |
| 9 // Window State Sample</a> for a demonstration of these options. | 9 // Window State Sample</a> for a demonstration of these options. |
| 10 namespace app.window { | 10 namespace app.window { |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 static void setMinimumSize(long minWidth, long minHeight); | 92 static void setMinimumSize(long minWidth, long minHeight); |
| 93 | 93 |
| 94 // Set the maximum size constraints of the content or window. The maximum | 94 // Set the maximum size constraints of the content or window. The maximum |
| 95 // width or height can be set to <code>null</code> to remove the constraint. | 95 // width or height can be set to <code>null</code> to remove the constraint. |
| 96 // A value of <code>undefined</code> will leave a constraint unchanged. | 96 // A value of <code>undefined</code> will leave a constraint unchanged. |
| 97 static void setMaximumSize(long maxWidth, long maxHeight); | 97 static void setMaximumSize(long maxWidth, long maxHeight); |
| 98 }; | 98 }; |
| 99 | 99 |
| 100 dictionary FrameOptions { | 100 dictionary FrameOptions { |
| 101 // Frame type: <code>none</code> or <code>chrome</code> (defaults to | 101 // Frame type: <code>none</code> or <code>chrome</code> (defaults to |
| 102 // <code>chrome</code>).<br> | 102 // <code>chrome</code>). |
| 103 // |
| 103 // For <code>none</code>, the <code>-webkit-app-region</code> CSS property | 104 // For <code>none</code>, the <code>-webkit-app-region</code> CSS property |
| 104 // can be used to apply draggability to the app's window. | 105 // can be used to apply draggability to the app's window. |
| 106 // |
| 105 // <code>-webkit-app-region: drag</code> can be used to mark regions | 107 // <code>-webkit-app-region: drag</code> can be used to mark regions |
| 106 // draggable. <code>no-drag</code> can be used to disable this style on | 108 // draggable. <code>no-drag</code> can be used to disable this style on |
| 107 // nested elements.<br> | 109 // nested elements. |
| 108 DOMString? type; | 110 DOMString? type; |
| 109 // Allows the frame color to be set. Frame coloring is only available if the | 111 // Allows the frame color to be set. Frame coloring is only available if the |
| 110 // frame type is <code>chrome</code>.<br> | 112 // frame type is <code>chrome</code>. |
| 113 // |
| 111 // Frame coloring is new in Chrome 36. | 114 // Frame coloring is new in Chrome 36. |
| 112 DOMString? color; | 115 DOMString? color; |
| 113 // Allows the frame color of the window when active to be set. Frame | 116 // Allows the frame color of the window when active to be set. Frame |
| 114 // coloring is only available if the frame type is <code>chrome</code>.<br> | 117 // coloring is only available if the frame type is <code>chrome</code>. |
| 118 // |
| 115 // Frame coloring is only available if the frame type is | 119 // Frame coloring is only available if the frame type is |
| 116 // <code>chrome</code>.<br> | 120 // <code>chrome</code>. |
| 121 // |
| 117 // Frame coloring is new in Chrome 36. | 122 // Frame coloring is new in Chrome 36. |
| 118 DOMString? activeColor; | 123 DOMString? activeColor; |
| 119 // Allows the frame color of the window when inactive to be set differently | 124 // Allows the frame color of the window when inactive to be set differently |
| 120 // to the active color. Frame | 125 // to the active color. Frame |
| 121 // coloring is only available if the frame type is <code>chrome</code>.<br> | 126 // coloring is only available if the frame type is <code>chrome</code>. |
| 127 // |
| 122 // <code>inactiveColor</code> must be used in conjunction with <code> | 128 // <code>inactiveColor</code> must be used in conjunction with <code> |
| 123 // color</code>.<br> | 129 // color</code>. |
| 130 // |
| 124 // Frame coloring is new in Chrome 36. | 131 // Frame coloring is new in Chrome 36. |
| 125 DOMString? inactiveColor; | 132 DOMString? inactiveColor; |
| 126 }; | 133 }; |
| 127 | 134 |
| 128 // State of a window: normal, fullscreen, maximized, minimized. | 135 // State of a window: normal, fullscreen, maximized, minimized. |
| 129 enum State { normal, fullscreen, maximized, minimized }; | 136 enum State { normal, fullscreen, maximized, minimized }; |
| 130 | 137 |
| 131 // 'shell' is the default window type. 'panel' is managed by the OS | 138 // 'shell' is the default window type. 'panel' is managed by the OS |
| 132 // (Currently experimental, Ash only). | 139 // (Currently experimental, Ash only). |
| 133 [nodoc] enum WindowType { shell, panel }; | 140 [nodoc] enum WindowType { shell, panel }; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 [deprecated="Use innerBounds or outerBounds."] long? maxHeight; | 213 [deprecated="Use innerBounds or outerBounds."] long? maxHeight; |
| 207 | 214 |
| 208 // Type of window to create. | 215 // Type of window to create. |
| 209 [nodoc] WindowType? type; | 216 [nodoc] WindowType? type; |
| 210 | 217 |
| 211 // Frame type: <code>none</code> or <code>chrome</code> (defaults to | 218 // Frame type: <code>none</code> or <code>chrome</code> (defaults to |
| 212 // <code>chrome</code>). For <code>none</code>, the | 219 // <code>chrome</code>). For <code>none</code>, the |
| 213 // <code>-webkit-app-region</code> CSS property can be used to apply | 220 // <code>-webkit-app-region</code> CSS property can be used to apply |
| 214 // draggability to the app's window. <code>-webkit-app-region: drag</code> | 221 // draggability to the app's window. <code>-webkit-app-region: drag</code> |
| 215 // can be used to mark regions draggable. <code>no-drag</code> can be used | 222 // can be used to mark regions draggable. <code>no-drag</code> can be used |
| 216 // to disable this style on nested elements.<br> | 223 // to disable this style on nested elements. |
| 224 // |
| 217 // Use of <code>FrameOptions</code> is new in M36. | 225 // Use of <code>FrameOptions</code> is new in M36. |
| 218 (DOMString or FrameOptions)? frame; | 226 (DOMString or FrameOptions)? frame; |
| 219 | 227 |
| 220 // Size and position of the content in the window (excluding the titlebar). | 228 // Size and position of the content in the window (excluding the titlebar). |
| 221 // If an id is also specified and a window with a matching id has been shown | 229 // If an id is also specified and a window with a matching id has been shown |
| 222 // before, the remembered bounds of the window will be used instead. | 230 // before, the remembered bounds of the window will be used instead. |
| 223 [deprecated="Use innerBounds or outerBounds."] ContentBounds? bounds; | 231 [deprecated="Use innerBounds or outerBounds."] ContentBounds? bounds; |
| 224 | 232 |
| 225 // Enable window background transparency. | 233 // Enable window background transparency. |
| 226 // Only supported in ash. Requires experimental API permission. | 234 // Only supported in ash. Requires experimental API permission. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 240 // By default if you specify an id for the window, the window will only be | 248 // By default if you specify an id for the window, the window will only be |
| 241 // created if another window with the same id doesn't already exist. If a | 249 // created if another window with the same id doesn't already exist. If a |
| 242 // window with the same id already exists that window is activated instead. | 250 // window with the same id already exists that window is activated instead. |
| 243 // If you do want to create multiple windows with the same id, you can | 251 // If you do want to create multiple windows with the same id, you can |
| 244 // set this property to false. | 252 // set this property to false. |
| 245 [deprecated="Multiple windows with the same id is no longer supported."] boo
lean? singleton; | 253 [deprecated="Multiple windows with the same id is no longer supported."] boo
lean? singleton; |
| 246 | 254 |
| 247 // If true, the window will stay above most other windows. If there are | 255 // If true, the window will stay above most other windows. If there are |
| 248 // multiple windows of this kind, the currently focused window will be in | 256 // multiple windows of this kind, the currently focused window will be in |
| 249 // the foreground. Requires the <code>"alwaysOnTopWindows"</code> | 257 // the foreground. Requires the <code>"alwaysOnTopWindows"</code> |
| 250 // permission. Defaults to false.<br> | 258 // permission. Defaults to false. |
| 259 // |
| 251 // Call <code>setAlwaysOnTop()</code> on the window to change this property | 260 // Call <code>setAlwaysOnTop()</code> on the window to change this property |
| 252 // after creation.<br> | 261 // after creation. |
| 253 boolean? alwaysOnTop; | 262 boolean? alwaysOnTop; |
| 254 | 263 |
| 255 // If true, the window will be focused when created. Defaults to true. | 264 // If true, the window will be focused when created. Defaults to true. |
| 256 boolean? focused; | 265 boolean? focused; |
| 257 }; | 266 }; |
| 258 | 267 |
| 259 // Called in the creating window (parent) before the load event is called in | 268 // Called in the creating window (parent) before the load event is called in |
| 260 // the created window (child). The parent can set fields or functions on the | 269 // the created window (child). The parent can set fields or functions on the |
| 261 // child usable from onload. E.g. background.js:<br> | 270 // child usable from onload. E.g. background.js: |
| 271 // |
| 262 // <code>function(createdWindow) { createdWindow.contentWindow.foo = | 272 // <code>function(createdWindow) { createdWindow.contentWindow.foo = |
| 263 // function () { }; };</code> | 273 // function () { }; };</code> |
| 264 // <br>window.js:<br> | 274 // |
| 275 // window.js: |
| 276 // |
| 265 // <code>window.onload = function () { foo(); }</code> | 277 // <code>window.onload = function () { foo(); }</code> |
| 266 callback CreateWindowCallback = | 278 callback CreateWindowCallback = |
| 267 void ([instanceOf=AppWindow] object createdWindow); | 279 void ([instanceOf=AppWindow] object createdWindow); |
| 268 | 280 |
| 269 [noinline_doc] dictionary AppWindow { | 281 [noinline_doc] dictionary AppWindow { |
| 270 // Focus the window. | 282 // Focus the window. |
| 271 static void focus(); | 283 static void focus(); |
| 272 | 284 |
| 273 // Fullscreens the window.<br> | 285 // Fullscreens the window. |
| 286 // |
| 274 // The user will be able to restore the window by pressing ESC. An | 287 // The user will be able to restore the window by pressing ESC. An |
| 275 // application can prevent the fullscreen state to be left when ESC is | 288 // application can prevent the fullscreen state to be left when ESC is |
| 276 // pressed by requesting the <b>overrideEscFullscreen</b> permission and | 289 // pressed by requesting the <b>overrideEscFullscreen</b> permission and |
| 277 // canceling the event by calling .preventDefault(), like this:<br> | 290 // canceling the event by calling .preventDefault(), like this: |
| 291 // |
| 278 // <code>window.onKeyDown = function(e) { if (e.keyCode == 27 /* ESC */) { | 292 // <code>window.onKeyDown = function(e) { if (e.keyCode == 27 /* ESC */) { |
| 279 // e.preventDefault(); } };</code> | 293 // e.preventDefault(); } };</code> |
| 280 static void fullscreen(); | 294 static void fullscreen(); |
| 281 | 295 |
| 282 // Is the window fullscreen? | 296 // Is the window fullscreen? |
| 283 static boolean isFullscreen(); | 297 static boolean isFullscreen(); |
| 284 | 298 |
| 285 // Minimize the window. | 299 // Minimize the window. |
| 286 static void minimize(); | 300 static void minimize(); |
| 287 | 301 |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 // Fired when the window is restored from being minimized or maximized. | 451 // Fired when the window is restored from being minimized or maximized. |
| 438 [nocompile] static void onRestored(); | 452 [nocompile] static void onRestored(); |
| 439 | 453 |
| 440 // Fired when the window's ability to use alpha transparency changes. | 454 // Fired when the window's ability to use alpha transparency changes. |
| 441 [nocompile, nodoc] static void onAlphaEnabledChanged(); | 455 [nocompile, nodoc] static void onAlphaEnabledChanged(); |
| 442 | 456 |
| 443 // Event for testing. Lets tests wait until a window has been shown. | 457 // Event for testing. Lets tests wait until a window has been shown. |
| 444 [nocompile, nodoc] static void onWindowFirstShown(); | 458 [nocompile, nodoc] static void onWindowFirstShown(); |
| 445 }; | 459 }; |
| 446 }; | 460 }; |
| OLD | NEW |