| Index: extensions/browser/api/system_display/system_display_api.cc
|
| diff --git a/extensions/browser/api/system_display/system_display_api.cc b/extensions/browser/api/system_display/system_display_api.cc
|
| index 41ed192169f49346d0a5dc96f2fa2fac96b49499..1b7596586587675fd2bea9c29f4e3bb3777ed9a7 100644
|
| --- a/extensions/browser/api/system_display/system_display_api.cc
|
| +++ b/extensions/browser/api/system_display/system_display_api.cc
|
| @@ -270,10 +270,11 @@ ExtensionFunction::ResponseAction
|
| SystemDisplayTouchCalibrationStartFunction::Run() {
|
| std::unique_ptr<display::TouchCalibrationStart::Params> params(
|
| display::TouchCalibrationStart::Params::Create(*args_));
|
| - if (!DisplayInfoProvider::Get()->IsTouchCalibrationActive(params->id)) {
|
| - return RespondNow(Error(
|
| - "Another touch calibration is already active."));
|
| - }
|
| +
|
| + std::string error;
|
| + if (DisplayInfoProvider::Get()->IsTouchCalibrationActive(&error))
|
| + return RespondNow(Error(error));
|
| +
|
| if (!DisplayInfoProvider::Get()->TouchCalibrationStart(params->id))
|
| return RespondNow(Error("Invalid display ID: " + params->id));
|
| return RespondNow(NoArguments());
|
| @@ -283,14 +284,14 @@ ExtensionFunction::ResponseAction
|
| SystemDisplayTouchCalibrationSetFunction::Run() {
|
| std::unique_ptr<display::TouchCalibrationSet::Params> params(
|
| display::TouchCalibrationSet::Params::Create(*args_));
|
| - if (!DisplayInfoProvider::Get()->IsTouchCalibrationActive(params->id)) {
|
| - return RespondNow(Error(
|
| - "Another touch calibration is already active."));
|
| - }
|
| - if (!DisplayInfoProvider::Get()->TouchCalibrationSet(params->id,
|
| - params->pairs,
|
| - params->bounds)) {
|
| - return RespondNow(Error("Invalid display ID: " + params->id));
|
| +
|
| + std::string error;
|
| + if (DisplayInfoProvider::Get()->IsTouchCalibrationActive(&error))
|
| + return RespondNow(Error(error));
|
| +
|
| + if (!DisplayInfoProvider::Get()->TouchCalibrationSet(
|
| + params->id, params->pairs, params->bounds, &error)) {
|
| + return RespondNow(Error(error));
|
| }
|
| return RespondNow(NoArguments());
|
| }
|
| @@ -299,12 +300,13 @@ ExtensionFunction::ResponseAction
|
| SystemDisplayTouchCalibrationResetFunction::Run() {
|
| std::unique_ptr<display::TouchCalibrationReset::Params> params(
|
| display::TouchCalibrationReset::Params::Create(*args_));
|
| - if (!DisplayInfoProvider::Get()->IsTouchCalibrationActive(params->id)) {
|
| - return RespondNow(Error(
|
| - "Another touch calibration is already active."));
|
| - }
|
| - if (!DisplayInfoProvider::Get()->TouchCalibrationReset(params->id))
|
| - return RespondNow(Error("Invalid display ID: " + params->id));
|
| +
|
| + std::string error;
|
| + if (DisplayInfoProvider::Get()->IsTouchCalibrationActive(&error))
|
| + return RespondNow(Error(error));
|
| +
|
| + if (!DisplayInfoProvider::Get()->TouchCalibrationReset(params->id, &error))
|
| + return RespondNow(Error(error));
|
| return RespondNow(NoArguments());
|
| }
|
|
|
|
|