summaryrefslogtreecommitdiffstats
path: root/apps/app_window_contents.cc
diff options
context:
space:
mode:
authorjackhou@chromium.org <jackhou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-30 09:29:22 +0000
committerjackhou@chromium.org <jackhou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-30 09:29:22 +0000
commitcd474661963069633e721aa6aef3924db8ec4728 (patch)
treed866a2b65563fc7c50e0e704bf79aa283c5b0afc /apps/app_window_contents.cc
parentbbd08266ba6e5c1c8979a0fdee54450bf821fafe (diff)
downloadchromium_src-cd474661963069633e721aa6aef3924db8ec4728.zip
chromium_src-cd474661963069633e721aa6aef3924db8ec4728.tar.gz
chromium_src-cd474661963069633e721aa6aef3924db8ec4728.tar.bz2
Add chrome.app.window.[get|set][Min|Max][Width|Height]
For API proposal: http://goo.gl/nd2Pc2 This implements the bindings for the API. BUG=305477 Review URL: https://codereview.chromium.org/25449002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@231780 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'apps/app_window_contents.cc')
-rw-r--r--apps/app_window_contents.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/apps/app_window_contents.cc b/apps/app_window_contents.cc
index 4f11a10..751ccc2 100644
--- a/apps/app_window_contents.cc
+++ b/apps/app_window_contents.cc
@@ -19,6 +19,12 @@
namespace app_window = extensions::api::app_window;
+namespace {
+
+const int kUnboundedSize = apps::ShellWindow::SizeConstraints::kUnboundedSize;
+
+}
+
namespace apps {
AppWindowContents::AppWindowContents(ShellWindow* host)
@@ -94,6 +100,19 @@ void AppWindowContents::NativeWindowChanged(
dictionary->SetBoolean("maximized", native_app_window->IsMaximized());
dictionary->SetBoolean("alwaysOnTop", native_app_window->IsAlwaysOnTop());
+ const ShellWindow::SizeConstraints& size_constraints =
+ host_->size_constraints();
+ gfx::Size min_size = size_constraints.GetMinimumSize();
+ gfx::Size max_size = size_constraints.GetMaximumSize();
+ if (min_size.width() != kUnboundedSize)
+ dictionary->SetInteger("minWidth", min_size.width());
+ if (min_size.height() != kUnboundedSize)
+ dictionary->SetInteger("minHeight", min_size.height());
+ if (max_size.width() != kUnboundedSize)
+ dictionary->SetInteger("maxWidth", max_size.width());
+ if (max_size.height() != kUnboundedSize)
+ dictionary->SetInteger("maxHeight", max_size.height());
+
content::RenderViewHost* rvh = web_contents_->GetRenderViewHost();
rvh->Send(new ExtensionMsg_MessageInvoke(rvh->GetRoutingID(),
host_->extension_id(),