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 "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "chrome/browser/chromeos/display/touch_calibrator/touch_calibrator_view
.h" | 9 #include "chrome/browser/chromeos/display/touch_calibrator/touch_calibrator_view
.h" |
10 #include "ui/display/screen.h" | 10 #include "ui/display/screen.h" |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 // Return early if the interface is in a state that does not allow user | 118 // Return early if the interface is in a state that does not allow user |
119 // interaction. | 119 // interaction. |
120 return; | 120 return; |
121 } | 121 } |
122 | 122 |
123 // Store touch point corresponding to its display point. | 123 // Store touch point corresponding to its display point. |
124 gfx::Point display_point; | 124 gfx::Point display_point; |
125 if (target_screen_calibration_view->GetDisplayPointLocation(&display_point)) { | 125 if (target_screen_calibration_view->GetDisplayPointLocation(&display_point)) { |
126 touch_point_quad_[state_index] = | 126 touch_point_quad_[state_index] = |
127 std::make_pair(display_point, touch->location()); | 127 std::make_pair(display_point, touch->location()); |
| 128 } else { |
| 129 // TODO(malaykeshav): Display some kind of error for the user. |
| 130 NOTREACHED() << "Touch calibration failed. Could not retrieve location for" |
| 131 " display point. Retry calibration."; |
128 } | 132 } |
129 | 133 |
130 // If this is the final state, then store all calibration data and stop | 134 // If this is the final state, then store all calibration data and stop |
131 // calibration. | 135 // calibration. |
132 if (target_screen_calibration_view->state() == | 136 if (target_screen_calibration_view->state() == |
133 TouchCalibratorView::CALIBRATION_COMPLETE) { | 137 TouchCalibratorView::CALIBRATION_COMPLETE) { |
134 ash::Shell::GetInstance()->display_manager()->SetTouchCalibrationData( | 138 ash::Shell::GetInstance()->display_manager()->SetTouchCalibrationData( |
135 target_display_.id(), touch_point_quad_, | 139 target_display_.id(), touch_point_quad_, |
136 target_screen_calibration_view->size()); | 140 target_screen_calibration_view->size()); |
137 StopCalibration(); | 141 StopCalibration(); |
138 return; | 142 return; |
139 } | 143 } |
140 | 144 |
141 target_screen_calibration_view->AdvanceToNextState(); | 145 target_screen_calibration_view->AdvanceToNextState(); |
142 } | 146 } |
143 | 147 |
144 } // namespace chromeos | 148 } // namespace chromeos |
OLD | NEW |