| Index: ash/wm/window_util.cc
|
| diff --git a/ash/wm/window_util.cc b/ash/wm/window_util.cc
|
| index 8d320a9c2e2acdccbcd66b3577787c18ffc49bcc..7c02aeb65187ff786464cb1c153f75cf528b751e 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"
|
| @@ -57,17 +58,24 @@ bool IsWindowMinimized(aura::Window* window) {
|
|
|
| void CenterWindow(aura::Window* window) {
|
| wm::WindowState* window_state = wm::GetWindowState(window);
|
| - if (!window_state->IsNormalShowState())
|
| + if (window_state->IsMaximizedOrFullscreen())
|
| return;
|
| 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,
|
|
|