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( |
+ window->bounds().size()); |
+ window->SetBounds(center); |
+} |
+ |
} // namespace wm |
} // namespace ash |