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/display/screen_position_controller.h" | 5 #include "ash/display/screen_position_controller.h" |
6 | 6 |
7 #include "ash/display/display_controller.h" | 7 #include "ash/display/display_controller.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/shell_window_ids.h" | 9 #include "ash/shell_window_ids.h" |
| 10 #include "ash/wm/coordinate_conversion.h" |
10 #include "ash/wm/system_modal_container_layout_manager.h" | 11 #include "ash/wm/system_modal_container_layout_manager.h" |
11 #include "ash/wm/window_properties.h" | 12 #include "ash/wm/window_properties.h" |
12 #include "ui/aura/client/activation_client.h" | 13 #include "ui/aura/client/activation_client.h" |
13 #include "ui/aura/client/capture_client.h" | 14 #include "ui/aura/client/capture_client.h" |
14 #include "ui/aura/client/stacking_client.h" | 15 #include "ui/aura/client/stacking_client.h" |
15 #include "ui/aura/focus_manager.h" | 16 #include "ui/aura/focus_manager.h" |
16 #include "ui/aura/root_window.h" | 17 #include "ui/aura/root_window.h" |
17 #include "ui/aura/window_tracker.h" | 18 #include "ui/aura/window_tracker.h" |
18 #include "ui/gfx/display.h" | 19 #include "ui/gfx/display.h" |
19 #include "ui/gfx/screen.h" | 20 #include "ui/gfx/screen.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 const gfx::Rect& bounds) { | 83 const gfx::Rect& bounds) { |
83 if (!DisplayController::IsExtendedDesktopEnabled() || | 84 if (!DisplayController::IsExtendedDesktopEnabled() || |
84 !window->parent()->GetProperty(internal::kUsesScreenCoordinatesKey)) { | 85 !window->parent()->GetProperty(internal::kUsesScreenCoordinatesKey)) { |
85 window->SetBounds(bounds); | 86 window->SetBounds(bounds); |
86 return; | 87 return; |
87 } | 88 } |
88 | 89 |
89 // Don't move a transient windows to other root window. | 90 // Don't move a transient windows to other root window. |
90 // It moves when its transient_parent moves. | 91 // It moves when its transient_parent moves. |
91 if (!window->transient_parent()) { | 92 if (!window->transient_parent()) { |
92 aura::RootWindow* dst_root = Shell::GetRootWindowMatching(bounds); | 93 aura::RootWindow* dst_root = wm::GetRootWindowMatching(bounds); |
93 aura::Window* dst_container = NULL; | 94 aura::Window* dst_container = NULL; |
94 if (dst_root != window->GetRootWindow()) { | 95 if (dst_root != window->GetRootWindow()) { |
95 int container_id = window->parent()->id(); | 96 int container_id = window->parent()->id(); |
96 // All containers that uses screen coordinates must have valid | 97 // All containers that uses screen coordinates must have valid |
97 // window ids. | 98 // window ids. |
98 DCHECK_GE(container_id, 0); | 99 DCHECK_GE(container_id, 0); |
99 // Don't move modal screen. | 100 // Don't move modal screen. |
100 if (!SystemModalContainerLayoutManager::IsModalScreen(window)) | 101 if (!SystemModalContainerLayoutManager::IsModalScreen(window)) |
101 dst_container = Shell::GetContainer(dst_root, container_id); | 102 dst_container = Shell::GetContainer(dst_root, container_id); |
102 } | 103 } |
(...skipping 24 matching lines...) Expand all Loading... |
127 | 128 |
128 gfx::Point origin(bounds.origin()); | 129 gfx::Point origin(bounds.origin()); |
129 const gfx::Point display_origin = | 130 const gfx::Point display_origin = |
130 gfx::Screen::GetDisplayNearestWindow(window).bounds().origin(); | 131 gfx::Screen::GetDisplayNearestWindow(window).bounds().origin(); |
131 origin.Offset(-display_origin.x(), -display_origin.y()); | 132 origin.Offset(-display_origin.x(), -display_origin.y()); |
132 window->SetBounds(gfx::Rect(origin, bounds.size())); | 133 window->SetBounds(gfx::Rect(origin, bounds.size())); |
133 } | 134 } |
134 | 135 |
135 } // internal | 136 } // internal |
136 } // ash | 137 } // ash |
OLD | NEW |