| 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. | 7 // associated with any Chrome browser windows. |
| 8 namespace app.window { | 8 namespace app.window { |
| 9 | 9 |
| 10 // Previously named Bounds. | 10 // Previously named Bounds. |
| 11 dictionary ContentBounds { | 11 dictionary ContentBounds { |
| 12 long? left; | 12 long? left; |
| 13 long? top; | 13 long? top; |
| 14 long? width; | 14 long? width; |
| 15 long? height; | 15 long? height; |
| 16 }; | 16 }; |
| 17 | 17 |
| 18 [nodoc] dictionary BoundsSpecification { | 18 dictionary BoundsSpecification { |
| 19 // The X coordinate of the content or window. | 19 // The X coordinate of the content or window. |
| 20 long? left; | 20 long? left; |
| 21 | 21 |
| 22 // The Y coordinate of the content or window. | 22 // The Y coordinate of the content or window. |
| 23 long? top; | 23 long? top; |
| 24 | 24 |
| 25 // The width of the content or window. | 25 // The width of the content or window. |
| 26 long? width; | 26 long? width; |
| 27 | 27 |
| 28 // The height of the content or window. | 28 // The height of the content or window. |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 | 86 |
| 87 dictionary CreateWindowOptions { | 87 dictionary CreateWindowOptions { |
| 88 // Id to identify the window. This will be used to remember the size | 88 // Id to identify the window. This will be used to remember the size |
| 89 // and position of the window and restore that geometry when a window | 89 // and position of the window and restore that geometry when a window |
| 90 // with the same id is later opened. | 90 // with the same id is later opened. |
| 91 // If a window with a given id is created while another window with the same | 91 // If a window with a given id is created while another window with the same |
| 92 // id already exists, the currently opened window will be focused instead of | 92 // id already exists, the currently opened window will be focused instead of |
| 93 // creating a new window. | 93 // creating a new window. |
| 94 DOMString? id; | 94 DOMString? id; |
| 95 | 95 |
| 96 // Used to specify the initial position, initial size and constraints of the |
| 97 // window's content (excluding window decorations). |
| 98 // If an <code>id</code> is also specified and a window with a matching |
| 99 // <code>id</code> has been shown before, the remembered bounds will be used |
| 100 // instead. |
| 101 // |
| 102 // Note that the padding between the inner and outer bounds is determined by |
| 103 // the OS. Therefore setting the same bounds property for both the |
| 104 // <code>innerBounds</code> and <code>outerBounds</code> will result in an |
| 105 // error. |
| 106 // |
| 107 // Currently only available on the Dev channel from Chrome 35. |
| 108 BoundsSpecification? innerBounds; |
| 109 |
| 110 // Used to specify the initial position, initial size and constraints of the |
| 111 // window (including window decorations such as the title bar and frame). |
| 112 // If an <code>id</code> is also specified and a window with a matching |
| 113 // <code>id</code> has been shown before, the remembered bounds will be used |
| 114 // instead. |
| 115 // |
| 116 // Note that the padding between the inner and outer bounds is determined by |
| 117 // the OS. Therefore setting the same bounds property for both the |
| 118 // <code>innerBounds</code> and <code>outerBounds</code> will result in an |
| 119 // error. |
| 120 // |
| 121 // Currently only available on the Dev channel from Chrome 35. |
| 122 BoundsSpecification? outerBounds; |
| 123 |
| 96 // Default width of the window. | 124 // Default width of the window. |
| 97 [nodoc, deprecated="Use $ref:BoundsSpecification."] long? defaultWidth; | 125 [nodoc, deprecated="Use $ref:BoundsSpecification."] long? defaultWidth; |
| 98 | 126 |
| 99 // Default height of the window. | 127 // Default height of the window. |
| 100 [nodoc, deprecated="Use $ref:BoundsSpecification."] long? defaultHeight; | 128 [nodoc, deprecated="Use $ref:BoundsSpecification."] long? defaultHeight; |
| 101 | 129 |
| 102 // Default X coordinate of the window. | 130 // Default X coordinate of the window. |
| 103 [nodoc, deprecated="Use $ref:BoundsSpecification."] long? defaultLeft; | 131 [nodoc, deprecated="Use $ref:BoundsSpecification."] long? defaultLeft; |
| 104 | 132 |
| 105 // Default Y coordinate of the window. | 133 // Default Y coordinate of the window. |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 | 273 |
| 246 // Hide the window. Does nothing if the window is already hidden. | 274 // Hide the window. Does nothing if the window is already hidden. |
| 247 static void hide(); | 275 static void hide(); |
| 248 | 276 |
| 249 // Get the window's inner bounds as a $ref:ContentBounds object. | 277 // Get the window's inner bounds as a $ref:ContentBounds object. |
| 250 [nocompile] static ContentBounds getBounds(); | 278 [nocompile] static ContentBounds getBounds(); |
| 251 | 279 |
| 252 // Set the window's inner bounds. | 280 // Set the window's inner bounds. |
| 253 static void setBounds(ContentBounds bounds); | 281 static void setBounds(ContentBounds bounds); |
| 254 | 282 |
| 255 // Get the current minimum width of the window. Returns |undefined| if there | 283 // Get the current minimum width of the window. Returns <code>null</code> if |
| 256 // is no minimum. Currently only available on the Dev channel. | 284 // there is no minimum. Currently only available on the Dev channel. |
| 257 [nocompile] static long getMinWidth(); | 285 [nocompile] static long getMinWidth(); |
| 258 | 286 |
| 259 // Get the current minimum height of the window. Returns |undefined| if | 287 // Get the current minimum height of the window. Returns <code>null</code> |
| 260 // there is no minimum. Currently only available on the Dev channel. | 288 // if there is no minimum. Currently only available on the Dev channel. |
| 261 [nocompile] static long getMinHeight(); | 289 [nocompile] static long getMinHeight(); |
| 262 | 290 |
| 263 // Get the current maximum width of the window. Returns |undefined| if there | 291 // Get the current maximum width of the window. Returns <code>null</code> if |
| 264 // is no maximum. Currently only available on the Dev channel. | 292 // there is no maximum. Currently only available on the Dev channel. |
| 265 [nocompile] static long getMaxWidth(); | 293 [nocompile] static long getMaxWidth(); |
| 266 | 294 |
| 267 // Get the current maximum height of the window. Returns |undefined| if | 295 // Get the current maximum height of the window. Returns <code>null</code> |
| 268 // there is no maximum. Currently only available on the Dev channel. | 296 // if there is no maximum. Currently only available on the Dev channel. |
| 269 [nocompile] static long getMaxHeight(); | 297 [nocompile] static long getMaxHeight(); |
| 270 | 298 |
| 271 // Set the current minimum width of the window. Set to |null| to remove the | 299 // Set the current minimum width of the window. Set to <code>null</code> to |
| 272 // constraint. Currently only available on the Dev channel. | 300 // remove the constraint. Currently only available on the Dev channel. |
| 273 static void setMinWidth(optional long minWidth); | 301 static void setMinWidth(optional long minWidth); |
| 274 | 302 |
| 275 // Set the current minimum height of the window. Set to |null| to remove the | 303 // Set the current minimum height of the window. Set to <code>null</code> to |
| 276 // constraint. Currently only available on the Dev channel. | 304 // remove the constraint. Currently only available on the Dev channel. |
| 277 static void setMinHeight(optional long minHeight); | 305 static void setMinHeight(optional long minHeight); |
| 278 | 306 |
| 279 // Set the current maximum width of the window. Set to |null| to remove the | 307 // Set the current maximum width of the window. Set to <code>null</code> to |
| 280 // constraint. Currently only available on the Dev channel. | 308 // remove the constraint. Currently only available on the Dev channel. |
| 281 static void setMaxWidth(optional long maxWidth); | 309 static void setMaxWidth(optional long maxWidth); |
| 282 | 310 |
| 283 // Set the current maximum height of the window. Set to |null| to remove the | 311 // Set the current maximum height of the window. Set to <code>null</code> to |
| 284 // constraint. Currently only available on the Dev channel. | 312 // remove the constraint. Currently only available on the Dev channel. |
| 285 static void setMaxHeight(optional long maxHeight); | 313 static void setMaxHeight(optional long maxHeight); |
| 286 | 314 |
| 287 // Set the app icon for the window (experimental). | 315 // Set the app icon for the window (experimental). |
| 288 // Currently this is only being implemented on Ash. | 316 // Currently this is only being implemented on Ash. |
| 289 // TODO(stevenjb): Investigate implementing this on Windows and OSX. | 317 // TODO(stevenjb): Investigate implementing this on Windows and OSX. |
| 290 [nodoc] static void setIcon(DOMString iconUrl); | 318 [nodoc] static void setIcon(DOMString iconUrl); |
| 291 | 319 |
| 292 // Set a badge icon for the window. | 320 // Set a badge icon for the window. |
| 293 // TODO(benwells): Document this properly before going to stable. | 321 // TODO(benwells): Document this properly before going to stable. |
| 294 [nodoc] static void setBadgeIcon(DOMString iconUrl); | 322 [nodoc] static void setBadgeIcon(DOMString iconUrl); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 324 // Currently only available on the Dev channel from Chrome 35. | 352 // Currently only available on the Dev channel from Chrome 35. |
| 325 Bounds outerBounds; | 353 Bounds outerBounds; |
| 326 }; | 354 }; |
| 327 | 355 |
| 328 interface Functions { | 356 interface Functions { |
| 329 // The size and position of a window can be specified in a number of | 357 // The size and position of a window can be specified in a number of |
| 330 // different ways. The most simple option is not specifying anything at | 358 // different ways. The most simple option is not specifying anything at |
| 331 // all, in which case a default size and platform dependent position will | 359 // all, in which case a default size and platform dependent position will |
| 332 // be used. | 360 // be used. |
| 333 // | 361 // |
| 334 // Another option is to use the bounds property, which will put the window | 362 // Another option is to use the <code>bounds</code> property, which will put |
| 335 // at the specified coordinates with the specified size. If the window has | 363 // the window at the specified coordinates with the specified size. If the |
| 336 // a frame, it's total size will be the size given plus the size of the | 364 // window has a frame, it's total size will be the size given plus the size |
| 337 // frame; that is, the size in bounds is the content size, not the window | 365 // of the frame; that is, the size in bounds is the content size, not the |
| 338 // size. | 366 // window size. |
| 339 // | 367 // |
| 340 // To automatically remember the positions of windows you can give them ids. | 368 // To automatically remember the positions of windows you can give them ids. |
| 341 // If a window has an id, This id is used to remember the size and position | 369 // If a window has an id, This id is used to remember the size and position |
| 342 // of the window whenever it is moved or resized. This size and position is | 370 // of the window whenever it is moved or resized. This size and position is |
| 343 // then used instead of the specified bounds on subsequent opening of a | 371 // then used instead of the specified bounds on subsequent opening of a |
| 344 // window with the same id. If you need to open a window with an id at a | 372 // window with the same id. If you need to open a window with an id at a |
| 345 // location other than the remembered default, you can create it hidden, | 373 // location other than the remembered default, you can create it hidden, |
| 346 // move it to the desired location, then show it. | 374 // move it to the desired location, then show it. |
| 347 static void create(DOMString url, | 375 static void create(DOMString url, |
| 348 optional CreateWindowOptions options, | 376 optional CreateWindowOptions options, |
| (...skipping 28 matching lines...) Expand all Loading... |
| 377 // Fired when the window is maximized. | 405 // Fired when the window is maximized. |
| 378 [nocompile] static void onMaximized(); | 406 [nocompile] static void onMaximized(); |
| 379 | 407 |
| 380 // Fired when the window is minimized. | 408 // Fired when the window is minimized. |
| 381 [nocompile] static void onMinimized(); | 409 [nocompile] static void onMinimized(); |
| 382 | 410 |
| 383 // Fired when the window is restored from being minimized or maximized. | 411 // Fired when the window is restored from being minimized or maximized. |
| 384 [nocompile] static void onRestored(); | 412 [nocompile] static void onRestored(); |
| 385 }; | 413 }; |
| 386 }; | 414 }; |
| OLD | NEW |