| OLD | NEW |
| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 ExtendedMouseWarpController::WarpRegion::~WarpRegion() {} | 73 ExtendedMouseWarpController::WarpRegion::~WarpRegion() {} |
| 74 | 74 |
| 75 ExtendedMouseWarpController::ExtendedMouseWarpController( | 75 ExtendedMouseWarpController::ExtendedMouseWarpController( |
| 76 aura::Window* drag_source) | 76 aura::Window* drag_source) |
| 77 : drag_source_root_(drag_source), | 77 : drag_source_root_(drag_source), |
| 78 allow_non_native_event_(false) { | 78 allow_non_native_event_(false) { |
| 79 ash::DisplayManager* display_manager = | 79 ash::DisplayManager* display_manager = |
| 80 Shell::GetInstance()->display_manager(); | 80 Shell::GetInstance()->display_manager(); |
| 81 | 81 |
| 82 // TODO(oshima): Use ComputeBondary instead and try all combinations. | 82 // TODO(oshima): Use ComputeBondary instead and try all combinations. |
| 83 for (const auto* placement : | 83 for (const auto& placement : |
| 84 display_manager->GetCurrentDisplayLayout().placement_list) { | 84 display_manager->GetCurrentDisplayLayout().placement_list) { |
| 85 DisplayPlacement::Position position = placement->position; | 85 DisplayPlacement::Position position = placement.position; |
| 86 const gfx::Display& a = | 86 const gfx::Display& a = |
| 87 display_manager->GetDisplayForId(placement->parent_display_id); | 87 display_manager->GetDisplayForId(placement.parent_display_id); |
| 88 const gfx::Display& b = | 88 const gfx::Display& b = |
| 89 display_manager->GetDisplayForId(placement->display_id); | 89 display_manager->GetDisplayForId(placement.display_id); |
| 90 | 90 |
| 91 if (position == DisplayPlacement::TOP || | 91 if (position == DisplayPlacement::TOP || |
| 92 position == DisplayPlacement::BOTTOM) { | 92 position == DisplayPlacement::BOTTOM) { |
| 93 AddWarpRegion(CreateHorizontalEdgeBounds(a, b, position), | 93 AddWarpRegion(CreateHorizontalEdgeBounds(a, b, position), |
| 94 drag_source != nullptr); | 94 drag_source != nullptr); |
| 95 } else { | 95 } else { |
| 96 AddWarpRegion(CreateVerticalEdgeBounds(a, b, position), | 96 AddWarpRegion(CreateVerticalEdgeBounds(a, b, position), |
| 97 drag_source != nullptr); | 97 drag_source != nullptr); |
| 98 } | 98 } |
| 99 } | 99 } |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 upper_indicator_y = std::max(upper_indicator_y, upper_shared_y); | 261 upper_indicator_y = std::max(upper_indicator_y, upper_shared_y); |
| 262 } | 262 } |
| 263 a_indicator_bounds.set_y(upper_indicator_y); | 263 a_indicator_bounds.set_y(upper_indicator_y); |
| 264 a_indicator_bounds.set_height(lower_indicator_y - upper_indicator_y); | 264 a_indicator_bounds.set_height(lower_indicator_y - upper_indicator_y); |
| 265 | 265 |
| 266 return make_scoped_ptr( | 266 return make_scoped_ptr( |
| 267 new WarpRegion(a.id(), b.id(), a_indicator_bounds, b_indicator_bounds)); | 267 new WarpRegion(a.id(), b.id(), a_indicator_bounds, b_indicator_bounds)); |
| 268 } | 268 } |
| 269 | 269 |
| 270 } // namespace ash | 270 } // namespace ash |
| OLD | NEW |