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

Unified Diff: ash/wm/window_util.cc

Issue 9956056: ash: Add accelerator for snapping windows left/right. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 8 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
« ash/accelerators/accelerator_controller.cc ('K') | « ash/wm/window_util.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/window_util.cc
diff --git a/ash/wm/window_util.cc b/ash/wm/window_util.cc
index b273cb647801a767ba27f89e4aae0233c45e05c0..39fe454a316db5e4c18c8c1219cc1bb5896cdc6a 100644
--- a/ash/wm/window_util.cc
+++ b/ash/wm/window_util.cc
@@ -8,6 +8,9 @@
#include "ash/wm/activation_controller.h"
#include "ui/aura/client/activation_client.h"
#include "ui/aura/client/aura_constants.h"
+#include "ui/aura/env.h"
+#include "ui/aura/monitor.h"
+#include "ui/aura/monitor_manager.h"
#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
#include "ui/aura/window_property.h"
@@ -96,5 +99,13 @@ void RestoreWindow(aura::Window* window) {
window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL);
}
+void CenterWindow(aura::Window* window) {
+ const aura::Monitor* monitor = aura::Env::GetInstance()->monitor_manager()->
+ GetMonitorNearestWindow(window);
+ gfx::Rect center = monitor->GetWorkAreaBounds().Center(
sky 2012/04/25 17:26:01 Use one of GetUnmaximizedWorkAreaBounds or GetMaxi
+ window->bounds().size());
+ window->SetBounds(center);
+}
+
} // namespace wm
} // namespace ash
« ash/accelerators/accelerator_controller.cc ('K') | « ash/wm/window_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698