OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/extensions/api/autotest_private/autotest_private_api.h" | 5 #include "chrome/browser/extensions/api/autotest_private/autotest_private_api.h" |
6 | 6 |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "chrome/browser/extensions/extension_action_manager.h" | 10 #include "chrome/browser/extensions/extension_action_manager.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 } | 75 } |
76 | 76 |
77 bool AutotestPrivateRestartFunction::RunSync() { | 77 bool AutotestPrivateRestartFunction::RunSync() { |
78 DVLOG(1) << "AutotestPrivateRestartFunction"; | 78 DVLOG(1) << "AutotestPrivateRestartFunction"; |
79 if (!IsTestMode(GetProfile())) | 79 if (!IsTestMode(GetProfile())) |
80 chrome::AttemptRestart(); | 80 chrome::AttemptRestart(); |
81 return true; | 81 return true; |
82 } | 82 } |
83 | 83 |
84 bool AutotestPrivateShutdownFunction::RunSync() { | 84 bool AutotestPrivateShutdownFunction::RunSync() { |
85 scoped_ptr<api::autotest_private::Shutdown::Params> params( | 85 std::unique_ptr<api::autotest_private::Shutdown::Params> params( |
86 api::autotest_private::Shutdown::Params::Create(*args_)); | 86 api::autotest_private::Shutdown::Params::Create(*args_)); |
87 EXTENSION_FUNCTION_VALIDATE(params.get()); | 87 EXTENSION_FUNCTION_VALIDATE(params.get()); |
88 | 88 |
89 DVLOG(1) << "AutotestPrivateShutdownFunction " << params->force; | 89 DVLOG(1) << "AutotestPrivateShutdownFunction " << params->force; |
90 | 90 |
91 if (!IsTestMode(GetProfile())) | 91 if (!IsTestMode(GetProfile())) |
92 chrome::AttemptExit(); | 92 chrome::AttemptExit(); |
93 return true; | 93 return true; |
94 } | 94 } |
95 | 95 |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 volatile int testarray[3] = {0, 0, 0}; | 220 volatile int testarray[3] = {0, 0, 0}; |
221 | 221 |
222 // Cause Address Sanitizer to abort this process. | 222 // Cause Address Sanitizer to abort this process. |
223 volatile int index = 5; | 223 volatile int index = 5; |
224 AccessArray(testarray, &index); | 224 AccessArray(testarray, &index); |
225 } | 225 } |
226 return true; | 226 return true; |
227 } | 227 } |
228 | 228 |
229 bool AutotestPrivateSetTouchpadSensitivityFunction::RunSync() { | 229 bool AutotestPrivateSetTouchpadSensitivityFunction::RunSync() { |
230 scoped_ptr<api::autotest_private::SetTouchpadSensitivity::Params> params( | 230 std::unique_ptr<api::autotest_private::SetTouchpadSensitivity::Params> params( |
231 api::autotest_private::SetTouchpadSensitivity::Params::Create(*args_)); | 231 api::autotest_private::SetTouchpadSensitivity::Params::Create(*args_)); |
232 EXTENSION_FUNCTION_VALIDATE(params.get()); | 232 EXTENSION_FUNCTION_VALIDATE(params.get()); |
233 | 233 |
234 DVLOG(1) << "AutotestPrivateSetTouchpadSensitivityFunction " << params->value; | 234 DVLOG(1) << "AutotestPrivateSetTouchpadSensitivityFunction " << params->value; |
235 | 235 |
236 #if defined(OS_CHROMEOS) | 236 #if defined(OS_CHROMEOS) |
237 chromeos::system::InputDeviceSettings::Get()->SetTouchpadSensitivity( | 237 chromeos::system::InputDeviceSettings::Get()->SetTouchpadSensitivity( |
238 params->value); | 238 params->value); |
239 #endif | 239 #endif |
240 return true; | 240 return true; |
241 } | 241 } |
242 | 242 |
243 bool AutotestPrivateSetTapToClickFunction::RunSync() { | 243 bool AutotestPrivateSetTapToClickFunction::RunSync() { |
244 scoped_ptr<api::autotest_private::SetTapToClick::Params> params( | 244 std::unique_ptr<api::autotest_private::SetTapToClick::Params> params( |
245 api::autotest_private::SetTapToClick::Params::Create(*args_)); | 245 api::autotest_private::SetTapToClick::Params::Create(*args_)); |
246 EXTENSION_FUNCTION_VALIDATE(params.get()); | 246 EXTENSION_FUNCTION_VALIDATE(params.get()); |
247 | 247 |
248 DVLOG(1) << "AutotestPrivateSetTapToClickFunction " << params->enabled; | 248 DVLOG(1) << "AutotestPrivateSetTapToClickFunction " << params->enabled; |
249 | 249 |
250 #if defined(OS_CHROMEOS) | 250 #if defined(OS_CHROMEOS) |
251 chromeos::system::InputDeviceSettings::Get()->SetTapToClick(params->enabled); | 251 chromeos::system::InputDeviceSettings::Get()->SetTapToClick(params->enabled); |
252 #endif | 252 #endif |
253 return true; | 253 return true; |
254 } | 254 } |
255 | 255 |
256 bool AutotestPrivateSetThreeFingerClickFunction::RunSync() { | 256 bool AutotestPrivateSetThreeFingerClickFunction::RunSync() { |
257 scoped_ptr<api::autotest_private::SetThreeFingerClick::Params> params( | 257 std::unique_ptr<api::autotest_private::SetThreeFingerClick::Params> params( |
258 api::autotest_private::SetThreeFingerClick::Params::Create(*args_)); | 258 api::autotest_private::SetThreeFingerClick::Params::Create(*args_)); |
259 EXTENSION_FUNCTION_VALIDATE(params.get()); | 259 EXTENSION_FUNCTION_VALIDATE(params.get()); |
260 | 260 |
261 DVLOG(1) << "AutotestPrivateSetThreeFingerClickFunction " << params->enabled; | 261 DVLOG(1) << "AutotestPrivateSetThreeFingerClickFunction " << params->enabled; |
262 | 262 |
263 #if defined(OS_CHROMEOS) | 263 #if defined(OS_CHROMEOS) |
264 chromeos::system::InputDeviceSettings::Get()->SetThreeFingerClick( | 264 chromeos::system::InputDeviceSettings::Get()->SetThreeFingerClick( |
265 params->enabled); | 265 params->enabled); |
266 #endif | 266 #endif |
267 return true; | 267 return true; |
268 } | 268 } |
269 | 269 |
270 bool AutotestPrivateSetTapDraggingFunction::RunSync() { | 270 bool AutotestPrivateSetTapDraggingFunction::RunSync() { |
271 scoped_ptr<api::autotest_private::SetTapDragging::Params> params( | 271 std::unique_ptr<api::autotest_private::SetTapDragging::Params> params( |
272 api::autotest_private::SetTapDragging::Params::Create(*args_)); | 272 api::autotest_private::SetTapDragging::Params::Create(*args_)); |
273 EXTENSION_FUNCTION_VALIDATE(params.get()); | 273 EXTENSION_FUNCTION_VALIDATE(params.get()); |
274 | 274 |
275 DVLOG(1) << "AutotestPrivateSetTapDraggingFunction " << params->enabled; | 275 DVLOG(1) << "AutotestPrivateSetTapDraggingFunction " << params->enabled; |
276 | 276 |
277 #if defined(OS_CHROMEOS) | 277 #if defined(OS_CHROMEOS) |
278 chromeos::system::InputDeviceSettings::Get()->SetTapDragging(params->enabled); | 278 chromeos::system::InputDeviceSettings::Get()->SetTapDragging(params->enabled); |
279 #endif | 279 #endif |
280 return true; | 280 return true; |
281 } | 281 } |
282 | 282 |
283 bool AutotestPrivateSetNaturalScrollFunction::RunSync() { | 283 bool AutotestPrivateSetNaturalScrollFunction::RunSync() { |
284 scoped_ptr<api::autotest_private::SetNaturalScroll::Params> params( | 284 std::unique_ptr<api::autotest_private::SetNaturalScroll::Params> params( |
285 api::autotest_private::SetNaturalScroll::Params::Create(*args_)); | 285 api::autotest_private::SetNaturalScroll::Params::Create(*args_)); |
286 EXTENSION_FUNCTION_VALIDATE(params.get()); | 286 EXTENSION_FUNCTION_VALIDATE(params.get()); |
287 | 287 |
288 DVLOG(1) << "AutotestPrivateSetNaturalScrollFunction " << params->enabled; | 288 DVLOG(1) << "AutotestPrivateSetNaturalScrollFunction " << params->enabled; |
289 | 289 |
290 #if defined(OS_CHROMEOS) | 290 #if defined(OS_CHROMEOS) |
291 chromeos::system::InputDeviceSettings::Get()->SetNaturalScroll( | 291 chromeos::system::InputDeviceSettings::Get()->SetNaturalScroll( |
292 params->enabled); | 292 params->enabled); |
293 #endif | 293 #endif |
294 return true; | 294 return true; |
295 } | 295 } |
296 | 296 |
297 bool AutotestPrivateSetMouseSensitivityFunction::RunSync() { | 297 bool AutotestPrivateSetMouseSensitivityFunction::RunSync() { |
298 scoped_ptr<api::autotest_private::SetMouseSensitivity::Params> params( | 298 std::unique_ptr<api::autotest_private::SetMouseSensitivity::Params> params( |
299 api::autotest_private::SetMouseSensitivity::Params::Create(*args_)); | 299 api::autotest_private::SetMouseSensitivity::Params::Create(*args_)); |
300 EXTENSION_FUNCTION_VALIDATE(params.get()); | 300 EXTENSION_FUNCTION_VALIDATE(params.get()); |
301 | 301 |
302 DVLOG(1) << "AutotestPrivateSetMouseSensitivityFunction " << params->value; | 302 DVLOG(1) << "AutotestPrivateSetMouseSensitivityFunction " << params->value; |
303 | 303 |
304 #if defined(OS_CHROMEOS) | 304 #if defined(OS_CHROMEOS) |
305 chromeos::system::InputDeviceSettings::Get()->SetMouseSensitivity( | 305 chromeos::system::InputDeviceSettings::Get()->SetMouseSensitivity( |
306 params->value); | 306 params->value); |
307 #endif | 307 #endif |
308 return true; | 308 return true; |
309 } | 309 } |
310 | 310 |
311 bool AutotestPrivateSetPrimaryButtonRightFunction::RunSync() { | 311 bool AutotestPrivateSetPrimaryButtonRightFunction::RunSync() { |
312 scoped_ptr<api::autotest_private::SetPrimaryButtonRight::Params> params( | 312 std::unique_ptr<api::autotest_private::SetPrimaryButtonRight::Params> params( |
313 api::autotest_private::SetPrimaryButtonRight::Params::Create(*args_)); | 313 api::autotest_private::SetPrimaryButtonRight::Params::Create(*args_)); |
314 EXTENSION_FUNCTION_VALIDATE(params.get()); | 314 EXTENSION_FUNCTION_VALIDATE(params.get()); |
315 | 315 |
316 DVLOG(1) << "AutotestPrivateSetPrimaryButtonRightFunction " << params->right; | 316 DVLOG(1) << "AutotestPrivateSetPrimaryButtonRightFunction " << params->right; |
317 | 317 |
318 #if defined(OS_CHROMEOS) | 318 #if defined(OS_CHROMEOS) |
319 chromeos::system::InputDeviceSettings::Get()->SetPrimaryButtonRight( | 319 chromeos::system::InputDeviceSettings::Get()->SetPrimaryButtonRight( |
320 params->right); | 320 params->right); |
321 #endif | 321 #endif |
322 return true; | 322 return true; |
(...skipping 15 matching lines...) Expand all Loading... |
338 return new AutotestPrivateAPI(); | 338 return new AutotestPrivateAPI(); |
339 } | 339 } |
340 | 340 |
341 AutotestPrivateAPI::AutotestPrivateAPI() : test_mode_(false) { | 341 AutotestPrivateAPI::AutotestPrivateAPI() : test_mode_(false) { |
342 } | 342 } |
343 | 343 |
344 AutotestPrivateAPI::~AutotestPrivateAPI() { | 344 AutotestPrivateAPI::~AutotestPrivateAPI() { |
345 } | 345 } |
346 | 346 |
347 } // namespace extensions | 347 } // namespace extensions |
OLD | NEW |