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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 Loading... |
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); |
OLD | NEW |