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 <memory> | 7 #include <memory> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 SystemDisplayOverscanCalibrationCompleteFunction::Run() { | 131 SystemDisplayOverscanCalibrationCompleteFunction::Run() { |
132 std::unique_ptr<display::OverscanCalibrationComplete::Params> params( | 132 std::unique_ptr<display::OverscanCalibrationComplete::Params> params( |
133 display::OverscanCalibrationComplete::Params::Create(*args_)); | 133 display::OverscanCalibrationComplete::Params::Create(*args_)); |
134 if (!DisplayInfoProvider::Get()->OverscanCalibrationComplete(params->id)) { | 134 if (!DisplayInfoProvider::Get()->OverscanCalibrationComplete(params->id)) { |
135 return RespondNow( | 135 return RespondNow( |
136 Error("Calibration not started for display ID: " + params->id)); | 136 Error("Calibration not started for display ID: " + params->id)); |
137 } | 137 } |
138 return RespondNow(NoArguments()); | 138 return RespondNow(NoArguments()); |
139 } | 139 } |
140 | 140 |
| 141 ExtensionFunction::ResponseAction |
| 142 SystemDisplayTouchCalibrationStartFunction::Run() { |
| 143 std::unique_ptr<display::TouchCalibrationStart::Params> params( |
| 144 display::TouchCalibrationStart::Params::Create(*args_)); |
| 145 if (!DisplayInfoProvider::Get()->IsTouchCalibrationActive(params->id)) { |
| 146 return RespondNow(Error( |
| 147 "Another touch calibration is already active.")); |
| 148 } |
| 149 if (!DisplayInfoProvider::Get()->TouchCalibrationStart(params->id)) |
| 150 return RespondNow(Error("Invalid display ID: " + params->id)); |
| 151 return RespondNow(NoArguments()); |
| 152 } |
| 153 |
| 154 ExtensionFunction::ResponseAction |
| 155 SystemDisplayTouchCalibrationSetFunction::Run() { |
| 156 std::unique_ptr<display::TouchCalibrationSet::Params> params( |
| 157 display::TouchCalibrationSet::Params::Create(*args_)); |
| 158 if (!DisplayInfoProvider::Get()->IsTouchCalibrationActive(params->id)) { |
| 159 return RespondNow(Error( |
| 160 "Another touch calibration is already active.")); |
| 161 } |
| 162 if (!DisplayInfoProvider::Get()->TouchCalibrationSet(params->id, |
| 163 params->pairs, |
| 164 params->bounds)) { |
| 165 return RespondNow(Error("Invalid display ID: " + params->id)); |
| 166 } |
| 167 return RespondNow(NoArguments()); |
| 168 } |
| 169 |
| 170 ExtensionFunction::ResponseAction |
| 171 SystemDisplayTouchCalibrationResetFunction::Run() { |
| 172 std::unique_ptr<display::TouchCalibrationReset::Params> params( |
| 173 display::TouchCalibrationReset::Params::Create(*args_)); |
| 174 if (!DisplayInfoProvider::Get()->IsTouchCalibrationActive(params->id)) { |
| 175 return RespondNow(Error( |
| 176 "Another touch calibration is already active.")); |
| 177 } |
| 178 if (!DisplayInfoProvider::Get()->TouchCalibrationReset(params->id)) |
| 179 return RespondNow(Error("Invalid display ID: " + params->id)); |
| 180 return RespondNow(NoArguments()); |
| 181 } |
| 182 |
141 } // namespace extensions | 183 } // namespace extensions |
OLD | NEW |