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

Side by Side Diff: chrome/renderer/resources/extensions/automation_custom_bindings.js

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 unified diff | Download patch
« no previous file with comments | « chrome/renderer/resources/extensions/automation/automation_node.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // Custom bindings for the automation API. 5 // Custom bindings for the automation API.
6 var AutomationNode = require('automationNode').AutomationNode; 6 var AutomationNode = require('automationNode').AutomationNode;
7 var AutomationRootNode = require('automationNode').AutomationRootNode; 7 var AutomationRootNode = require('automationNode').AutomationRootNode;
8 var automation = require('binding').Binding.create('automation'); 8 var automation = require('binding').Binding.create('automation');
9 var automationInternal = 9 var automationInternal =
10 require('binding').Binding.create('automationInternal').generate(); 10 require('binding').Binding.create('automationInternal').generate();
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 if (!childTreeID) 217 if (!childTreeID)
218 return; 218 return;
219 219
220 var subroot = AutomationRootNode.get(childTreeID); 220 var subroot = AutomationRootNode.get(childTreeID);
221 if (!subroot || subroot.role == 'unknown') { 221 if (!subroot || subroot.role == 'unknown') {
222 automationUtil.storeTreeCallback(childTreeID, function(root) { 222 automationUtil.storeTreeCallback(childTreeID, function(root) {
223 // Return early if the root has already been attached. 223 // Return early if the root has already been attached.
224 if (root.parent) 224 if (root.parent)
225 return; 225 return;
226 226
227 privates(root).impl.setHostNode(node);
228
229 if (root.docLoaded) { 227 if (root.docLoaded) {
230 privates(root).impl.dispatchEvent('loadComplete', 'page'); 228 privates(root).impl.dispatchEvent('loadComplete', 'page');
231 } 229 }
232 230
233 privates(node).impl.dispatchEvent('childrenChanged', 'none'); 231 privates(node).impl.dispatchEvent('childrenChanged', 'none');
234 }); 232 });
235 233
236 automationInternal.enableFrame(childTreeID); 234 automationInternal.enableFrame(childTreeID);
237 } else {
238 privates(subroot).impl.setHostNode(node);
239 } 235 }
240 }); 236 });
241 237
242 automationInternal.onTreeChange.addListener(function(observerID, 238 automationInternal.onTreeChange.addListener(function(observerID,
243 treeID, 239 treeID,
244 nodeID, 240 nodeID,
245 changeType) { 241 changeType) {
246 var tree = AutomationRootNode.getOrCreate(treeID); 242 var tree = AutomationRootNode.getOrCreate(treeID);
247 if (!tree) 243 if (!tree)
248 return; 244 return;
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 DestroyAccessibilityTree(id); 351 DestroyAccessibilityTree(id);
356 }); 352 });
357 353
358 automationInternal.onAccessibilityTreeSerializationError.addListener( 354 automationInternal.onAccessibilityTreeSerializationError.addListener(
359 function(id) { 355 function(id) {
360 automationInternal.enableFrame(id); 356 automationInternal.enableFrame(id);
361 }); 357 });
362 358
363 var binding = automation.generate(); 359 var binding = automation.generate();
364 exports.$set('binding', binding); 360 exports.$set('binding', binding);
OLDNEW
« no previous file with comments | « chrome/renderer/resources/extensions/automation/automation_node.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698