OLD | NEW |
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 "chrome/browser/chromeos/display/touch_calibrator/touch_calibrator_cont
roller.h" | 5 #include "chrome/browser/chromeos/display/touch_calibrator/touch_calibrator_cont
roller.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/touch/touch_transformer_controller.h" | |
9 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
10 #include "chrome/browser/chromeos/display/touch_calibrator/touch_calibrator_view
.h" | 9 #include "chrome/browser/chromeos/display/touch_calibrator/touch_calibrator_view
.h" |
11 #include "ui/display/screen.h" | 10 #include "ui/display/screen.h" |
12 #include "ui/events/event.h" | 11 #include "ui/events/event.h" |
13 #include "ui/events/event_constants.h" | 12 #include "ui/events/event_constants.h" |
14 | 13 |
15 namespace chromeos { | 14 namespace chromeos { |
16 | 15 |
17 // Time interval after a touch event during which all other touch events are | 16 // Time interval after a touch event during which all other touch events are |
18 // ignored during calibration. | 17 // ignored during calibration. |
(...skipping 27 matching lines...) Expand all Loading... |
46 | 45 |
47 std::vector<display::Display> displays = | 46 std::vector<display::Display> displays = |
48 display::Screen::GetScreen()->GetAllDisplays(); | 47 display::Screen::GetScreen()->GetAllDisplays(); |
49 | 48 |
50 for (const display::Display& display : displays) { | 49 for (const display::Display& display : displays) { |
51 bool is_primary_view = display.id() == target_display_.id(); | 50 bool is_primary_view = display.id() == target_display_.id(); |
52 touch_calibrator_views_[display.id()] = | 51 touch_calibrator_views_[display.id()] = |
53 base::MakeUnique<TouchCalibratorView>(display, is_primary_view); | 52 base::MakeUnique<TouchCalibratorView>(display, is_primary_view); |
54 } | 53 } |
55 | 54 |
56 // TODO(malaykeshav): Call TouchTransformerController::SetForCalibration() | 55 // TODO(malaykeshav): Call TouchTransformController::SetForCalibration() |
57 | 56 |
58 // Add self as an event handler target. | 57 // Add self as an event handler target. |
59 ash::Shell::GetInstance()->AddPreTargetHandler(this); | 58 ash::Shell::GetInstance()->AddPreTargetHandler(this); |
60 } | 59 } |
61 | 60 |
62 void TouchCalibratorController::StopCalibration() { | 61 void TouchCalibratorController::StopCalibration() { |
63 if (!is_calibrating_) | 62 if (!is_calibrating_) |
64 return; | 63 return; |
65 is_calibrating_ = false; | 64 is_calibrating_ = false; |
66 ash::Shell::GetInstance()->window_tree_host_manager()->RemoveObserver(this); | 65 ash::Shell::GetInstance()->window_tree_host_manager()->RemoveObserver(this); |
67 | 66 |
68 // TODO(malaykeshav): Call TouchTransformerController::SetForCalibration() | 67 // TODO(malaykeshav): Call TouchTransformController::SetForCalibration() |
69 | 68 |
70 // Remove self as the event handler. | 69 // Remove self as the event handler. |
71 ash::Shell::GetInstance()->RemovePreTargetHandler(this); | 70 ash::Shell::GetInstance()->RemovePreTargetHandler(this); |
72 | 71 |
73 // Transition all touch calibrator views to their final state for a graceful | 72 // Transition all touch calibrator views to their final state for a graceful |
74 // exit. | 73 // exit. |
75 for (const auto& it : touch_calibrator_views_) | 74 for (const auto& it : touch_calibrator_views_) |
76 it.second->SkipToFinalState(); | 75 it.second->SkipToFinalState(); |
77 } | 76 } |
78 | 77 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 target_display_.id(), touch_point_quad_, | 135 target_display_.id(), touch_point_quad_, |
137 target_screen_calibration_view->size()); | 136 target_screen_calibration_view->size()); |
138 StopCalibration(); | 137 StopCalibration(); |
139 return; | 138 return; |
140 } | 139 } |
141 | 140 |
142 target_screen_calibration_view->AdvanceToNextState(); | 141 target_screen_calibration_view->AdvanceToNextState(); |
143 } | 142 } |
144 | 143 |
145 } // namespace chromeos | 144 } // namespace chromeos |
OLD | NEW |