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

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

Issue 2787363002: Moves couple of WmShell methods to standalone functions (Closed)
Patch Set: feedback and fix applist 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
« no previous file with comments | « ash/common/wm/window_positioner.cc ('k') | ash/common/wm/workspace/workspace_layout_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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
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
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
OLDNEW
« no previous file with comments | « ash/common/wm/window_positioner.cc ('k') | ash/common/wm/workspace/workspace_layout_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698