| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/common/wm/window_positioning_utils.h" | 5 #include "ash/common/wm/window_positioning_utils.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ash/common/wm/system_modal_container_layout_manager.h" | 9 #include "ash/common/wm/system_modal_container_layout_manager.h" |
| 10 #include "ash/common/wm/window_state.h" | 10 #include "ash/common/wm/window_state.h" |
| 11 #include "ash/common/wm/wm_event.h" | 11 #include "ash/common/wm/wm_event.h" |
| 12 #include "ash/common/wm/wm_screen_util.h" | 12 #include "ash/common/wm/wm_screen_util.h" |
| 13 #include "ash/common/wm_shell.h" | 13 #include "ash/common/wm_shell.h" |
| 14 #include "ash/common/wm_window.h" | 14 #include "ash/common/wm_window.h" |
| 15 #include "ash/root_window_controller.h" | 15 #include "ash/root_window_controller.h" |
| 16 #include "ash/shell.h" | 16 #include "ash/shell.h" |
| 17 #include "ash/wm/window_util.h" |
| 17 #include "ui/aura/window_tracker.h" | 18 #include "ui/aura/window_tracker.h" |
| 18 #include "ui/display/display.h" | 19 #include "ui/display/display.h" |
| 19 #include "ui/display/types/display_constants.h" | 20 #include "ui/display/types/display_constants.h" |
| 20 #include "ui/gfx/geometry/rect.h" | 21 #include "ui/gfx/geometry/rect.h" |
| 21 #include "ui/gfx/geometry/size.h" | 22 #include "ui/gfx/geometry/size.h" |
| 22 | 23 |
| 23 namespace ash { | 24 namespace ash { |
| 24 namespace wm { | 25 namespace wm { |
| 25 | 26 |
| 26 namespace { | 27 namespace { |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 if (dst_root != window->GetRootWindow()) { | 147 if (dst_root != window->GetRootWindow()) { |
| 147 int container_id = window->GetParent()->GetShellWindowId(); | 148 int container_id = window->GetParent()->GetShellWindowId(); |
| 148 // All containers that uses screen coordinates must have valid window ids. | 149 // All containers that uses screen coordinates must have valid window ids. |
| 149 DCHECK_GE(container_id, 0); | 150 DCHECK_GE(container_id, 0); |
| 150 // Don't move modal background. | 151 // Don't move modal background. |
| 151 if (!SystemModalContainerLayoutManager::IsModalBackground(window)) | 152 if (!SystemModalContainerLayoutManager::IsModalBackground(window)) |
| 152 dst_container = dst_root->GetChildByShellWindowId(container_id); | 153 dst_container = dst_root->GetChildByShellWindowId(container_id); |
| 153 } | 154 } |
| 154 | 155 |
| 155 if (dst_container && window->GetParent() != dst_container) { | 156 if (dst_container && window->GetParent() != dst_container) { |
| 156 WmWindow* focused = WmShell::Get()->GetFocusedWindow(); | 157 WmWindow* focused = WmWindow::Get(GetFocusedWindow()); |
| 157 WmWindow* active = WmShell::Get()->GetActiveWindow(); | 158 WmWindow* active = WmWindow::Get(GetActiveWindow()); |
| 158 | 159 |
| 159 aura::WindowTracker tracker; | 160 aura::WindowTracker tracker; |
| 160 if (focused) | 161 if (focused) |
| 161 tracker.Add(focused->aura_window()); | 162 tracker.Add(focused->aura_window()); |
| 162 if (active && focused != active) | 163 if (active && focused != active) |
| 163 tracker.Add(active->aura_window()); | 164 tracker.Add(active->aura_window()); |
| 164 | 165 |
| 165 gfx::Point origin = bounds_in_screen.origin(); | 166 gfx::Point origin = bounds_in_screen.origin(); |
| 166 const gfx::Point display_origin = display.bounds().origin(); | 167 const gfx::Point display_origin = display.bounds().origin(); |
| 167 origin.Offset(-display_origin.x(), -display_origin.y()); | 168 origin.Offset(-display_origin.x(), -display_origin.y()); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 192 } | 193 } |
| 193 gfx::Point origin(bounds_in_screen.origin()); | 194 gfx::Point origin(bounds_in_screen.origin()); |
| 194 const gfx::Point display_origin = | 195 const gfx::Point display_origin = |
| 195 window->GetDisplayNearestWindow().bounds().origin(); | 196 window->GetDisplayNearestWindow().bounds().origin(); |
| 196 origin.Offset(-display_origin.x(), -display_origin.y()); | 197 origin.Offset(-display_origin.x(), -display_origin.y()); |
| 197 window->SetBounds(gfx::Rect(origin, bounds_in_screen.size())); | 198 window->SetBounds(gfx::Rect(origin, bounds_in_screen.size())); |
| 198 } | 199 } |
| 199 | 200 |
| 200 } // namespace wm | 201 } // namespace wm |
| 201 } // namespace ash | 202 } // namespace ash |
| OLD | NEW |