Chromium Code Reviews| Index: ash/wm/window_util.cc |
| diff --git a/ash/wm/window_util.cc b/ash/wm/window_util.cc |
| index 46a776a3d65c2e9a82a96b5e34a3d0f41d1b18ba..8d320a9c2e2acdccbcd66b3577787c18ffc49bcc 100644 |
| --- a/ash/wm/window_util.cc |
| +++ b/ash/wm/window_util.cc |
| @@ -9,6 +9,7 @@ |
| #include "ash/ash_constants.h" |
| #include "ash/shell.h" |
| #include "ash/wm/window_properties.h" |
| +#include "ash/wm/window_state.h" |
| #include "ui/aura/client/activation_client.h" |
| #include "ui/aura/client/aura_constants.h" |
| #include "ui/aura/root_window.h" |
| @@ -55,11 +56,18 @@ bool IsWindowMinimized(aura::Window* window) { |
| } |
| void CenterWindow(aura::Window* window) { |
| + wm::WindowState* window_state = wm::GetWindowState(window); |
| + if (!window_state->IsNormalShowState()) |
|
pkotwicz
2013/11/21 23:46:50
I have trouble keeping show type and show state st
|
| + return; |
| const gfx::Display display = |
| Shell::GetScreen()->GetDisplayNearestWindow(window); |
| gfx::Rect center = display.work_area(); |
| - center.ClampToCenteredSize(window->bounds().size()); |
| - window->SetBoundsInScreen(center, display); |
| + gfx::Size size = window_state->HasRestoreBounds() ? |
| + window_state->GetRestoreBoundsInScreen().size() : |
| + window->bounds().size(); |
| + center.ClampToCenteredSize(size); |
| + window_state->SetRestoreBoundsInScreen(center); |
| + window_state->Restore(); |
|
varkha
2013/11/21 22:53:55
Restore is needed here to properly reset window_sh
|
| } |
| void AdjustBoundsToEnsureMinimumWindowVisibility(const gfx::Rect& visible_area, |