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

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

Issue 1827083003: Address comments in the orignial CL (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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/display/extended_mouse_warp_controller.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_manager.h" 9 #include "ash/display/display_manager.h"
10 #include "ash/display/display_util.h" 10 #include "ash/display/display_util.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 97
98 ExtendedMouseWarpController::ExtendedMouseWarpController( 98 ExtendedMouseWarpController::ExtendedMouseWarpController(
99 aura::Window* drag_source) 99 aura::Window* drag_source)
100 : drag_source_root_(drag_source), 100 : drag_source_root_(drag_source),
101 allow_non_native_event_(false) { 101 allow_non_native_event_(false) {
102 ash::DisplayManager* display_manager = 102 ash::DisplayManager* display_manager =
103 Shell::GetInstance()->display_manager(); 103 Shell::GetInstance()->display_manager();
104 int64_t drag_source_id = drag_source ? GetDisplayIdFromWindow(drag_source) 104 int64_t drag_source_id = drag_source ? GetDisplayIdFromWindow(drag_source)
105 : gfx::Display::kInvalidDisplayID; 105 : gfx::Display::kInvalidDisplayID;
106 DisplayList display_list = display_manager->active_display_list(); 106 DisplayList display_list = display_manager->active_display_list();
107 while (display_list.size() > 0) { 107 // Try to create a Warp region for all possible two displays combination.
108 // The following code does it by poping the last element in the list
109 // and then pairing with remaining displays in the list, until the list
110 // becomes single element.
111 while (display_list.size() > 1) {
108 gfx::Display display = display_list.back(); 112 gfx::Display display = display_list.back();
109 display_list.pop_back(); 113 display_list.pop_back();
110 for (const gfx::Display& peer : display_list) { 114 for (const gfx::Display& peer : display_list) {
111 scoped_ptr<WarpRegion> region = 115 scoped_ptr<WarpRegion> region =
112 CreateWarpRegion(display, peer, drag_source_id); 116 CreateWarpRegion(display, peer, drag_source_id);
113 if (region) 117 if (region)
114 AddWarpRegion(std::move(region), drag_source != nullptr); 118 AddWarpRegion(std::move(region), drag_source != nullptr);
115 } 119 }
116 } 120 }
117 } 121 }
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 if (drag_source_id == a.id()) 217 if (drag_source_id == a.id())
214 AdjustSourceEdgeBounds(a.bounds(), snap_barrier, &a_edge); 218 AdjustSourceEdgeBounds(a.bounds(), snap_barrier, &a_edge);
215 else if (drag_source_id == b.id()) 219 else if (drag_source_id == b.id())
216 AdjustSourceEdgeBounds(b.bounds(), snap_barrier, &b_edge); 220 AdjustSourceEdgeBounds(b.bounds(), snap_barrier, &b_edge);
217 } 221 }
218 222
219 return make_scoped_ptr(new WarpRegion(a.id(), b.id(), a_edge, b_edge)); 223 return make_scoped_ptr(new WarpRegion(a.id(), b.id(), a_edge, b_edge));
220 } 224 }
221 225
222 } // namespace ash 226 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/extended_mouse_warp_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698