Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5666)

Unified Diff: chrome/renderer/extensions/automation_internal_custom_bindings.cc

Issue 2770713008: Automation API: Get rid of host node and get parent from C++ bindings instead
Patch Set: Rebase Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/renderer/resources/extensions/automation/automation_node.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/extensions/automation_internal_custom_bindings.cc
diff --git a/chrome/renderer/extensions/automation_internal_custom_bindings.cc b/chrome/renderer/extensions/automation_internal_custom_bindings.cc
index 9cba94914646b0fde747577e1842af2f740fa0d6..f7d955dd835543bb2b15e7692574b38f57c3ee2f 100644
--- a/chrome/renderer/extensions/automation_internal_custom_bindings.cc
+++ b/chrome/renderer/extensions/automation_internal_custom_bindings.cc
@@ -510,10 +510,15 @@ AutomationInternalCustomBindings::AutomationInternalCustomBindings(
// Bindings that take a Tree ID and Node ID and return a property of the node.
RouteNodeIDFunction(
- "GetParentID", [](v8::Isolate* isolate, v8::ReturnValue<v8::Value> result,
- TreeCache* cache, ui::AXNode* node) {
- if (node->parent())
- result.Set(v8::Integer::New(isolate, node->parent()->id()));
+ "GetParent", [](v8::Isolate* isolate, v8::ReturnValue<v8::Value> result,
+ TreeCache* cache, ui::AXNode* node) {
+ ui::AXNode* parent = cache->owner->GetParent(node, &cache);
+ int parent_node_id = parent->id();
+ int parent_tree_id = cache->tree_id;
+ v8::Local<v8::Array> array_result(v8::Array::New(isolate, 2));
+ array_result->Set(0, v8::Integer::New(isolate, parent_tree_id));
+ array_result->Set(1, v8::Integer::New(isolate, parent_node_id));
+ result.Set(array_result);
});
RouteNodeIDFunction("GetChildCount", [](v8::Isolate* isolate,
v8::ReturnValue<v8::Value> result,
« no previous file with comments | « no previous file | chrome/renderer/resources/extensions/automation/automation_node.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698