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

Unified Diff: chrome/browser/extensions/api/app_current_window_internal/app_current_window_internal_api.cc

Issue 11369039: Add setBounds method and browsertest for get/set bounds to app window API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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 5619b65ae38f145f31215d73e5a5ced08ba9ea43..e14bf9a7cda429077044bc1489fc94c42db4b9db 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
@@ -5,8 +5,12 @@
#include "chrome/browser/extensions/api/app_current_window_internal/app_current_window_internal_api.h"
#include "chrome/browser/extensions/shell_window_registry.h"
#include "chrome/browser/ui/extensions/shell_window.h"
+#include "chrome/common/extensions/api/app_current_window_internal.h"
#include "chrome/common/extensions/extension_error_utils.h"
+namespace SetBounds = extensions::api::app_current_window_internal::SetBounds;
+using extensions::api::app_current_window_internal::Bounds;
+
namespace extensions {
namespace {
@@ -80,4 +84,24 @@ bool AppCurrentWindowInternalHideFunction::RunWithWindow(
return true;
}
+bool AppCurrentWindowInternalSetBoundsFunction::RunWithWindow(
+ ShellWindow* window) {
+ // Start with the current bounds, and change any values that are specified in
+ // the incoming parameters.
+ gfx::Rect bounds = window->GetBaseWindow()->GetBounds();
+ scoped_ptr<SetBounds::Params> params(SetBounds::Params::Create(*args_));
+ CHECK(params.get());
+ if (params->bounds.left)
+ bounds.set_x(*(params->bounds.left));
+ if (params->bounds.top)
+ bounds.set_y(*(params->bounds.top));
+ if (params->bounds.width)
+ bounds.set_width(*(params->bounds.width));
+ if (params->bounds.height)
+ bounds.set_height(*(params->bounds.height));
+
+ window->GetBaseWindow()->SetBounds(bounds);
+ return true;
+}
+
} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698