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

Unified Diff: chrome/browser/extensions/api/app_window/app_window_api.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
Index: chrome/browser/extensions/api/app_window/app_window_api.cc
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 92fe656df91b9b94f07a699610530db8291e9f68..3a95c7624b835d073e3b376cfd56a31d15cef199 100644
--- a/chrome/browser/extensions/api/app_window/app_window_api.cc
+++ b/chrome/browser/extensions/api/app_window/app_window_api.cc
@@ -52,6 +52,8 @@ const char kHtmlFrameOption[] = "experimental-html";
namespace {
+const int kUnboundedSize = apps::ShellWindow::SizeConstraints::kUnboundedSize;
+
// Opens an inspector window and delays the response to the
// AppWindowCreateFunction until the DevToolsWindow has finished loading, and is
// ready to stop on breakpoints in the callback.
@@ -101,6 +103,19 @@ void SetCreateResultFromShellWindow(ShellWindow* window,
boundsValue->SetInteger("width", bounds.width());
boundsValue->SetInteger("height", bounds.height());
result->Set("bounds", boundsValue);
+
+ const ShellWindow::SizeConstraints& size_constraints =
+ window->size_constraints();
+ gfx::Size min_size = size_constraints.GetMinimumSize();
+ gfx::Size max_size = size_constraints.GetMaximumSize();
+ if (min_size.width() != kUnboundedSize)
+ result->SetInteger("minWidth", min_size.width());
+ if (min_size.height() != kUnboundedSize)
+ result->SetInteger("minHeight", min_size.height());
+ if (max_size.width() != kUnboundedSize)
+ result->SetInteger("maxWidth", max_size.width());
+ if (max_size.height() != kUnboundedSize)
+ result->SetInteger("maxHeight", max_size.height());
}
} // namespace

Powered by Google App Engine
This is Rietveld 408576698