| 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 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 735 result.Set(v8::String::NewFromUtf8(isolate, attr_value.c_str())); | 735 result.Set(v8::String::NewFromUtf8(isolate, attr_value.c_str())); |
| 736 }); | 736 }); |
| 737 RouteNodeIDFunction( | 737 RouteNodeIDFunction( |
| 738 "GetNameFrom", [](v8::Isolate* isolate, v8::ReturnValue<v8::Value> result, | 738 "GetNameFrom", [](v8::Isolate* isolate, v8::ReturnValue<v8::Value> result, |
| 739 TreeCache* cache, ui::AXNode* node) { | 739 TreeCache* cache, ui::AXNode* node) { |
| 740 ui::AXNameFrom name_from = static_cast<ui::AXNameFrom>( | 740 ui::AXNameFrom name_from = static_cast<ui::AXNameFrom>( |
| 741 node->data().GetIntAttribute(ui::AX_ATTR_NAME_FROM)); | 741 node->data().GetIntAttribute(ui::AX_ATTR_NAME_FROM)); |
| 742 std::string name_from_str = ui::ToString(name_from); | 742 std::string name_from_str = ui::ToString(name_from); |
| 743 result.Set(v8::String::NewFromUtf8(isolate, name_from_str.c_str())); | 743 result.Set(v8::String::NewFromUtf8(isolate, name_from_str.c_str())); |
| 744 }); | 744 }); |
| 745 RouteNodeIDFunction("GetChecked", [](v8::Isolate* isolate, | 745 RouteNodeIDFunction( |
| 746 v8::ReturnValue<v8::Value> result, | 746 "GetChecked", [](v8::Isolate* isolate, v8::ReturnValue<v8::Value> result, |
| 747 TreeCache* cache, ui::AXNode* node) { | 747 TreeCache* cache, ui::AXNode* node) { |
| 748 const ui::AXCheckedState checked_state = static_cast<ui::AXCheckedState>( | 748 const ui::AXButtonState checked_state = static_cast<ui::AXButtonState>( |
| 749 node->data().GetIntAttribute(ui::AX_ATTR_CHECKED_STATE)); | 749 node->data().GetIntAttribute(ui::AX_ATTR_CHECKED_STATE)); |
| 750 if (checked_state) { | 750 if (checked_state) { |
| 751 const std::string checked_str = ui::ToString(checked_state); | 751 const std::string checked_str = ui::ToString(checked_state); |
| 752 result.Set(v8::String::NewFromUtf8(isolate, checked_str.c_str())); | 752 result.Set(v8::String::NewFromUtf8(isolate, checked_str.c_str())); |
| 753 } | 753 } |
| 754 }); | 754 }); |
| 755 RouteNodeIDFunction( |
| 756 "GePressed", [](v8::Isolate* isolate, v8::ReturnValue<v8::Value> result, |
| 757 TreeCache* cache, ui::AXNode* node) { |
| 758 const ui::AXButtonState pressed_state = static_cast<ui::AXButtonState>( |
| 759 node->data().GetIntAttribute(ui::AX_ATTR_PRESSED_STATE)); |
| 760 if (pressed_state) { |
| 761 const std::string pressed_str = ui::ToString(pressed_state); |
| 762 result.Set(v8::String::NewFromUtf8(isolate, pressed_str.c_str())); |
| 763 } |
| 764 }); |
| 755 } | 765 } |
| 756 | 766 |
| 757 AutomationInternalCustomBindings::~AutomationInternalCustomBindings() {} | 767 AutomationInternalCustomBindings::~AutomationInternalCustomBindings() {} |
| 758 | 768 |
| 759 void AutomationInternalCustomBindings::Invalidate() { | 769 void AutomationInternalCustomBindings::Invalidate() { |
| 760 ObjectBackedNativeHandler::Invalidate(); | 770 ObjectBackedNativeHandler::Invalidate(); |
| 761 | 771 |
| 762 if (message_filter_) | 772 if (message_filter_) |
| 763 message_filter_->Detach(); | 773 message_filter_->Detach(); |
| 764 | 774 |
| (...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1436 for (auto id : ids) | 1446 for (auto id : ids) |
| 1437 nodes->AppendInteger(id); | 1447 nodes->AppendInteger(id); |
| 1438 args.Append(std::move(nodes)); | 1448 args.Append(std::move(nodes)); |
| 1439 } | 1449 } |
| 1440 | 1450 |
| 1441 bindings_system_->DispatchEventInContext("automationInternal.onNodesRemoved", | 1451 bindings_system_->DispatchEventInContext("automationInternal.onNodesRemoved", |
| 1442 &args, nullptr, context()); | 1452 &args, nullptr, context()); |
| 1443 } | 1453 } |
| 1444 | 1454 |
| 1445 } // namespace extensions | 1455 } // namespace extensions |
| OLD | NEW |