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/renderer/extensions/automation_internal_custom_bindings.h" | 5 #include "chrome/renderer/extensions/automation_internal_custom_bindings.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
716 result.Set(v8::String::NewFromUtf8(isolate, attr_value.c_str())); | 716 result.Set(v8::String::NewFromUtf8(isolate, attr_value.c_str())); |
717 }); | 717 }); |
718 RouteNodeIDFunction( | 718 RouteNodeIDFunction( |
719 "GetNameFrom", [](v8::Isolate* isolate, v8::ReturnValue<v8::Value> result, | 719 "GetNameFrom", [](v8::Isolate* isolate, v8::ReturnValue<v8::Value> result, |
720 TreeCache* cache, ui::AXNode* node) { | 720 TreeCache* cache, ui::AXNode* node) { |
721 ui::AXNameFrom name_from = static_cast<ui::AXNameFrom>( | 721 ui::AXNameFrom name_from = static_cast<ui::AXNameFrom>( |
722 node->data().GetIntAttribute(ui::AX_ATTR_NAME_FROM)); | 722 node->data().GetIntAttribute(ui::AX_ATTR_NAME_FROM)); |
723 std::string name_from_str = ui::ToString(name_from); | 723 std::string name_from_str = ui::ToString(name_from); |
724 result.Set(v8::String::NewFromUtf8(isolate, name_from_str.c_str())); | 724 result.Set(v8::String::NewFromUtf8(isolate, name_from_str.c_str())); |
725 }); | 725 }); |
| 726 RouteNodeIDFunction("GetChecked", [](v8::Isolate* isolate, |
| 727 v8::ReturnValue<v8::Value> result, |
| 728 TreeCache* cache, ui::AXNode* node) { |
| 729 const ui::AXCheckedState checked_state = static_cast<ui::AXCheckedState>( |
| 730 node->data().GetIntAttribute(ui::AX_ATTR_CHECKED_STATE)); |
| 731 if (checked_state) { |
| 732 const std::string checked_str = ui::ToString(checked_state); |
| 733 result.Set(v8::String::NewFromUtf8(isolate, checked_str.c_str())); |
| 734 } |
| 735 }); |
726 } | 736 } |
727 | 737 |
728 AutomationInternalCustomBindings::~AutomationInternalCustomBindings() {} | 738 AutomationInternalCustomBindings::~AutomationInternalCustomBindings() {} |
729 | 739 |
730 void AutomationInternalCustomBindings::Invalidate() { | 740 void AutomationInternalCustomBindings::Invalidate() { |
731 ObjectBackedNativeHandler::Invalidate(); | 741 ObjectBackedNativeHandler::Invalidate(); |
732 | 742 |
733 if (message_filter_) | 743 if (message_filter_) |
734 message_filter_->Detach(); | 744 message_filter_->Detach(); |
735 | 745 |
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1403 for (auto id : ids) | 1413 for (auto id : ids) |
1404 nodes->AppendInteger(id); | 1414 nodes->AppendInteger(id); |
1405 args.Append(std::move(nodes)); | 1415 args.Append(std::move(nodes)); |
1406 } | 1416 } |
1407 | 1417 |
1408 bindings_system_->DispatchEventInContext("automationInternal.onNodesRemoved", | 1418 bindings_system_->DispatchEventInContext("automationInternal.onNodesRemoved", |
1409 &args, nullptr, context()); | 1419 &args, nullptr, context()); |
1410 } | 1420 } |
1411 | 1421 |
1412 } // namespace extensions | 1422 } // namespace extensions |
OLD | NEW |