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 var AutomationEvent = require('automationEvent').AutomationEvent; | 5 var AutomationEvent = require('automationEvent').AutomationEvent; |
6 var automationInternal = | 6 var automationInternal = |
7 require('binding').Binding.create('automationInternal').generate(); | 7 require('binding').Binding.create('automationInternal').generate(); |
8 var exceptionHandler = require('uncaught_exception_handler'); | 8 var exceptionHandler = require('uncaught_exception_handler'); |
9 var IsInteractPermitted = | 9 var IsInteractPermitted = |
10 requireNative('automationInternal').IsInteractPermitted; | 10 requireNative('automationInternal').IsInteractPermitted; |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 */ | 231 */ |
232 var GetHtmlAttribute = requireNative('automationInternal').GetHtmlAttribute; | 232 var GetHtmlAttribute = requireNative('automationInternal').GetHtmlAttribute; |
233 | 233 |
234 /** | 234 /** |
235 * @param {number} axTreeID The id of the accessibility tree. | 235 * @param {number} axTreeID The id of the accessibility tree. |
236 * @param {number} nodeID The id of a node. | 236 * @param {number} nodeID The id of a node. |
237 * @return {automation.NameFromType} The source of the node's name. | 237 * @return {automation.NameFromType} The source of the node's name. |
238 */ | 238 */ |
239 var GetNameFrom = requireNative('automationInternal').GetNameFrom; | 239 var GetNameFrom = requireNative('automationInternal').GetNameFrom; |
240 | 240 |
| 241 var GetCustomActions = requireNative('automationInternal').GetCustomActions; |
| 242 |
241 var lastError = require('lastError'); | 243 var lastError = require('lastError'); |
242 var logging = requireNative('logging'); | 244 var logging = requireNative('logging'); |
243 var utils = require('utils'); | 245 var utils = require('utils'); |
244 | 246 |
245 /** | 247 /** |
246 * A single node in the Automation tree. | 248 * A single node in the Automation tree. |
247 * @param {AutomationRootNodeImpl} root The root of the tree. | 249 * @param {AutomationRootNodeImpl} root The root of the tree. |
248 * @constructor | 250 * @constructor |
249 */ | 251 */ |
250 function AutomationNodeImpl(root) { | 252 function AutomationNodeImpl(root) { |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 parent = privates(parent).impl; | 375 parent = privates(parent).impl; |
374 var indexInParent = GetIndexInParent(this.treeID, this.id); | 376 var indexInParent = GetIndexInParent(this.treeID, this.id); |
375 return this.rootImpl.get( | 377 return this.rootImpl.get( |
376 GetChildIDAtIndex(parent.treeID, parent.id, indexInParent + 1)); | 378 GetChildIDAtIndex(parent.treeID, parent.id, indexInParent + 1)); |
377 }, | 379 }, |
378 | 380 |
379 get nameFrom() { | 381 get nameFrom() { |
380 return GetNameFrom(this.treeID, this.id); | 382 return GetNameFrom(this.treeID, this.id); |
381 }, | 383 }, |
382 | 384 |
| 385 get customActions() { |
| 386 return GetCustomActions(this.treeID, this.id); |
| 387 }, |
| 388 |
383 doDefault: function() { | 389 doDefault: function() { |
384 this.performAction_('doDefault'); | 390 this.performAction_('doDefault'); |
385 }, | 391 }, |
386 | 392 |
387 focus: function() { | 393 focus: function() { |
388 this.performAction_('focus'); | 394 this.performAction_('focus'); |
389 }, | 395 }, |
390 | 396 |
391 getImageData: function(maxWidth, maxHeight) { | 397 getImageData: function(maxWidth, maxHeight) { |
392 this.performAction_('getImageData', | 398 this.performAction_('getImageData', |
393 { maxWidth: maxWidth, | 399 { maxWidth: maxWidth, |
394 maxHeight: maxHeight }); | 400 maxHeight: maxHeight }); |
395 }, | 401 }, |
396 | 402 |
397 hitTest: function(x, y, eventToFire) { | 403 hitTest: function(x, y, eventToFire) { |
398 // Convert from global to tree-relative coordinates. | 404 // Convert from global to tree-relative coordinates. |
399 var location = GetLocation(this.treeID, GetRootID(this.treeID)); | 405 var location = GetLocation(this.treeID, GetRootID(this.treeID)); |
400 this.performAction_('hitTest', | 406 this.performAction_('hitTest', |
401 { x: Math.floor(x - location.left), | 407 { x: Math.floor(x - location.left), |
402 y: Math.floor(y - location.top), | 408 y: Math.floor(y - location.top), |
403 eventToFire: eventToFire }); | 409 eventToFire: eventToFire }); |
404 }, | 410 }, |
405 | 411 |
406 makeVisible: function() { | 412 makeVisible: function() { |
407 this.performAction_('makeVisible'); | 413 this.performAction_('makeVisible'); |
408 }, | 414 }, |
409 | 415 |
| 416 performCustomAction: function(customActionId) { |
| 417 this.performAction_('customAction', { customActionID: customActionId }); |
| 418 }, |
| 419 |
410 resumeMedia: function() { | 420 resumeMedia: function() { |
411 this.performAction_('resumeMedia'); | 421 this.performAction_('resumeMedia'); |
412 }, | 422 }, |
413 | 423 |
414 setSelection: function(startIndex, endIndex) { | 424 setSelection: function(startIndex, endIndex) { |
415 if (this.role == 'textField' || this.role == 'textBox') { | 425 if (this.role == 'textField' || this.role == 'textBox') { |
416 this.performAction_('setSelection', | 426 this.performAction_('setSelection', |
417 { focusNodeID: this.id, | 427 { focusNodeID: this.id, |
418 anchorOffset: startIndex, | 428 anchorOffset: startIndex, |
419 focusOffset: endIndex }); | 429 focusOffset: endIndex }); |
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1100 utils.expose(AutomationNode, AutomationNodeImpl, { | 1110 utils.expose(AutomationNode, AutomationNodeImpl, { |
1101 functions: [ | 1111 functions: [ |
1102 'doDefault', | 1112 'doDefault', |
1103 'find', | 1113 'find', |
1104 'findAll', | 1114 'findAll', |
1105 'focus', | 1115 'focus', |
1106 'getImageData', | 1116 'getImageData', |
1107 'hitTest', | 1117 'hitTest', |
1108 'makeVisible', | 1118 'makeVisible', |
1109 'matches', | 1119 'matches', |
| 1120 'performCustomAction', |
1110 'resumeMedia', | 1121 'resumeMedia', |
1111 'setSelection', | 1122 'setSelection', |
1112 'setSequentialFocusNavigationStartingPoint', | 1123 'setSequentialFocusNavigationStartingPoint', |
1113 'showContextMenu', | 1124 'showContextMenu', |
1114 'startDuckingMedia', | 1125 'startDuckingMedia', |
1115 'stopDuckingMedia', | 1126 'stopDuckingMedia', |
1116 'suspendMedia', | 1127 'suspendMedia', |
1117 'addEventListener', | 1128 'addEventListener', |
1118 'removeEventListener', | 1129 'removeEventListener', |
1119 'domQuerySelector', | 1130 'domQuerySelector', |
(...skipping 10 matching lines...) Expand all Loading... |
1130 'isRootNode', | 1141 'isRootNode', |
1131 'role', | 1142 'role', |
1132 'checked', | 1143 'checked', |
1133 'state', | 1144 'state', |
1134 'location', | 1145 'location', |
1135 'indexInParent', | 1146 'indexInParent', |
1136 'lineStartOffsets', | 1147 'lineStartOffsets', |
1137 'root', | 1148 'root', |
1138 'htmlAttributes', | 1149 'htmlAttributes', |
1139 'nameFrom', | 1150 'nameFrom', |
| 1151 'customActions', |
1140 ]), | 1152 ]), |
1141 }); | 1153 }); |
1142 | 1154 |
1143 function AutomationRootNode() { | 1155 function AutomationRootNode() { |
1144 privates(AutomationRootNode).constructPrivate(this, arguments); | 1156 privates(AutomationRootNode).constructPrivate(this, arguments); |
1145 } | 1157 } |
1146 utils.expose(AutomationRootNode, AutomationRootNodeImpl, { | 1158 utils.expose(AutomationRootNode, AutomationRootNodeImpl, { |
1147 superclass: AutomationNode, | 1159 superclass: AutomationNode, |
1148 readonly: [ | 1160 readonly: [ |
1149 'chromeChannel', | 1161 'chromeChannel', |
(...skipping 17 matching lines...) Expand all Loading... |
1167 utils.defineProperty(AutomationRootNode, 'getOrCreate', function(treeID) { | 1179 utils.defineProperty(AutomationRootNode, 'getOrCreate', function(treeID) { |
1168 return AutomationRootNodeImpl.getOrCreate(treeID); | 1180 return AutomationRootNodeImpl.getOrCreate(treeID); |
1169 }); | 1181 }); |
1170 | 1182 |
1171 utils.defineProperty(AutomationRootNode, 'destroy', function(treeID) { | 1183 utils.defineProperty(AutomationRootNode, 'destroy', function(treeID) { |
1172 AutomationRootNodeImpl.destroy(treeID); | 1184 AutomationRootNodeImpl.destroy(treeID); |
1173 }); | 1185 }); |
1174 | 1186 |
1175 exports.$set('AutomationNode', AutomationNode); | 1187 exports.$set('AutomationNode', AutomationNode); |
1176 exports.$set('AutomationRootNode', AutomationRootNode); | 1188 exports.$set('AutomationRootNode', AutomationRootNode); |
OLD | NEW |