| 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 AutomationTree = require('automationTree').AutomationTree; | 7 var AutomationTree = require('automationTree').AutomationTree; |
| 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(); |
| 11 var eventBindings = require('event_bindings'); | 11 var eventBindings = require('event_bindings'); |
| 12 var Event = eventBindings.Event; | 12 var Event = eventBindings.Event; |
| 13 var lastError = require('lastError'); | 13 var lastError = require('lastError'); |
| 14 var schema = |
| 15 requireNative('automationInternal').GetSchemaAdditions(); |
| 14 | 16 |
| 15 // TODO(aboxhall): Look into using WeakMap | 17 // TODO(aboxhall): Look into using WeakMap |
| 16 var idToAutomationTree = {}; | 18 var idToAutomationTree = {}; |
| 17 var idToCallback = {}; | 19 var idToCallback = {}; |
| 18 | 20 |
| 19 // TODO(dtseng): Move out to automation/automation_util.js or as a static member | 21 // TODO(dtseng): Move out to automation/automation_util.js or as a static member |
| 20 // of AutomationTree to keep this file clean. | 22 // of AutomationTree to keep this file clean. |
| 21 /* | 23 /* |
| 22 * Creates an id associated with a particular AutomationTree based upon a | 24 * Creates an id associated with a particular AutomationTree based upon a |
| 23 * renderer/renderer host pair's process and routing id. | 25 * renderer/renderer host pair's process and routing id. |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 for (var i = 0; i < idToCallback[id].length; i++) { | 111 for (var i = 0; i < idToCallback[id].length; i++) { |
| 110 var callback = idToCallback[id][i]; | 112 var callback = idToCallback[id][i]; |
| 111 callback(targetTree); | 113 callback(targetTree); |
| 112 } | 114 } |
| 113 delete idToCallback[id]; | 115 delete idToCallback[id]; |
| 114 } | 116 } |
| 115 } | 117 } |
| 116 }); | 118 }); |
| 117 | 119 |
| 118 exports.binding = automation.generate(); | 120 exports.binding = automation.generate(); |
| 121 |
| 122 // Additional bindings adopted from Accessibility. |
| 123 exports.binding.EventType = schema.EventType; |
| 124 exports.binding.RoleType = schema.RoleType; |
| 125 exports.binding.StateType = schema.StateType; |
| OLD | NEW |