| Index: chrome/browser/extensions/display_info_provider_chromeos.cc
|
| diff --git a/chrome/browser/extensions/display_info_provider_chromeos.cc b/chrome/browser/extensions/display_info_provider_chromeos.cc
|
| index b8f392453b8ee16f77fa226a4cce1d6fffaa52ff..60dc08e4f81459e176d814a7e4b85e9e74ab24ce 100644
|
| --- a/chrome/browser/extensions/display_info_provider_chromeos.cc
|
| +++ b/chrome/browser/extensions/display_info_provider_chromeos.cc
|
| @@ -9,6 +9,7 @@
|
| #include "ash/display/display_configuration_controller.h"
|
| #include "ash/display/resolution_notification_controller.h"
|
| #include "ash/shell.h"
|
| +#include "ash/touch/ash_touch_transform_controller.h"
|
| #include "base/strings/string_number_conversions.h"
|
| #include "chrome/browser/chromeos/display/display_preferences.h"
|
| #include "chrome/browser/chromeos/display/overscan_calibrator.h"
|
| @@ -660,19 +661,73 @@ bool DisplayInfoProviderChromeOS::OverscanCalibrationComplete(
|
| return true;
|
| }
|
|
|
| -bool DisplayInfoProviderChromeOS::TouchCalibrationSet(
|
| +bool DisplayInfoProviderChromeOS::ShowNativeTouchCalibration(
|
| + const std::string& id, std::string* error,
|
| + const DisplayInfoProvider::TouchCalibrationCallback& callback) {
|
| + VLOG(1) << "StartNativeTouchCalibration: " << id;
|
| +
|
| + if (custom_touch_calibration_active_) {
|
| + *error = "Please complete the custom touch calibration that is under "
|
| + "progress for id - " + touch_calibration_target_id_ + " before "
|
| + "calling this method.";
|
| + return false;
|
| + }
|
| +
|
| + const display::Display display = GetDisplay(id);
|
| + if (!ValidateParamsForTouchCalibration(id, display, GetTouchCalibrator(),
|
| + error)) {
|
| + return false;
|
| + }
|
| +
|
| + GetTouchCalibrator()->AddCallback(callback);
|
| + GetTouchCalibrator()->StartCalibration(display);
|
| + return true;
|
| +}
|
| +
|
| +bool DisplayInfoProviderChromeOS::StartCustomTouchCalibration(
|
| const std::string& id,
|
| - const api::system_display::TouchCalibrationPairQuad& pairs,
|
| - const api::system_display::Bounds& bounds,
|
| std::string* error) {
|
| - VLOG(1) << "TouchCalibrationSet: " << id;
|
| -
|
| + VLOG(1) << "StartCustomTouchCalibration: " << id;
|
| const display::Display display = GetDisplay(id);
|
| if (!ValidateParamsForTouchCalibration(id, display, GetTouchCalibrator(),
|
| error)) {
|
| return false;
|
| }
|
|
|
| + touch_calibration_target_id_ = id;
|
| + custom_touch_calibration_active_ = true;
|
| +
|
| + // Enable un-transformed touch input.
|
| + ash::Shell::GetInstance()->touch_transformer_controller()->SetForCalibration(
|
| + true);
|
| + return true;
|
| +}
|
| +
|
| +bool DisplayInfoProviderChromeOS::CompleteCustomTouchCalibration(
|
| + const api::system_display::TouchCalibrationPairQuad& pairs,
|
| + const api::system_display::Bounds& bounds,
|
| + std::string* error) {
|
| + VLOG(1) << "CompleteCustomTouchCalibration: " << touch_calibration_target_id_;
|
| +
|
| + ash::Shell::GetInstance()->touch_transformer_controller()->SetForCalibration(
|
| + false);
|
| +
|
| + const display::Display display = GetDisplay(touch_calibration_target_id_);
|
| + touch_calibration_target_id_ = "";
|
| +
|
| + if (!custom_touch_calibration_active_) {
|
| + *error = "Please call system.display.startCustomTouchCalibration before "
|
| + "calling this method.";
|
| + return false;
|
| + }
|
| +
|
| + custom_touch_calibration_active_ = false;
|
| +
|
| + if (!ValidateParamsForTouchCalibration(
|
| + touch_calibration_target_id_, display, GetTouchCalibrator(), error)) {
|
| + return false;
|
| + }
|
| +
|
| display::TouchCalibrationData::CalibrationPointPairQuad calibration_points;
|
| calibration_points[0] = GetCalibrationPair(pairs.pair1);
|
| calibration_points[1] = GetCalibrationPair(pairs.pair2);
|
| @@ -710,7 +765,7 @@ bool DisplayInfoProviderChromeOS::TouchCalibrationSet(
|
| return true;
|
| }
|
|
|
| -bool DisplayInfoProviderChromeOS::TouchCalibrationReset(const std::string& id,
|
| +bool DisplayInfoProviderChromeOS::ResetTouchCalibration(const std::string& id,
|
| std::string* error) {
|
| const display::Display display = GetDisplay(id);
|
|
|
| @@ -724,7 +779,8 @@ bool DisplayInfoProviderChromeOS::TouchCalibrationReset(const std::string& id,
|
| return true;
|
| }
|
|
|
| -bool DisplayInfoProviderChromeOS::IsTouchCalibrationActive(std::string* error) {
|
| +bool DisplayInfoProviderChromeOS::IsNativeTouchCalibrationActive(
|
| + std::string* error) {
|
| if (GetTouchCalibrator()->is_calibrating()) {
|
| *error = "Another touch calibration is already active.";
|
| return true;
|
|
|