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

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
« no previous file with comments | « ash/wm/window_util.h ('k') | ash/wm/workspace/snap_sizer.h » ('j') | 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..4ad8dc9561aecc4a774d301ed11e9429c8fbfd4e 100644
--- a/ash/wm/window_util.cc
+++ b/ash/wm/window_util.cc
@@ -12,6 +12,7 @@
#include "ui/aura/window.h"
#include "ui/aura/window_property.h"
#include "ui/base/ui_base_types.h"
+#include "ui/gfx/monitor.h"
#include "ui/gfx/screen.h"
DECLARE_WINDOW_PROPERTY_TYPE(bool);
@@ -96,5 +97,11 @@ void RestoreWindow(aura::Window* window) {
window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL);
}
+void CenterWindow(aura::Window* window) {
+ const gfx::Monitor monitor = gfx::Screen::GetMonitorNearestWindow(window);
+ gfx::Rect center = monitor.work_area().Center(window->bounds().size());
+ window->SetBounds(center);
+}
+
} // namespace wm
} // namespace ash
« no previous file with comments | « ash/wm/window_util.h ('k') | ash/wm/workspace/snap_sizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698