Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(118)

Side by Side Diff: chrome/renderer/resources/extensions/automation/automation_node.js

Issue 2873373005: Add custom action support (Closed)
Patch Set: Migrate to DataObjectBuilder. Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 */ 259 */
260 var GetUnderline = requireNative('automationInternal').GetUnderline; 260 var GetUnderline = requireNative('automationInternal').GetUnderline;
261 261
262 /** 262 /**
263 * @param {number} axTreeID The id of the accessibility tree. 263 * @param {number} axTreeID The id of the accessibility tree.
264 * @param {number} nodeID The id of a node. 264 * @param {number} nodeID The id of a node.
265 * @return {boolean} 265 * @return {boolean}
266 */ 266 */
267 var GetLineThrough = requireNative('automationInternal').GetLineThrough; 267 var GetLineThrough = requireNative('automationInternal').GetLineThrough;
268 268
269 /**
270 * @param {number} axTreeID The id of the accessibility tree.
271 * @param {number} nodeID The id of a node.
272 * @return {?Array.<automation.CustomAction>} List of custom actions of the
273 * node.
274 */
275 var GetCustomActions = requireNative('automationInternal').GetCustomActions;
276
269 var lastError = require('lastError'); 277 var lastError = require('lastError');
270 var logging = requireNative('logging'); 278 var logging = requireNative('logging');
271 var utils = require('utils'); 279 var utils = require('utils');
272 280
273 /** 281 /**
274 * A single node in the Automation tree. 282 * A single node in the Automation tree.
275 * @param {AutomationRootNodeImpl} root The root of the tree. 283 * @param {AutomationRootNodeImpl} root The root of the tree.
276 * @constructor 284 * @constructor
277 */ 285 */
278 function AutomationNodeImpl(root) { 286 function AutomationNodeImpl(root) {
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 }, 425 },
418 426
419 get underline() { 427 get underline() {
420 return GetUnderline(this.treeID, this.id); 428 return GetUnderline(this.treeID, this.id);
421 }, 429 },
422 430
423 get lineThrough() { 431 get lineThrough() {
424 return GetLineThrough(this.treeID, this.id); 432 return GetLineThrough(this.treeID, this.id);
425 }, 433 },
426 434
435 get customActions() {
436 return GetCustomActions(this.treeID, this.id);
437 },
438
427 doDefault: function() { 439 doDefault: function() {
428 this.performAction_('doDefault'); 440 this.performAction_('doDefault');
429 }, 441 },
430 442
431 focus: function() { 443 focus: function() {
432 this.performAction_('focus'); 444 this.performAction_('focus');
433 }, 445 },
434 446
435 getImageData: function(maxWidth, maxHeight) { 447 getImageData: function(maxWidth, maxHeight) {
436 this.performAction_('getImageData', 448 this.performAction_('getImageData',
437 { maxWidth: maxWidth, 449 { maxWidth: maxWidth,
438 maxHeight: maxHeight }); 450 maxHeight: maxHeight });
439 }, 451 },
440 452
441 hitTest: function(x, y, eventToFire) { 453 hitTest: function(x, y, eventToFire) {
442 // Convert from global to tree-relative coordinates. 454 // Convert from global to tree-relative coordinates.
443 var location = GetLocation(this.treeID, GetRootID(this.treeID)); 455 var location = GetLocation(this.treeID, GetRootID(this.treeID));
444 this.performAction_('hitTest', 456 this.performAction_('hitTest',
445 { x: Math.floor(x - location.left), 457 { x: Math.floor(x - location.left),
446 y: Math.floor(y - location.top), 458 y: Math.floor(y - location.top),
447 eventToFire: eventToFire }); 459 eventToFire: eventToFire });
448 }, 460 },
449 461
450 makeVisible: function() { 462 makeVisible: function() {
451 this.performAction_('makeVisible'); 463 this.performAction_('makeVisible');
452 }, 464 },
453 465
466 performCustomAction: function(customActionId) {
467 this.performAction_('customAction', { customActionID: customActionId });
468 },
469
454 resumeMedia: function() { 470 resumeMedia: function() {
455 this.performAction_('resumeMedia'); 471 this.performAction_('resumeMedia');
456 }, 472 },
457 473
458 setSelection: function(startIndex, endIndex) { 474 setSelection: function(startIndex, endIndex) {
459 if (this.role == 'textField' || this.role == 'textBox') { 475 if (this.role == 'textField' || this.role == 'textBox') {
460 this.performAction_('setSelection', 476 this.performAction_('setSelection',
461 { focusNodeID: this.id, 477 { focusNodeID: this.id,
462 anchorOffset: startIndex, 478 anchorOffset: startIndex,
463 focusOffset: endIndex }); 479 focusOffset: endIndex });
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after
1144 utils.expose(AutomationNode, AutomationNodeImpl, { 1160 utils.expose(AutomationNode, AutomationNodeImpl, {
1145 functions: [ 1161 functions: [
1146 'doDefault', 1162 'doDefault',
1147 'find', 1163 'find',
1148 'findAll', 1164 'findAll',
1149 'focus', 1165 'focus',
1150 'getImageData', 1166 'getImageData',
1151 'hitTest', 1167 'hitTest',
1152 'makeVisible', 1168 'makeVisible',
1153 'matches', 1169 'matches',
1170 'performCustomAction',
1154 'resumeMedia', 1171 'resumeMedia',
1155 'setSelection', 1172 'setSelection',
1156 'setSequentialFocusNavigationStartingPoint', 1173 'setSequentialFocusNavigationStartingPoint',
1157 'showContextMenu', 1174 'showContextMenu',
1158 'startDuckingMedia', 1175 'startDuckingMedia',
1159 'stopDuckingMedia', 1176 'stopDuckingMedia',
1160 'suspendMedia', 1177 'suspendMedia',
1161 'addEventListener', 1178 'addEventListener',
1162 'removeEventListener', 1179 'removeEventListener',
1163 'domQuerySelector', 1180 'domQuerySelector',
(...skipping 14 matching lines...) Expand all
1178 'location', 1195 'location',
1179 'indexInParent', 1196 'indexInParent',
1180 'lineStartOffsets', 1197 'lineStartOffsets',
1181 'root', 1198 'root',
1182 'htmlAttributes', 1199 'htmlAttributes',
1183 'nameFrom', 1200 'nameFrom',
1184 'bold', 1201 'bold',
1185 'italic', 1202 'italic',
1186 'underline', 1203 'underline',
1187 'lineThrough', 1204 'lineThrough',
1205 'customActions',
1188 ]), 1206 ]),
1189 }); 1207 });
1190 1208
1191 function AutomationRootNode() { 1209 function AutomationRootNode() {
1192 privates(AutomationRootNode).constructPrivate(this, arguments); 1210 privates(AutomationRootNode).constructPrivate(this, arguments);
1193 } 1211 }
1194 utils.expose(AutomationRootNode, AutomationRootNodeImpl, { 1212 utils.expose(AutomationRootNode, AutomationRootNodeImpl, {
1195 superclass: AutomationNode, 1213 superclass: AutomationNode,
1196 readonly: [ 1214 readonly: [
1197 'chromeChannel', 1215 'chromeChannel',
(...skipping 17 matching lines...) Expand all
1215 utils.defineProperty(AutomationRootNode, 'getOrCreate', function(treeID) { 1233 utils.defineProperty(AutomationRootNode, 'getOrCreate', function(treeID) {
1216 return AutomationRootNodeImpl.getOrCreate(treeID); 1234 return AutomationRootNodeImpl.getOrCreate(treeID);
1217 }); 1235 });
1218 1236
1219 utils.defineProperty(AutomationRootNode, 'destroy', function(treeID) { 1237 utils.defineProperty(AutomationRootNode, 'destroy', function(treeID) {
1220 AutomationRootNodeImpl.destroy(treeID); 1238 AutomationRootNodeImpl.destroy(treeID);
1221 }); 1239 });
1222 1240
1223 exports.$set('AutomationNode', AutomationNode); 1241 exports.$set('AutomationNode', AutomationNode);
1224 exports.$set('AutomationRootNode', AutomationRootNode); 1242 exports.$set('AutomationRootNode', AutomationRootNode);
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/automation_internal_custom_bindings.cc ('k') | components/arc/common/accessibility_helper.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698