| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/wm/window_util.h" | 5 #include "ash/wm/window_util.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "ash/ash_constants.h" | 9 #include "ash/ash_constants.h" |
| 10 #include "ash/screen_util.h" | 10 #include "ash/screen_util.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 bool CanActivateWindow(aura::Window* window) { | 51 bool CanActivateWindow(aura::Window* window) { |
| 52 return views::corewm::CanActivateWindow(window); | 52 return views::corewm::CanActivateWindow(window); |
| 53 } | 53 } |
| 54 | 54 |
| 55 bool IsWindowMinimized(aura::Window* window) { | 55 bool IsWindowMinimized(aura::Window* window) { |
| 56 return ash::wm::GetWindowState(window)->IsMinimized(); | 56 return ash::wm::GetWindowState(window)->IsMinimized(); |
| 57 } | 57 } |
| 58 | 58 |
| 59 void CenterWindow(aura::Window* window) { | 59 void CenterWindow(aura::Window* window) { |
| 60 wm::WindowState* window_state = wm::GetWindowState(window); | 60 wm::WindowState* window_state = wm::GetWindowState(window); |
| 61 if (!window_state->IsNormalShowState()) | 61 if (!window_state->IsNormalOrSnapped()) |
| 62 return; | 62 return; |
| 63 const gfx::Display display = | 63 const gfx::Display display = |
| 64 Shell::GetScreen()->GetDisplayNearestWindow(window); | 64 Shell::GetScreen()->GetDisplayNearestWindow(window); |
| 65 gfx::Rect center = display.work_area(); | 65 gfx::Rect center = display.work_area(); |
| 66 gfx::Size size = window->bounds().size(); | 66 gfx::Size size = window->bounds().size(); |
| 67 if (window_state->IsSnapped()) { | 67 if (window_state->IsSnapped()) { |
| 68 if (window_state->HasRestoreBounds()) | 68 if (window_state->HasRestoreBounds()) |
| 69 size = window_state->GetRestoreBoundsInScreen().size(); | 69 size = window_state->GetRestoreBoundsInScreen().size(); |
| 70 center.ClampToCenteredSize(size); | 70 center.ClampToCenteredSize(size); |
| 71 window_state->SetRestoreBoundsInScreen(center); | 71 window_state->SetRestoreBoundsInScreen(center); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 ++i) { | 143 ++i) { |
| 144 ReparentChildWithTransientChildren( | 144 ReparentChildWithTransientChildren( |
| 145 views::corewm::GetTransientChildren(child)[i], | 145 views::corewm::GetTransientChildren(child)[i], |
| 146 old_parent, | 146 old_parent, |
| 147 new_parent); | 147 new_parent); |
| 148 } | 148 } |
| 149 } | 149 } |
| 150 | 150 |
| 151 } // namespace wm | 151 } // namespace wm |
| 152 } // namespace ash | 152 } // namespace ash |
| OLD | NEW |