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

Side by Side Diff: ash/display/extended_mouse_warp_controller.cc

Issue 2911393002: Nix GetRootWindowController, use RootWindowController::ForWindow. (Closed)
Patch Set: Sync and rebase. Created 3 years, 6 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/extended_mouse_warp_controller.h" 5 #include "ash/display/extended_mouse_warp_controller.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "ash/display/display_util.h" 9 #include "ash/display/display_util.h"
10 #include "ash/display/shared_display_edge_indicator.h" 10 #include "ash/display/shared_display_edge_indicator.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 const gfx::Rect& b_indicator_bounds) 70 const gfx::Rect& b_indicator_bounds)
71 : a_display_id_(a_display_id), 71 : a_display_id_(a_display_id),
72 b_display_id_(b_display_id), 72 b_display_id_(b_display_id),
73 a_indicator_bounds_(a_indicator_bounds), 73 a_indicator_bounds_(a_indicator_bounds),
74 b_indicator_bounds_(b_indicator_bounds), 74 b_indicator_bounds_(b_indicator_bounds),
75 shared_display_edge_indicator_(nullptr) { 75 shared_display_edge_indicator_(nullptr) {
76 // Initialize edge bounds from indicator bounds. 76 // Initialize edge bounds from indicator bounds.
77 aura::Window* a_window = GetRootWindowForDisplayId(a_display_id); 77 aura::Window* a_window = GetRootWindowForDisplayId(a_display_id);
78 aura::Window* b_window = GetRootWindowForDisplayId(b_display_id); 78 aura::Window* b_window = GetRootWindowForDisplayId(b_display_id);
79 79
80 AshWindowTreeHost* a_ash_host = GetRootWindowController(a_window)->ash_host(); 80 AshWindowTreeHost* a_ash_host =
81 AshWindowTreeHost* b_ash_host = GetRootWindowController(b_window)->ash_host(); 81 RootWindowController::ForWindow(a_window)->ash_host();
82 AshWindowTreeHost* b_ash_host =
83 RootWindowController::ForWindow(b_window)->ash_host();
82 84
83 a_edge_bounds_in_native_ = 85 a_edge_bounds_in_native_ =
84 GetNativeEdgeBounds(a_ash_host, a_indicator_bounds); 86 GetNativeEdgeBounds(a_ash_host, a_indicator_bounds);
85 b_edge_bounds_in_native_ = 87 b_edge_bounds_in_native_ =
86 GetNativeEdgeBounds(b_ash_host, b_indicator_bounds); 88 GetNativeEdgeBounds(b_ash_host, b_indicator_bounds);
87 } 89 }
88 90
89 ExtendedMouseWarpController::WarpRegion::~WarpRegion() {} 91 ExtendedMouseWarpController::WarpRegion::~WarpRegion() {}
90 92
91 const gfx::Rect& 93 const gfx::Rect&
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 for (const std::unique_ptr<WarpRegion>& warp : warp_regions_) { 184 for (const std::unique_ptr<WarpRegion>& warp : warp_regions_) {
183 bool in_a_edge = warp->a_edge_bounds_in_native_.Contains(point_in_native); 185 bool in_a_edge = warp->a_edge_bounds_in_native_.Contains(point_in_native);
184 bool in_b_edge = warp->b_edge_bounds_in_native_.Contains(point_in_native); 186 bool in_b_edge = warp->b_edge_bounds_in_native_.Contains(point_in_native);
185 if (!in_a_edge && !in_b_edge) 187 if (!in_a_edge && !in_b_edge)
186 continue; 188 continue;
187 189
188 // The mouse must move. 190 // The mouse must move.
189 aura::Window* dst_window = GetRootWindowForDisplayId( 191 aura::Window* dst_window = GetRootWindowForDisplayId(
190 in_a_edge ? warp->b_display_id_ : warp->a_display_id_); 192 in_a_edge ? warp->b_display_id_ : warp->a_display_id_);
191 AshWindowTreeHost* target_ash_host = 193 AshWindowTreeHost* target_ash_host =
192 GetRootWindowController(dst_window)->ash_host(); 194 RootWindowController::ForWindow(dst_window)->ash_host();
193 195
194 MoveCursorTo(target_ash_host, point_in_screen, update_mouse_location_now); 196 MoveCursorTo(target_ash_host, point_in_screen, update_mouse_location_now);
195 return true; 197 return true;
196 } 198 }
197 199
198 return false; 200 return false;
199 } 201 }
200 202
201 std::unique_ptr<ExtendedMouseWarpController::WarpRegion> 203 std::unique_ptr<ExtendedMouseWarpController::WarpRegion>
202 ExtendedMouseWarpController::CreateWarpRegion(const display::Display& a, 204 ExtendedMouseWarpController::CreateWarpRegion(const display::Display& a,
(...skipping 12 matching lines...) Expand all
215 if (drag_source_id == a.id()) 217 if (drag_source_id == a.id())
216 AdjustSourceEdgeBounds(a.bounds(), snap_barrier, &a_edge); 218 AdjustSourceEdgeBounds(a.bounds(), snap_barrier, &a_edge);
217 else if (drag_source_id == b.id()) 219 else if (drag_source_id == b.id())
218 AdjustSourceEdgeBounds(b.bounds(), snap_barrier, &b_edge); 220 AdjustSourceEdgeBounds(b.bounds(), snap_barrier, &b_edge);
219 } 221 }
220 222
221 return base::MakeUnique<WarpRegion>(a.id(), b.id(), a_edge, b_edge); 223 return base::MakeUnique<WarpRegion>(a.id(), b.id(), a_edge, b_edge);
222 } 224 }
223 225
224 } // namespace ash 226 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698