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

Unified Diff: chrome/browser/extensions/api/app_current_window_internal/app_current_window_internal_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: Rebase. Use ShellWindow::Set[Min|Max]imumSize. Update tests. 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_current_window_internal/app_current_window_internal_api.cc
diff --git a/chrome/browser/extensions/api/app_current_window_internal/app_current_window_internal_api.cc b/chrome/browser/extensions/api/app_current_window_internal/app_current_window_internal_api.cc
index f5cdf91f6ff0cd226e5e9861d5ed23d9eb5d2cb5..ddfad10b0628dfc651cd560d3fe81b80f9dfbfed 100644
--- a/chrome/browser/extensions/api/app_current_window_internal/app_current_window_internal_api.cc
+++ b/chrome/browser/extensions/api/app_current_window_internal/app_current_window_internal_api.cc
@@ -16,15 +16,21 @@
#include "extensions/common/switches.h"
#include "third_party/skia/include/core/SkRegion.h"
-namespace SetBounds = extensions::api::app_current_window_internal::SetBounds;
-namespace SetIcon = extensions::api::app_current_window_internal::SetIcon;
-namespace SetInputRegion =
- extensions::api::app_current_window_internal::SetInputRegion;
+namespace app_current_window_internal =
+ extensions::api::app_current_window_internal;
+
+namespace SetBounds = app_current_window_internal::SetBounds;
+namespace SetMinWidth = app_current_window_internal::SetMinWidth;
+namespace SetMinHeight = app_current_window_internal::SetMinHeight;
+namespace SetMaxWidth = app_current_window_internal::SetMaxWidth;
+namespace SetMaxHeight = app_current_window_internal::SetMaxHeight;
+namespace SetIcon = app_current_window_internal::SetIcon;
+namespace SetInputRegion = app_current_window_internal::SetInputRegion;
using apps::ShellWindow;
-using extensions::api::app_current_window_internal::Bounds;
-using extensions::api::app_current_window_internal::Region;
-using extensions::api::app_current_window_internal::RegionRect;
+using app_current_window_internal::Bounds;
+using app_current_window_internal::Region;
+using app_current_window_internal::RegionRect;
namespace extensions {
@@ -130,6 +136,46 @@ bool AppCurrentWindowInternalSetBoundsFunction::RunWithWindow(
return true;
}
+bool AppCurrentWindowInternalSetMinWidthFunction::RunWithWindow(
+ ShellWindow* window) {
+ scoped_ptr<SetMinWidth::Params> params(SetMinWidth::Params::Create(*args_));
+ CHECK(params.get());
+ gfx::Size min_size = window->size_constraints().GetMinimumSize();
+ min_size.set_width(params->min_width.get() ? *(params->min_width) : 0);
tapted 2013/10/16 23:31:52 maybe-nit: 0 -> SizeConstraints::kUnboundedSize ?
jackhou1 2013/10/17 03:56:50 Done.
+ window->SetMinimumSize(min_size);
+ return true;
+}
+
+bool AppCurrentWindowInternalSetMinHeightFunction::RunWithWindow(
+ ShellWindow* window) {
+ scoped_ptr<SetMinHeight::Params> params(SetMinHeight::Params::Create(*args_));
+ CHECK(params.get());
+ gfx::Size min_size = window->size_constraints().GetMinimumSize();
+ min_size.set_height(params->min_height.get() ? *(params->min_height) : 0);
+ window->SetMinimumSize(min_size);
+ return true;
+}
+
+bool AppCurrentWindowInternalSetMaxWidthFunction::RunWithWindow(
+ ShellWindow* window) {
+ scoped_ptr<SetMaxWidth::Params> params(SetMaxWidth::Params::Create(*args_));
+ CHECK(params.get());
+ gfx::Size max_size = window->size_constraints().GetMaximumSize();
+ max_size.set_width(params->max_width.get() ? *(params->max_width) : 0);
+ window->SetMaximumSize(max_size);
+ return true;
+}
+
+bool AppCurrentWindowInternalSetMaxHeightFunction::RunWithWindow(
+ ShellWindow* window) {
+ scoped_ptr<SetMaxHeight::Params> params(SetMaxHeight::Params::Create(*args_));
+ CHECK(params.get());
+ gfx::Size max_size = window->size_constraints().GetMaximumSize();
+ max_size.set_height(params->max_height.get() ? *(params->max_height) : 0);
+ window->SetMaximumSize(max_size);
+ return true;
+}
+
bool AppCurrentWindowInternalSetIconFunction::RunWithWindow(
ShellWindow* window) {
if (GetCurrentChannel() > chrome::VersionInfo::CHANNEL_DEV &&

Powered by Google App Engine
This is Rietveld 408576698