Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(212)

Side by Side Diff: ash/wm/window_positioning_utils.cc

Issue 2814243002: Removes a couple more functions from WmWindow (Closed)
Patch Set: feedback Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/wm/window_positioning_utils.h" 5 #include "ash/wm/window_positioning_utils.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ash/root_window_controller.h" 9 #include "ash/root_window_controller.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 IsWindowOrAncestorLockedToRoot(window->GetParent())); 43 IsWindowOrAncestorLockedToRoot(window->GetParent()));
44 } 44 }
45 45
46 // Move all transient children to |dst_root|, including the ones in 46 // Move all transient children to |dst_root|, including the ones in
47 // the child windows and transient children of the transient children. 47 // the child windows and transient children of the transient children.
48 void MoveAllTransientChildrenToNewRoot(const display::Display& display, 48 void MoveAllTransientChildrenToNewRoot(const display::Display& display,
49 WmWindow* window) { 49 WmWindow* window) {
50 WmWindow* dst_root = 50 WmWindow* dst_root =
51 Shell::GetRootWindowControllerWithDisplayId(display.id())->GetWindow(); 51 Shell::GetRootWindowControllerWithDisplayId(display.id())->GetWindow();
52 for (WmWindow* transient_child : window->GetTransientChildren()) { 52 for (WmWindow* transient_child : window->GetTransientChildren()) {
53 const int container_id = transient_child->GetParent()->GetShellWindowId(); 53 const int container_id = transient_child->GetParent()->aura_window()->id();
54 DCHECK_GE(container_id, 0); 54 DCHECK_GE(container_id, 0);
55 WmWindow* container = dst_root->GetChildByShellWindowId(container_id); 55 WmWindow* container = dst_root->GetChildByShellWindowId(container_id);
56 const gfx::Rect transient_child_bounds_in_screen = 56 const gfx::Rect transient_child_bounds_in_screen =
57 transient_child->GetBoundsInScreen(); 57 transient_child->GetBoundsInScreen();
58 container->AddChild(transient_child); 58 container->AddChild(transient_child);
59 transient_child->SetBoundsInScreen(transient_child_bounds_in_screen, 59 transient_child->SetBoundsInScreen(transient_child_bounds_in_screen,
60 display); 60 display);
61 61
62 // Transient children may have transient children. 62 // Transient children may have transient children.
63 MoveAllTransientChildrenToNewRoot(display, transient_child); 63 MoveAllTransientChildrenToNewRoot(display, transient_child);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 // display. 137 // display.
138 if (!window->GetTransientParent() && 138 if (!window->GetTransientParent() &&
139 !IsWindowOrAncestorLockedToRoot(window)) { 139 !IsWindowOrAncestorLockedToRoot(window)) {
140 RootWindowController* dst_root_window_controller = 140 RootWindowController* dst_root_window_controller =
141 Shell::GetRootWindowControllerWithDisplayId(display.id()); 141 Shell::GetRootWindowControllerWithDisplayId(display.id());
142 DCHECK(dst_root_window_controller); 142 DCHECK(dst_root_window_controller);
143 WmWindow* dst_root = dst_root_window_controller->GetWindow(); 143 WmWindow* dst_root = dst_root_window_controller->GetWindow();
144 DCHECK(dst_root); 144 DCHECK(dst_root);
145 WmWindow* dst_container = nullptr; 145 WmWindow* dst_container = nullptr;
146 if (dst_root != window->GetRootWindow()) { 146 if (dst_root != window->GetRootWindow()) {
147 int container_id = window->GetParent()->GetShellWindowId(); 147 int container_id = window->GetParent()->aura_window()->id();
148 // All containers that uses screen coordinates must have valid window ids. 148 // All containers that uses screen coordinates must have valid window ids.
149 DCHECK_GE(container_id, 0); 149 DCHECK_GE(container_id, 0);
150 // Don't move modal background. 150 // Don't move modal background.
151 if (!SystemModalContainerLayoutManager::IsModalBackground(window)) 151 if (!SystemModalContainerLayoutManager::IsModalBackground(window))
152 dst_container = dst_root->GetChildByShellWindowId(container_id); 152 dst_container = dst_root->GetChildByShellWindowId(container_id);
153 } 153 }
154 154
155 if (dst_container && window->GetParent() != dst_container) { 155 if (dst_container && window->GetParent() != dst_container) {
156 WmWindow* focused = WmWindow::Get(GetFocusedWindow()); 156 WmWindow* focused = WmWindow::Get(GetFocusedWindow());
157 WmWindow* active = WmWindow::Get(GetActiveWindow()); 157 WmWindow* active = WmWindow::Get(GetActiveWindow());
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 } 191 }
192 gfx::Point origin(bounds_in_screen.origin()); 192 gfx::Point origin(bounds_in_screen.origin());
193 const gfx::Point display_origin = 193 const gfx::Point display_origin =
194 window->GetDisplayNearestWindow().bounds().origin(); 194 window->GetDisplayNearestWindow().bounds().origin();
195 origin.Offset(-display_origin.x(), -display_origin.y()); 195 origin.Offset(-display_origin.x(), -display_origin.y());
196 window->SetBounds(gfx::Rect(origin, bounds_in_screen.size())); 196 window->SetBounds(gfx::Rect(origin, bounds_in_screen.size()));
197 } 197 }
198 198
199 } // namespace wm 199 } // namespace wm
200 } // namespace ash 200 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/system_modal_container_layout_manager.cc ('k') | ash/wm/wm_snap_to_pixel_layout_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698