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

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: rebased 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 cfabf6a85aad82c99eecacb816f270699c71af9f..659c8ac4b6f0aee2c581acf34c65e07e2952c574 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
@@ -3,9 +3,13 @@
// found in the LICENSE file.
#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 "extensions/common/error_utils.h"
+#include "chrome/common/extensions/api/app_current_window_internal.h"
+
+namespace SetBounds = extensions::api::app_current_window_internal::SetBounds;
+using extensions::api::app_current_window_internal::Bounds;
namespace extensions {
@@ -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