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

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

Issue 1838833002: Move DisplayLayout and DisplayLayoutBuilder From ash To ui/display (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@screenwinmove
Patch Set: Fix comment Created 4 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 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"
11 #include "ash/display/shared_display_edge_indicator.h" 11 #include "ash/display/shared_display_edge_indicator.h"
12 #include "ash/display/window_tree_host_manager.h" 12 #include "ash/display/window_tree_host_manager.h"
13 #include "ash/root_window_controller.h" 13 #include "ash/root_window_controller.h"
14 #include "ash/screen_util.h" 14 #include "ash/screen_util.h"
15 #include "ash/shell.h" 15 #include "ash/shell.h"
16 #include "ui/aura/window.h" 16 #include "ui/aura/window.h"
17 #include "ui/display/manager/display_layout.h"
17 #include "ui/events/event_utils.h" 18 #include "ui/events/event_utils.h"
18 #include "ui/gfx/screen.h" 19 #include "ui/gfx/screen.h"
19 #include "ui/wm/core/coordinate_conversion.h" 20 #include "ui/wm/core/coordinate_conversion.h"
20 21
21 namespace ash { 22 namespace ash {
22 23
23 namespace { 24 namespace {
24 25
25 // Maximum size on the display edge that initiate snapping phantom window, 26 // Maximum size on the display edge that initiate snapping phantom window,
26 // from the corner of the display. 27 // from the corner of the display.
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 } 97 }
97 98
98 ExtendedMouseWarpController::ExtendedMouseWarpController( 99 ExtendedMouseWarpController::ExtendedMouseWarpController(
99 aura::Window* drag_source) 100 aura::Window* drag_source)
100 : drag_source_root_(drag_source), 101 : drag_source_root_(drag_source),
101 allow_non_native_event_(false) { 102 allow_non_native_event_(false) {
102 ash::DisplayManager* display_manager = 103 ash::DisplayManager* display_manager =
103 Shell::GetInstance()->display_manager(); 104 Shell::GetInstance()->display_manager();
104 int64_t drag_source_id = drag_source ? GetDisplayIdFromWindow(drag_source) 105 int64_t drag_source_id = drag_source ? GetDisplayIdFromWindow(drag_source)
105 : gfx::Display::kInvalidDisplayID; 106 : gfx::Display::kInvalidDisplayID;
106 DisplayList display_list = display_manager->active_display_list(); 107 display::DisplayList display_list = display_manager->active_display_list();
107 // Try to create a Warp region for all possible two displays combination. 108 // 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 // 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 // and then pairing with remaining displays in the list, until the list
110 // becomes single element. 111 // becomes single element.
111 while (display_list.size() > 1) { 112 while (display_list.size() > 1) {
112 gfx::Display display = display_list.back(); 113 gfx::Display display = display_list.back();
113 display_list.pop_back(); 114 display_list.pop_back();
114 for (const gfx::Display& peer : display_list) { 115 for (const gfx::Display& peer : display_list) {
115 scoped_ptr<WarpRegion> region = 116 scoped_ptr<WarpRegion> region =
116 CreateWarpRegion(display, peer, drag_source_id); 117 CreateWarpRegion(display, peer, drag_source_id);
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 if (drag_source_id == a.id()) 218 if (drag_source_id == a.id())
218 AdjustSourceEdgeBounds(a.bounds(), snap_barrier, &a_edge); 219 AdjustSourceEdgeBounds(a.bounds(), snap_barrier, &a_edge);
219 else if (drag_source_id == b.id()) 220 else if (drag_source_id == b.id())
220 AdjustSourceEdgeBounds(b.bounds(), snap_barrier, &b_edge); 221 AdjustSourceEdgeBounds(b.bounds(), snap_barrier, &b_edge);
221 } 222 }
222 223
223 return make_scoped_ptr(new WarpRegion(a.id(), b.id(), a_edge, b_edge)); 224 return make_scoped_ptr(new WarpRegion(a.id(), b.id(), a_edge, b_edge));
224 } 225 }
225 226
226 } // namespace ash 227 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/extended_mouse_warp_controller.h ('k') | ash/display/extended_mouse_warp_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698