| 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 // 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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 // currently have cached, explicitly request that AX tree from the | 203 // currently have cached, explicitly request that AX tree from the |
| 204 // browser process and set up a callback when it loads to attach that | 204 // browser process and set up a callback when it loads to attach that |
| 205 // tree as a child of this node and fire appropriate events. | 205 // tree as a child of this node and fire appropriate events. |
| 206 var childTreeID = GetIntAttribute(treeID, nodeID, 'childTreeId'); | 206 var childTreeID = GetIntAttribute(treeID, nodeID, 'childTreeId'); |
| 207 if (!childTreeID) | 207 if (!childTreeID) |
| 208 return; | 208 return; |
| 209 | 209 |
| 210 var subroot = AutomationRootNode.get(childTreeID); | 210 var subroot = AutomationRootNode.get(childTreeID); |
| 211 if (!subroot) { | 211 if (!subroot) { |
| 212 automationUtil.storeTreeCallback(childTreeID, function(root) { | 212 automationUtil.storeTreeCallback(childTreeID, function(root) { |
| 213 // Return early if the root has already been attached. |
| 214 if (root.parent) |
| 215 return; |
| 216 |
| 213 privates(root).impl.setHostNode(node); | 217 privates(root).impl.setHostNode(node); |
| 214 | 218 |
| 215 if (root.docLoaded) | 219 if (root.docLoaded) |
| 216 privates(root).impl.dispatchEvent(schema.EventType.loadComplete); | 220 privates(root).impl.dispatchEvent(schema.EventType.loadComplete); |
| 217 | 221 |
| 218 privates(node).impl.dispatchEvent(schema.EventType.childrenChanged); | 222 privates(node).impl.dispatchEvent(schema.EventType.childrenChanged); |
| 219 }); | 223 }); |
| 220 | 224 |
| 221 automationInternal.enableFrame(childTreeID); | 225 automationInternal.enableFrame(childTreeID); |
| 222 } else { | 226 } else { |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 | 330 |
| 327 var binding = automation.generate(); | 331 var binding = automation.generate(); |
| 328 // Add additional accessibility bindings not specified in the automation IDL. | 332 // Add additional accessibility bindings not specified in the automation IDL. |
| 329 // Accessibility and automation share some APIs (see | 333 // Accessibility and automation share some APIs (see |
| 330 // ui/accessibility/ax_enums.idl). | 334 // ui/accessibility/ax_enums.idl). |
| 331 forEach(schema, function(k, v) { | 335 forEach(schema, function(k, v) { |
| 332 binding[k] = v; | 336 binding[k] = v; |
| 333 }); | 337 }); |
| 334 | 338 |
| 335 exports.$set('binding', binding); | 339 exports.$set('binding', binding); |
| 336 | |
| OLD | NEW |