| 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 28 matching lines...) Expand all Loading... |
| 39 window->delegate()->GetMinimumSize().width() : 0; | 39 window->delegate()->GetMinimumSize().width() : 0; |
| 40 int ideal_width = | 40 int ideal_width = |
| 41 static_cast<int>(work_area_width * kSnappedWidthWorkspaceRatio); | 41 static_cast<int>(work_area_width * kSnappedWidthWorkspaceRatio); |
| 42 return std::min(work_area_width, std::max(ideal_width, min_width)); | 42 return std::min(work_area_width, std::max(ideal_width, min_width)); |
| 43 } | 43 } |
| 44 | 44 |
| 45 } // namespace | 45 } // namespace |
| 46 | 46 |
| 47 // TODO(beng): replace many of these functions with the corewm versions. | 47 // TODO(beng): replace many of these functions with the corewm versions. |
| 48 void ActivateWindow(aura::Window* window) { | 48 void ActivateWindow(aura::Window* window) { |
| 49 views::corewm::ActivateWindow(window); | 49 ::wm::ActivateWindow(window); |
| 50 } | 50 } |
| 51 | 51 |
| 52 void DeactivateWindow(aura::Window* window) { | 52 void DeactivateWindow(aura::Window* window) { |
| 53 views::corewm::DeactivateWindow(window); | 53 ::wm::DeactivateWindow(window); |
| 54 } | 54 } |
| 55 | 55 |
| 56 bool IsActiveWindow(aura::Window* window) { | 56 bool IsActiveWindow(aura::Window* window) { |
| 57 return views::corewm::IsActiveWindow(window); | 57 return ::wm::IsActiveWindow(window); |
| 58 } | 58 } |
| 59 | 59 |
| 60 aura::Window* GetActiveWindow() { | 60 aura::Window* GetActiveWindow() { |
| 61 return aura::client::GetActivationClient(Shell::GetPrimaryRootWindow())-> | 61 return aura::client::GetActivationClient(Shell::GetPrimaryRootWindow())-> |
| 62 GetActiveWindow(); | 62 GetActiveWindow(); |
| 63 } | 63 } |
| 64 | 64 |
| 65 aura::Window* GetActivatableWindow(aura::Window* window) { | 65 aura::Window* GetActivatableWindow(aura::Window* window) { |
| 66 return views::corewm::GetActivatableWindow(window); | 66 return ::wm::GetActivatableWindow(window); |
| 67 } | 67 } |
| 68 | 68 |
| 69 bool CanActivateWindow(aura::Window* window) { | 69 bool CanActivateWindow(aura::Window* window) { |
| 70 return views::corewm::CanActivateWindow(window); | 70 return ::wm::CanActivateWindow(window); |
| 71 } | 71 } |
| 72 | 72 |
| 73 bool IsWindowMinimized(aura::Window* window) { | 73 bool IsWindowMinimized(aura::Window* window) { |
| 74 return ash::wm::GetWindowState(window)->IsMinimized(); | 74 return ash::wm::GetWindowState(window)->IsMinimized(); |
| 75 } | 75 } |
| 76 | 76 |
| 77 void CenterWindow(aura::Window* window) { | 77 void CenterWindow(aura::Window* window) { |
| 78 wm::WindowState* window_state = wm::GetWindowState(window); | 78 wm::WindowState* window_state = wm::GetWindowState(window); |
| 79 if (!window_state->IsNormalOrSnapped()) | 79 if (!window_state->IsNormalOrSnapped()) |
| 80 return; | 80 return; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 aura::Window* new_parent) { | 170 aura::Window* new_parent) { |
| 171 if (child->parent() == old_parent) | 171 if (child->parent() == old_parent) |
| 172 new_parent->AddChild(child); | 172 new_parent->AddChild(child); |
| 173 ReparentTransientChildrenOfChild(child, old_parent, new_parent); | 173 ReparentTransientChildrenOfChild(child, old_parent, new_parent); |
| 174 } | 174 } |
| 175 | 175 |
| 176 void ReparentTransientChildrenOfChild(aura::Window* child, | 176 void ReparentTransientChildrenOfChild(aura::Window* child, |
| 177 aura::Window* old_parent, | 177 aura::Window* old_parent, |
| 178 aura::Window* new_parent) { | 178 aura::Window* new_parent) { |
| 179 for (size_t i = 0; | 179 for (size_t i = 0; |
| 180 i < views::corewm::GetTransientChildren(child).size(); | 180 i < ::wm::GetTransientChildren(child).size(); |
| 181 ++i) { | 181 ++i) { |
| 182 ReparentChildWithTransientChildren( | 182 ReparentChildWithTransientChildren( |
| 183 views::corewm::GetTransientChildren(child)[i], | 183 ::wm::GetTransientChildren(child)[i], |
| 184 old_parent, | 184 old_parent, |
| 185 new_parent); | 185 new_parent); |
| 186 } | 186 } |
| 187 } | 187 } |
| 188 | 188 |
| 189 } // namespace wm | 189 } // namespace wm |
| 190 } // namespace ash | 190 } // namespace ash |
| OLD | NEW |