Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/automation_internal/automation_internal_ api.h" | 5 #include "chrome/browser/extensions/api/automation_internal/automation_internal_ api.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 342 case api::automation_internal::ACTION_TYPE_GETIMAGEDATA: { | 342 case api::automation_internal::ACTION_TYPE_GETIMAGEDATA: { |
| 343 api::automation_internal::GetImageDataParams get_image_data_params; | 343 api::automation_internal::GetImageDataParams get_image_data_params; |
| 344 EXTENSION_FUNCTION_VALIDATE( | 344 EXTENSION_FUNCTION_VALIDATE( |
| 345 api::automation_internal::GetImageDataParams::Populate( | 345 api::automation_internal::GetImageDataParams::Populate( |
| 346 params->opt_args.additional_properties, &get_image_data_params)); | 346 params->opt_args.additional_properties, &get_image_data_params)); |
| 347 action->action = ui::AX_ACTION_GET_IMAGE_DATA; | 347 action->action = ui::AX_ACTION_GET_IMAGE_DATA; |
| 348 action->target_rect = gfx::Rect(0, 0, get_image_data_params.max_width, | 348 action->target_rect = gfx::Rect(0, 0, get_image_data_params.max_width, |
| 349 get_image_data_params.max_height); | 349 get_image_data_params.max_height); |
| 350 break; | 350 break; |
| 351 } | 351 } |
| 352 case api::automation_internal::ACTION_TYPE_HITTEST: { | |
| 353 api::automation_internal::HitTestParams hit_test_params; | |
| 354 EXTENSION_FUNCTION_VALIDATE( | |
| 355 api::automation_internal::HitTestParams::Populate( | |
| 356 params->opt_args.additional_properties, &hit_test_params)); | |
| 357 action->action = ui::AX_ACTION_HIT_TEST; | |
| 358 action->target_point = gfx::Point(hit_test_params.x, hit_test_params.y); | |
| 359 for (int event_index = ui::AX_EVENT_NONE + 1; | |
| 360 event_index <= ui::AX_EVENT_LAST; ++event_index) { | |
| 361 ui::AXEvent event = static_cast<ui::AXEvent>(event_index); | |
| 362 if (ui::ToString(event) == hit_test_params.event_to_fire) | |
|
David Tseng
2017/03/22 15:40:28
Pretty sure you can do ParseEvent here.
dmazzoni
2017/03/23 16:29:30
Done.
| |
| 363 action->hit_test_event_to_fire = event; | |
| 364 } | |
| 365 if (action->hit_test_event_to_fire == ui::AX_EVENT_NONE) | |
| 366 return RespondNow(NoArguments()); | |
| 367 break; | |
| 368 } | |
| 352 case api::automation_internal::ACTION_TYPE_MAKEVISIBLE: | 369 case api::automation_internal::ACTION_TYPE_MAKEVISIBLE: |
| 353 action->action = ui::AX_ACTION_SCROLL_TO_MAKE_VISIBLE; | 370 action->action = ui::AX_ACTION_SCROLL_TO_MAKE_VISIBLE; |
| 354 break; | 371 break; |
| 355 case api::automation_internal::ACTION_TYPE_SETSELECTION: { | 372 case api::automation_internal::ACTION_TYPE_SETSELECTION: { |
| 356 api::automation_internal::SetSelectionParams selection_params; | 373 api::automation_internal::SetSelectionParams selection_params; |
| 357 EXTENSION_FUNCTION_VALIDATE( | 374 EXTENSION_FUNCTION_VALIDATE( |
| 358 api::automation_internal::SetSelectionParams::Populate( | 375 api::automation_internal::SetSelectionParams::Populate( |
| 359 params->opt_args.additional_properties, &selection_params)); | 376 params->opt_args.additional_properties, &selection_params)); |
| 360 action->anchor_node_id = params->args.automation_node_id; | 377 action->anchor_node_id = params->args.automation_node_id; |
| 361 action->anchor_offset = selection_params.anchor_offset; | 378 action->anchor_offset = selection_params.anchor_offset; |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 509 int result_acc_obj_id) { | 526 int result_acc_obj_id) { |
| 510 if (!error.empty()) { | 527 if (!error.empty()) { |
| 511 Respond(Error(error)); | 528 Respond(Error(error)); |
| 512 return; | 529 return; |
| 513 } | 530 } |
| 514 | 531 |
| 515 Respond(OneArgument(base::MakeUnique<base::Value>(result_acc_obj_id))); | 532 Respond(OneArgument(base::MakeUnique<base::Value>(result_acc_obj_id))); |
| 516 } | 533 } |
| 517 | 534 |
| 518 } // namespace extensions | 535 } // namespace extensions |
| OLD | NEW |