Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(145)

Side by Side Diff: extensions/browser/api/system_display/system_display_api.cc

Issue 2603563002: Plumbs touch calibration API to the display manager (Closed)
Patch Set: It works. The plumbing! Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « extensions/browser/api/system_display/display_info_provider.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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)) { 273
274 return RespondNow(Error( 274 std::string error;
275 "Another touch calibration is already active.")); 275 if (DisplayInfoProvider::Get()->IsTouchCalibrationActive(&error))
276 } 276 return RespondNow(Error(error));
277
277 if (!DisplayInfoProvider::Get()->TouchCalibrationStart(params->id)) 278 if (!DisplayInfoProvider::Get()->TouchCalibrationStart(params->id))
278 return RespondNow(Error("Invalid display ID: " + params->id)); 279 return RespondNow(Error("Invalid display ID: " + params->id));
279 return RespondNow(NoArguments()); 280 return RespondNow(NoArguments());
280 } 281 }
281 282
282 ExtensionFunction::ResponseAction 283 ExtensionFunction::ResponseAction
283 SystemDisplayTouchCalibrationSetFunction::Run() { 284 SystemDisplayTouchCalibrationSetFunction::Run() {
284 std::unique_ptr<display::TouchCalibrationSet::Params> params( 285 std::unique_ptr<display::TouchCalibrationSet::Params> params(
285 display::TouchCalibrationSet::Params::Create(*args_)); 286 display::TouchCalibrationSet::Params::Create(*args_));
286 if (!DisplayInfoProvider::Get()->IsTouchCalibrationActive(params->id)) { 287
287 return RespondNow(Error( 288 std::string error;
288 "Another touch calibration is already active.")); 289 if (DisplayInfoProvider::Get()->IsTouchCalibrationActive(&error))
289 } 290 return RespondNow(Error(error));
290 if (!DisplayInfoProvider::Get()->TouchCalibrationSet(params->id, 291
291 params->pairs, 292 if (!DisplayInfoProvider::Get()->TouchCalibrationSet(
292 params->bounds)) { 293 params->id, params->pairs, params->bounds, &error)) {
293 return RespondNow(Error("Invalid display ID: " + params->id)); 294 return RespondNow(Error(error));
294 } 295 }
295 return RespondNow(NoArguments()); 296 return RespondNow(NoArguments());
296 } 297 }
297 298
298 ExtensionFunction::ResponseAction 299 ExtensionFunction::ResponseAction
299 SystemDisplayTouchCalibrationResetFunction::Run() { 300 SystemDisplayTouchCalibrationResetFunction::Run() {
300 std::unique_ptr<display::TouchCalibrationReset::Params> params( 301 std::unique_ptr<display::TouchCalibrationReset::Params> params(
301 display::TouchCalibrationReset::Params::Create(*args_)); 302 display::TouchCalibrationReset::Params::Create(*args_));
302 if (!DisplayInfoProvider::Get()->IsTouchCalibrationActive(params->id)) { 303
303 return RespondNow(Error( 304 std::string error;
304 "Another touch calibration is already active.")); 305 if (DisplayInfoProvider::Get()->IsTouchCalibrationActive(&error))
305 } 306 return RespondNow(Error(error));
306 if (!DisplayInfoProvider::Get()->TouchCalibrationReset(params->id)) 307
307 return RespondNow(Error("Invalid display ID: " + params->id)); 308 if (!DisplayInfoProvider::Get()->TouchCalibrationReset(params->id, &error))
309 return RespondNow(Error(error));
308 return RespondNow(NoArguments()); 310 return RespondNow(NoArguments());
309 } 311 }
310 312
311 } // namespace extensions 313 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/api/system_display/display_info_provider.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698