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