Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1768)

Unified Diff: apps/app_window_contents.cc

Issue 25449002: Add chrome.app.window.[get|set][Min|Max][Width|Height] (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync and rebase Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/extensions/api/app_current_window_internal/app_current_window_internal_api.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: apps/app_window_contents.cc
diff --git a/apps/app_window_contents.cc b/apps/app_window_contents.cc
index 4f11a10e680439f8163f41e22cbcb60c5d02d8cf..751ccc2d3535152d0e65a6e01c14455e372bb777 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(),
« no previous file with comments | « no previous file | chrome/browser/extensions/api/app_current_window_internal/app_current_window_internal_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698