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 |