Index: ash/wm/window_util.cc |
diff --git a/ash/wm/window_util.cc b/ash/wm/window_util.cc |
index 8d320a9c2e2acdccbcd66b3577787c18ffc49bcc..83e9199aec404fa03a9c850886914d3041870ab3 100644 |
--- a/ash/wm/window_util.cc |
+++ b/ash/wm/window_util.cc |
@@ -7,6 +7,7 @@ |
#include <vector> |
#include "ash/ash_constants.h" |
+#include "ash/screen_ash.h" |
#include "ash/shell.h" |
#include "ash/wm/window_properties.h" |
#include "ash/wm/window_state.h" |
@@ -62,12 +63,19 @@ void CenterWindow(aura::Window* window) { |
const gfx::Display display = |
Shell::GetScreen()->GetDisplayNearestWindow(window); |
gfx::Rect center = display.work_area(); |
- gfx::Size size = window_state->HasRestoreBounds() ? |
- window_state->GetRestoreBoundsInScreen().size() : |
- window->bounds().size(); |
- center.ClampToCenteredSize(size); |
- window_state->SetRestoreBoundsInScreen(center); |
- window_state->Restore(); |
+ gfx::Size size = window->bounds().size(); |
+ if (window_state->IsSnapped()) { |
+ if (window_state->HasRestoreBounds()) |
+ size = window_state->GetRestoreBoundsInScreen().size(); |
+ center.ClampToCenteredSize(size); |
+ window_state->SetRestoreBoundsInScreen(center); |
+ window_state->Restore(); |
+ } else { |
+ center = ScreenAsh::ConvertRectFromScreen(window->parent(), |
+ center); |
+ center.ClampToCenteredSize(size); |
+ window->SetBounds(center); |
+ } |
} |
void AdjustBoundsToEnsureMinimumWindowVisibility(const gfx::Rect& visible_area, |