| 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 // A WebView in the desktop tree has a different AX tree as its child. | 205 // A WebView in the desktop tree has a different AX tree as its child. |
| 206 // When we encounter a WebView with a child AX tree id that we don't | 206 // When we encounter a WebView with a child AX tree id that we don't |
| 207 // currently have cached, explicitly request that AX tree from the | 207 // currently have cached, explicitly request that AX tree from the |
| 208 // browser process and set up a callback when it loads to attach that | 208 // browser process and set up a callback when it loads to attach that |
| 209 // tree as a child of this node and fire appropriate events. | 209 // tree as a child of this node and fire appropriate events. |
| 210 var childTreeID = GetIntAttribute(treeID, nodeID, 'childTreeId'); | 210 var childTreeID = GetIntAttribute(treeID, nodeID, 'childTreeId'); |
| 211 if (!childTreeID) | 211 if (!childTreeID) |
| 212 return; | 212 return; |
| 213 | 213 |
| 214 var subroot = AutomationRootNode.get(childTreeID); | 214 var subroot = AutomationRootNode.get(childTreeID); |
| 215 if (!subroot) { | 215 if (!subroot || subroot.role == schema.EventType.unknown) { |
| 216 automationUtil.storeTreeCallback(childTreeID, function(root) { | 216 automationUtil.storeTreeCallback(childTreeID, function(root) { |
| 217 // Return early if the root has already been attached. | 217 // Return early if the root has already been attached. |
| 218 if (root.parent) | 218 if (root.parent) |
| 219 return; | 219 return; |
| 220 | 220 |
| 221 privates(root).impl.setHostNode(node); | 221 privates(root).impl.setHostNode(node); |
| 222 | 222 |
| 223 if (root.docLoaded) { | 223 if (root.docLoaded) { |
| 224 privates(root).impl.dispatchEvent( | 224 privates(root).impl.dispatchEvent( |
| 225 schema.EventType.loadComplete, 'page'); | 225 schema.EventType.loadComplete, 'page'); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 | 337 |
| 338 var binding = automation.generate(); | 338 var binding = automation.generate(); |
| 339 // Add additional accessibility bindings not specified in the automation IDL. | 339 // Add additional accessibility bindings not specified in the automation IDL. |
| 340 // Accessibility and automation share some APIs (see | 340 // Accessibility and automation share some APIs (see |
| 341 // ui/accessibility/ax_enums.idl). | 341 // ui/accessibility/ax_enums.idl). |
| 342 forEach(schema, function(k, v) { | 342 forEach(schema, function(k, v) { |
| 343 binding[k] = v; | 343 binding[k] = v; |
| 344 }); | 344 }); |
| 345 | 345 |
| 346 exports.$set('binding', binding); | 346 exports.$set('binding', binding); |
| OLD | NEW |