| 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 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 RouteTreeIDFunction("GetFocusAffinity", [](v8::Isolate* isolate, | 503 RouteTreeIDFunction("GetFocusAffinity", [](v8::Isolate* isolate, |
| 504 v8::ReturnValue<v8::Value> result, | 504 v8::ReturnValue<v8::Value> result, |
| 505 TreeCache* cache) { | 505 TreeCache* cache) { |
| 506 result.Set(CreateV8String(isolate, | 506 result.Set(CreateV8String(isolate, |
| 507 ToString(cache->tree.data().sel_focus_affinity))); | 507 ToString(cache->tree.data().sel_focus_affinity))); |
| 508 }); | 508 }); |
| 509 | 509 |
| 510 // Bindings that take a Tree ID and Node ID and return a property of the node. | 510 // Bindings that take a Tree ID and Node ID and return a property of the node. |
| 511 | 511 |
| 512 RouteNodeIDFunction( | 512 RouteNodeIDFunction( |
| 513 "GetParentID", [](v8::Isolate* isolate, v8::ReturnValue<v8::Value> result, | 513 "GetParent", [](v8::Isolate* isolate, v8::ReturnValue<v8::Value> result, |
| 514 TreeCache* cache, ui::AXNode* node) { | 514 TreeCache* cache, ui::AXNode* node) { |
| 515 if (node->parent()) | 515 ui::AXNode* parent = cache->owner->GetParent(node, &cache); |
| 516 result.Set(v8::Integer::New(isolate, node->parent()->id())); | 516 int parent_node_id = parent->id(); |
| 517 int parent_tree_id = cache->tree_id; |
| 518 v8::Local<v8::Array> array_result(v8::Array::New(isolate, 2)); |
| 519 array_result->Set(0, v8::Integer::New(isolate, parent_tree_id)); |
| 520 array_result->Set(1, v8::Integer::New(isolate, parent_node_id)); |
| 521 result.Set(array_result); |
| 517 }); | 522 }); |
| 518 RouteNodeIDFunction("GetChildCount", [](v8::Isolate* isolate, | 523 RouteNodeIDFunction("GetChildCount", [](v8::Isolate* isolate, |
| 519 v8::ReturnValue<v8::Value> result, | 524 v8::ReturnValue<v8::Value> result, |
| 520 TreeCache* cache, ui::AXNode* node) { | 525 TreeCache* cache, ui::AXNode* node) { |
| 521 result.Set(v8::Integer::New(isolate, node->child_count())); | 526 result.Set(v8::Integer::New(isolate, node->child_count())); |
| 522 }); | 527 }); |
| 523 RouteNodeIDFunction( | 528 RouteNodeIDFunction( |
| 524 "GetIndexInParent", | 529 "GetIndexInParent", |
| 525 [](v8::Isolate* isolate, v8::ReturnValue<v8::Value> result, | 530 [](v8::Isolate* isolate, v8::ReturnValue<v8::Value> result, |
| 526 TreeCache* cache, ui::AXNode* node) { | 531 TreeCache* cache, ui::AXNode* node) { |
| (...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1393 v8::Local<v8::Array> args(v8::Array::New(GetIsolate(), 2U)); | 1398 v8::Local<v8::Array> args(v8::Array::New(GetIsolate(), 2U)); |
| 1394 args->Set(0U, v8::Integer::New(GetIsolate(), tree_id)); | 1399 args->Set(0U, v8::Integer::New(GetIsolate(), tree_id)); |
| 1395 v8::Local<v8::Array> nodes(v8::Array::New(GetIsolate(), ids.size())); | 1400 v8::Local<v8::Array> nodes(v8::Array::New(GetIsolate(), ids.size())); |
| 1396 args->Set(1U, nodes); | 1401 args->Set(1U, nodes); |
| 1397 for (size_t i = 0; i < ids.size(); ++i) | 1402 for (size_t i = 0; i < ids.size(); ++i) |
| 1398 nodes->Set(i, v8::Integer::New(GetIsolate(), ids[i])); | 1403 nodes->Set(i, v8::Integer::New(GetIsolate(), ids[i])); |
| 1399 context()->DispatchEvent("automationInternal.onNodesRemoved", args); | 1404 context()->DispatchEvent("automationInternal.onNodesRemoved", args); |
| 1400 } | 1405 } |
| 1401 | 1406 |
| 1402 } // namespace extensions | 1407 } // namespace extensions |
| OLD | NEW |