| 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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 display::OverscanCalibrationComplete::Params::Create(*args_)); | 260 display::OverscanCalibrationComplete::Params::Create(*args_)); |
| 261 if (!DisplayInfoProvider::Get()->OverscanCalibrationComplete(params->id)) { | 261 if (!DisplayInfoProvider::Get()->OverscanCalibrationComplete(params->id)) { |
| 262 return RespondNow( | 262 return RespondNow( |
| 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 SystemDisplayStartNativeTouchCalibrationFunction::Run() { |
| 271 std::unique_ptr<display::TouchCalibrationStart::Params> params( | 271 std::unique_ptr<display::StartNativeTouchCalibration::Params> params( |
| 272 display::TouchCalibrationStart::Params::Create(*args_)); | 272 display::StartNativeTouchCalibration::Params::Create(*args_)); |
| 273 | 273 |
| 274 std::string error; | 274 std::string error; |
| 275 if (DisplayInfoProvider::Get()->IsTouchCalibrationActive(&error)) | 275 if (DisplayInfoProvider::Get()->IsNativeTouchCalibrationActive(&error)) |
| 276 return RespondNow(Error(error)); | 276 return RespondNow(Error(error)); |
| 277 | 277 |
| 278 if (!DisplayInfoProvider::Get()->TouchCalibrationStart(params->id)) | 278 if (!DisplayInfoProvider::Get()->StartNativeTouchCalibration(params->id, |
| 279 return RespondNow(Error("Invalid display ID: " + params->id)); | 279 &error)) |
| 280 return RespondNow(Error(error)); |
| 280 return RespondNow(NoArguments()); | 281 return RespondNow(NoArguments()); |
| 281 } | 282 } |
| 282 | 283 |
| 283 ExtensionFunction::ResponseAction | 284 ExtensionFunction::ResponseAction |
| 284 SystemDisplayTouchCalibrationSetFunction::Run() { | 285 SystemDisplayStartCustomTouchCalibrationFunction::Run() { |
| 285 std::unique_ptr<display::TouchCalibrationSet::Params> params( | 286 std::unique_ptr<display::StartCustomTouchCalibration::Params> params( |
| 286 display::TouchCalibrationSet::Params::Create(*args_)); | 287 display::StartCustomTouchCalibration::Params::Create(*args_)); |
| 287 | 288 |
| 288 std::string error; | 289 std::string error; |
| 289 if (DisplayInfoProvider::Get()->IsTouchCalibrationActive(&error)) | 290 if (DisplayInfoProvider::Get()->IsNativeTouchCalibrationActive(&error)) |
| 290 return RespondNow(Error(error)); | 291 return RespondNow(Error(error)); |
| 291 | 292 |
| 292 if (!DisplayInfoProvider::Get()->TouchCalibrationSet( | 293 if (!DisplayInfoProvider::Get()->StartCustomTouchCalibration(params->id, |
| 293 params->id, params->pairs, params->bounds, &error)) { | 294 &error)) |
| 295 return RespondNow(Error(error)); |
| 296 return RespondNow(NoArguments()); |
| 297 } |
| 298 |
| 299 ExtensionFunction::ResponseAction |
| 300 SystemDisplayCompleteCustomTouchCalibrationFunction::Run() { |
| 301 std::unique_ptr<display::CompleteCustomTouchCalibration::Params> params( |
| 302 display::CompleteCustomTouchCalibration::Params::Create(*args_)); |
| 303 |
| 304 std::string error; |
| 305 if (DisplayInfoProvider::Get()->IsNativeTouchCalibrationActive(&error)) |
| 306 return RespondNow(Error(error)); |
| 307 |
| 308 if (!DisplayInfoProvider::Get()->CompleteCustomTouchCalibration( |
| 309 params->pairs, params->bounds, &error)) { |
| 294 return RespondNow(Error(error)); | 310 return RespondNow(Error(error)); |
| 295 } | 311 } |
| 296 return RespondNow(NoArguments()); | 312 return RespondNow(NoArguments()); |
| 297 } | 313 } |
| 298 | 314 |
| 299 ExtensionFunction::ResponseAction | 315 ExtensionFunction::ResponseAction |
| 300 SystemDisplayTouchCalibrationResetFunction::Run() { | 316 SystemDisplayResetTouchCalibrationFunction::Run() { |
| 301 std::unique_ptr<display::TouchCalibrationReset::Params> params( | 317 std::unique_ptr<display::ResetTouchCalibration::Params> params( |
| 302 display::TouchCalibrationReset::Params::Create(*args_)); | 318 display::ResetTouchCalibration::Params::Create(*args_)); |
| 303 | 319 |
| 304 std::string error; | 320 std::string error; |
| 305 if (DisplayInfoProvider::Get()->IsTouchCalibrationActive(&error)) | 321 if (DisplayInfoProvider::Get()->IsNativeTouchCalibrationActive(&error)) |
| 306 return RespondNow(Error(error)); | 322 return RespondNow(Error(error)); |
| 307 | 323 |
| 308 if (!DisplayInfoProvider::Get()->TouchCalibrationReset(params->id, &error)) | 324 if (!DisplayInfoProvider::Get()->ResetTouchCalibration(params->id, &error)) |
| 309 return RespondNow(Error(error)); | 325 return RespondNow(Error(error)); |
| 310 return RespondNow(NoArguments()); | 326 return RespondNow(NoArguments()); |
| 311 } | 327 } |
| 312 | 328 |
| 313 } // namespace extensions | 329 } // namespace extensions |
| OLD | NEW |