Chromium Code Reviews| Index: chrome/browser/chromeos/display/touch_calibrator/touch_calibrator_controller.cc |
| diff --git a/chrome/browser/chromeos/display/touch_calibrator/touch_calibrator_controller.cc b/chrome/browser/chromeos/display/touch_calibrator/touch_calibrator_controller.cc |
| index dd980bdc7f947ce9b793f6eee34d19725bb8ee1a..7b2b6a5cef383cf406a2f2977fad86fade486a80 100644 |
| --- a/chrome/browser/chromeos/display/touch_calibrator/touch_calibrator_controller.cc |
| +++ b/chrome/browser/chromeos/display/touch_calibrator/touch_calibrator_controller.cc |
| @@ -5,6 +5,7 @@ |
| #include "chrome/browser/chromeos/display/touch_calibrator/touch_calibrator_controller.h" |
| #include "ash/shell.h" |
| +#include "ash/touch/ash_touch_transform_controller.h" |
| #include "base/memory/ptr_util.h" |
| #include "chrome/browser/chromeos/display/touch_calibrator/touch_calibrator_view.h" |
| #include "ui/display/screen.h" |
| @@ -53,6 +54,8 @@ void TouchCalibratorController::StartCalibration( |
| } |
| // TODO(malaykeshav): Call TouchTransformController::SetForCalibration() |
|
oshima
2017/01/18 01:57:16
nit: remove the comment?
malaykeshav
2017/01/18 02:08:38
Done
|
| + ash::Shell::GetInstance()->touch_transformer_controller()->SetForCalibration( |
| + true); |
| // Add self as an event handler target. |
| ash::Shell::GetInstance()->AddPreTargetHandler(this); |
| @@ -64,7 +67,8 @@ void TouchCalibratorController::StopCalibration() { |
| is_calibrating_ = false; |
| ash::Shell::GetInstance()->window_tree_host_manager()->RemoveObserver(this); |
| - // TODO(malaykeshav): Call TouchTransformController::SetForCalibration() |
| + ash::Shell::GetInstance()->touch_transformer_controller()->SetForCalibration( |
| + false); |
| // Remove self as the event handler. |
| ash::Shell::GetInstance()->RemovePreTargetHandler(this); |
| @@ -92,12 +96,22 @@ void TouchCalibratorController::OnTouchEvent(ui::TouchEvent* touch) { |
| return; |
| if (base::Time::Now() - last_touch_timestamp_ < kTouchIntervalThreshold) |
| return; |
| - |
| last_touch_timestamp_ = base::Time::Now(); |
| TouchCalibratorView* target_screen_calibration_view = |
| touch_calibrator_views_[target_display_.id()].get(); |
| + // If this is the final state, then store all calibration data and stop |
| + // calibration. |
| + if (target_screen_calibration_view->state() == |
| + TouchCalibratorView::CALIBRATION_COMPLETE) { |
| + StopCalibration(); |
| + ash::Shell::GetInstance()->display_manager()->SetTouchCalibrationData( |
| + target_display_.id(), touch_point_quad_, |
| + target_screen_calibration_view->size()); |
| + return; |
| + } |
| + |
| int state_index; |
| // Maps the state to an integer value. Assigns a non negative integral value |
| // for a state in which the user can interact with the the interface. |
| @@ -131,17 +145,6 @@ void TouchCalibratorController::OnTouchEvent(ui::TouchEvent* touch) { |
| " display point. Retry calibration."; |
| } |
| - // If this is the final state, then store all calibration data and stop |
| - // calibration. |
| - if (target_screen_calibration_view->state() == |
| - TouchCalibratorView::CALIBRATION_COMPLETE) { |
| - ash::Shell::GetInstance()->display_manager()->SetTouchCalibrationData( |
| - target_display_.id(), touch_point_quad_, |
| - target_screen_calibration_view->size()); |
| - StopCalibration(); |
| - return; |
| - } |
| - |
| target_screen_calibration_view->AdvanceToNextState(); |
| } |