diff options
author | jeremya@chromium.org <jeremya@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-13 07:33:31 +0000 |
---|---|---|
committer | jeremya@chromium.org <jeremya@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-13 07:33:31 +0000 |
commit | 95f871f6e57bb0e28db00f65ce2df86419c92ce6 (patch) | |
tree | 1c17975a881ac697fd9621cefd5b8af2ceb33bf9 | |
parent | 14109304691b1aae9a60d53aa7686688f81e6cc2 (diff) | |
download | chromium_src-95f871f6e57bb0e28db00f65ce2df86419c92ce6.zip chromium_src-95f871f6e57bb0e28db00f65ce2df86419c92ce6.tar.gz chromium_src-95f871f6e57bb0e28db00f65ce2df86419c92ce6.tar.bz2 |
Add a 'bounds' property to app.window.create options.
This is a synonym for left/top/width/height.
BUG=155240
Review URL: https://chromiumcodereview.appspot.com/11358003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@167319 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/extensions/api/app_window/app_window_api.cc | 12 | ||||
-rw-r--r-- | chrome/common/extensions/api/app_window.idl | 24 | ||||
-rw-r--r-- | chrome/test/data/extensions/platform_apps/windows_api/test.js | 2 |
3 files changed, 28 insertions, 10 deletions
diff --git a/chrome/browser/extensions/api/app_window/app_window_api.cc b/chrome/browser/extensions/api/app_window/app_window_api.cc index f6f85c0..7477699 100644 --- a/chrome/browser/extensions/api/app_window/app_window_api.cc +++ b/chrome/browser/extensions/api/app_window/app_window_api.cc @@ -138,6 +138,18 @@ bool AppWindowCreateFunction::RunImpl() { create_params.restore_position = false; } + if (options->bounds.get()) { + app_window::Bounds* bounds = options->bounds.get(); + if (bounds->width.get()) + create_params.bounds.set_width(*bounds->width.get()); + if (bounds->height.get()) + create_params.bounds.set_height(*bounds->height.get()); + if (bounds->left.get()) + create_params.bounds.set_x(*bounds->left.get()); + if (bounds->top.get()) + create_params.bounds.set_y(*bounds->top.get()); + } + if (options->frame.get()) { if (*options->frame == kHtmlFrameOption && CommandLine::ForCurrentProcess()->HasSwitch( diff --git a/chrome/common/extensions/api/app_window.idl b/chrome/common/extensions/api/app_window.idl index 2d3037b..31e8727 100644 --- a/chrome/common/extensions/api/app_window.idl +++ b/chrome/common/extensions/api/app_window.idl @@ -21,17 +21,17 @@ namespace app.window { // Default Y coordinate of the window. long? defaultTop; - // Width of the window. - long? width; + // Width of the window. (Deprecated; use 'bounds'.) + [nodoc] long? width; - // Height of the window. - long? height; + // Height of the window. (Deprecated; use 'bounds'.) + [nodoc] long? height; - // X coordinate of the window. - long? left; + // X coordinate of the window. (Deprecated; use 'bounds'.) + [nodoc] long? left; - // Y coordinate of the window. - long? top; + // Y coordinate of the window. (Deprecated; use 'bounds'.) + [nodoc] long? top; // Minimium width of the window. long? minWidth; @@ -46,11 +46,17 @@ namespace app.window { long? maxHeight; // Window type: 'shell' (the default) is the only currently supported value. - DOMString? type; + [nodoc] DOMString? type; // Frame type: 'none' or 'chrome' (defaults to 'chrome'). DOMString? frame; + // Size of the content in the window (excluding the titlebar). If specified + // in addition to any of the left/top/width/height parameters, this field + // takes precedence. If a frameBounds is specified, the frameBounds take + // precedence. + Bounds? bounds; + // If true, the window will be created in a hidden state. Call show() on // the window to show it once it has been created. Defaults to false. boolean? hidden; diff --git a/chrome/test/data/extensions/platform_apps/windows_api/test.js b/chrome/test/data/extensions/platform_apps/windows_api/test.js index eeee3b7..812acc4 100644 --- a/chrome/test/data/extensions/platform_apps/windows_api/test.js +++ b/chrome/test/data/extensions/platform_apps/windows_api/test.js @@ -60,7 +60,7 @@ chrome.app.runtime.onLaunched.addListener(function() { function testContentSize() { chrome.app.window.create('test.html', - {width: 250, height: 200}, callbackPass(function(win) { + {bounds: { width: 250, height: 200 }}, callbackPass(function(win) { chrome.test.assertEq(250, win.contentWindow.innerWidth); chrome.test.assertEq(200, win.contentWindow.innerHeight); win.close(); |