| 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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 privates(root).impl.setHostNode(node); | 213 privates(root).impl.setHostNode(node); |
| 214 | 214 privates(node).impl.childTree = root; |
| 215 if (root.docLoaded) | 215 if (root.docLoaded) |
| 216 privates(root).impl.dispatchEvent(schema.EventType.loadComplete); | 216 privates(root).impl.dispatchEvent(schema.EventType.loadComplete); |
| 217 | 217 |
| 218 privates(node).impl.dispatchEvent(schema.EventType.childrenChanged); | 218 privates(node).impl.dispatchEvent(schema.EventType.childrenChanged); |
| 219 }); | 219 }); |
| 220 | 220 |
| 221 automationInternal.enableFrame(childTreeID); | 221 automationInternal.enableFrame(childTreeID); |
| 222 } else { | 222 } else { |
| 223 privates(subroot).impl.setHostNode(node); | 223 privates(subroot).impl.setHostNode(node); |
| 224 privates(node).impl.childTree = subroot; |
| 224 } | 225 } |
| 225 }); | 226 }); |
| 226 | 227 |
| 227 automationInternal.onTreeChange.addListener(function(observerID, | 228 automationInternal.onTreeChange.addListener(function(observerID, |
| 228 treeID, | 229 treeID, |
| 229 nodeID, | 230 nodeID, |
| 230 changeType) { | 231 changeType) { |
| 231 var tree = AutomationRootNode.getOrCreate(treeID); | 232 var tree = AutomationRootNode.getOrCreate(treeID); |
| 232 if (!tree) | 233 if (!tree) |
| 233 return; | 234 return; |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 }); | 326 }); |
| 326 | 327 |
| 327 exports.binding = automation.generate(); | 328 exports.binding = automation.generate(); |
| 328 | 329 |
| 329 // Add additional accessibility bindings not specified in the automation IDL. | 330 // Add additional accessibility bindings not specified in the automation IDL. |
| 330 // Accessibility and automation share some APIs (see | 331 // Accessibility and automation share some APIs (see |
| 331 // ui/accessibility/ax_enums.idl). | 332 // ui/accessibility/ax_enums.idl). |
| 332 forEach(schema, function(k, v) { | 333 forEach(schema, function(k, v) { |
| 333 exports.binding[k] = v; | 334 exports.binding[k] = v; |
| 334 }); | 335 }); |
| OLD | NEW |