Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "extensions/browser/api/system_display/system_display_api.h" | 5 #include "extensions/browser/api/system_display/system_display_api.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 263 Error("Calibration not started for display ID: " + params->id)); | 263 Error("Calibration not started for display ID: " + params->id)); |
| 264 } | 264 } |
| 265 OverscanTracker::RemoveDisplay(GetSenderWebContents(), params->id); | 265 OverscanTracker::RemoveDisplay(GetSenderWebContents(), params->id); |
| 266 return RespondNow(NoArguments()); | 266 return RespondNow(NoArguments()); |
| 267 } | 267 } |
| 268 | 268 |
| 269 ExtensionFunction::ResponseAction | 269 ExtensionFunction::ResponseAction |
| 270 SystemDisplayTouchCalibrationStartFunction::Run() { | 270 SystemDisplayTouchCalibrationStartFunction::Run() { |
| 271 std::unique_ptr<display::TouchCalibrationStart::Params> params( | 271 std::unique_ptr<display::TouchCalibrationStart::Params> params( |
| 272 display::TouchCalibrationStart::Params::Create(*args_)); | 272 display::TouchCalibrationStart::Params::Create(*args_)); |
| 273 if (!DisplayInfoProvider::Get()->IsTouchCalibrationActive(params->id)) { | |
| 274 return RespondNow(Error( | |
| 275 "Another touch calibration is already active.")); | |
| 276 } | |
|
stevenjb
2016/12/27 19:37:27
This seems like a useful error? (Although the logi
malaykeshav
2016/12/27 20:07:01
This check has been moved to ValidateParamsForTouc
stevenjb
2016/12/27 21:58:12
Looking at that code, that seems like a strange pl
malaykeshav
2016/12/28 12:34:28
Done
| |
| 277 if (!DisplayInfoProvider::Get()->TouchCalibrationStart(params->id)) | 273 if (!DisplayInfoProvider::Get()->TouchCalibrationStart(params->id)) |
| 278 return RespondNow(Error("Invalid display ID: " + params->id)); | 274 return RespondNow(Error("Invalid display ID: " + params->id)); |
| 279 return RespondNow(NoArguments()); | 275 return RespondNow(NoArguments()); |
| 280 } | 276 } |
| 281 | 277 |
| 282 ExtensionFunction::ResponseAction | 278 ExtensionFunction::ResponseAction |
| 283 SystemDisplayTouchCalibrationSetFunction::Run() { | 279 SystemDisplayTouchCalibrationSetFunction::Run() { |
| 284 std::unique_ptr<display::TouchCalibrationSet::Params> params( | 280 std::unique_ptr<display::TouchCalibrationSet::Params> params( |
| 285 display::TouchCalibrationSet::Params::Create(*args_)); | 281 display::TouchCalibrationSet::Params::Create(*args_)); |
| 286 if (!DisplayInfoProvider::Get()->IsTouchCalibrationActive(params->id)) { | 282 std::string error; |
| 287 return RespondNow(Error( | 283 if (!DisplayInfoProvider::Get()->TouchCalibrationSet( |
| 288 "Another touch calibration is already active.")); | 284 params->id, params->pairs, params->bounds, &error)) { |
| 289 } | 285 return RespondNow(Error(error)); |
| 290 if (!DisplayInfoProvider::Get()->TouchCalibrationSet(params->id, | |
| 291 params->pairs, | |
| 292 params->bounds)) { | |
| 293 return RespondNow(Error("Invalid display ID: " + params->id)); | |
| 294 } | 286 } |
| 295 return RespondNow(NoArguments()); | 287 return RespondNow(NoArguments()); |
| 296 } | 288 } |
| 297 | 289 |
| 298 ExtensionFunction::ResponseAction | 290 ExtensionFunction::ResponseAction |
| 299 SystemDisplayTouchCalibrationResetFunction::Run() { | 291 SystemDisplayTouchCalibrationResetFunction::Run() { |
| 300 std::unique_ptr<display::TouchCalibrationReset::Params> params( | 292 std::unique_ptr<display::TouchCalibrationReset::Params> params( |
| 301 display::TouchCalibrationReset::Params::Create(*args_)); | 293 display::TouchCalibrationReset::Params::Create(*args_)); |
| 302 if (!DisplayInfoProvider::Get()->IsTouchCalibrationActive(params->id)) { | 294 std::string error; |
| 303 return RespondNow(Error( | 295 if (!DisplayInfoProvider::Get()->TouchCalibrationReset(params->id, &error)) |
| 304 "Another touch calibration is already active.")); | 296 return RespondNow(Error(error)); |
| 305 } | |
| 306 if (!DisplayInfoProvider::Get()->TouchCalibrationReset(params->id)) | |
| 307 return RespondNow(Error("Invalid display ID: " + params->id)); | |
| 308 return RespondNow(NoArguments()); | 297 return RespondNow(NoArguments()); |
| 309 } | 298 } |
| 310 | 299 |
| 311 } // namespace extensions | 300 } // namespace extensions |
| OLD | NEW |