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

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

Issue 2650733002: Revert of Update json_schema_compiler to handle the Automation extension API (Closed)
Patch Set: Created 3 years, 11 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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 217
218 /** 218 /**
219 * @param {number} axTreeID The id of the accessibility tree. 219 * @param {number} axTreeID The id of the accessibility tree.
220 * @param {number} nodeID The id of a node. 220 * @param {number} nodeID The id of a node.
221 * @param {string} attr The name of an HTML attribute. 221 * @param {string} attr The name of an HTML attribute.
222 * @return {?string} The value of this attribute, or undefined if the tree, 222 * @return {?string} The value of this attribute, or undefined if the tree,
223 * node, or attribute wasn't found. 223 * node, or attribute wasn't found.
224 */ 224 */
225 var GetHtmlAttribute = requireNative('automationInternal').GetHtmlAttribute; 225 var GetHtmlAttribute = requireNative('automationInternal').GetHtmlAttribute;
226 226
227 /**
228 * @param {number} axTreeID The id of the accessibility tree.
229 * @param {number} nodeID The id of a node.
230 * @return {automation.NameFromType} The source of the node's name.
231 */
232 var GetNameFrom = requireNative('automationInternal').GetNameFrom;
233
234 var lastError = require('lastError'); 227 var lastError = require('lastError');
235 var logging = requireNative('logging'); 228 var logging = requireNative('logging');
229 var schema = requireNative('automationInternal').GetSchemaAdditions();
236 var utils = require('utils'); 230 var utils = require('utils');
237 231
238 /** 232 /**
239 * A single node in the Automation tree. 233 * A single node in the Automation tree.
240 * @param {AutomationRootNodeImpl} root The root of the tree. 234 * @param {AutomationRootNodeImpl} root The root of the tree.
241 * @constructor 235 * @constructor
242 */ 236 */
243 function AutomationNodeImpl(root) { 237 function AutomationNodeImpl(root) {
244 this.rootImpl = root; 238 this.rootImpl = root;
245 this.hostNode_ = null; 239 this.hostNode_ = null;
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 get nextSibling() { 352 get nextSibling() {
359 var parent = this.parent; 353 var parent = this.parent;
360 if (!parent) 354 if (!parent)
361 return undefined; 355 return undefined;
362 parent = privates(parent).impl; 356 parent = privates(parent).impl;
363 var indexInParent = GetIndexInParent(this.treeID, this.id); 357 var indexInParent = GetIndexInParent(this.treeID, this.id);
364 return this.rootImpl.get( 358 return this.rootImpl.get(
365 GetChildIDAtIndex(parent.treeID, parent.id, indexInParent + 1)); 359 GetChildIDAtIndex(parent.treeID, parent.id, indexInParent + 1));
366 }, 360 },
367 361
368 get nameFrom() {
369 return GetNameFrom(this.treeID, this.id);
370 },
371
372 doDefault: function() { 362 doDefault: function() {
373 this.performAction_('doDefault'); 363 this.performAction_('doDefault');
374 }, 364 },
375 365
376 focus: function() { 366 focus: function() {
377 this.performAction_('focus'); 367 this.performAction_('focus');
378 }, 368 },
379 369
380 getImageData: function(maxWidth, maxHeight) { 370 getImageData: function(maxWidth, maxHeight) {
381 this.performAction_('getImageData', 371 this.performAction_('getImageData',
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 return false; 662 return false;
673 } 663 }
674 } 664 }
675 } 665 }
676 return true; 666 return true;
677 } 667 }
678 }; 668 };
679 669
680 var stringAttributes = [ 670 var stringAttributes = [
681 'accessKey', 671 'accessKey',
672 'action',
682 'ariaInvalidValue', 673 'ariaInvalidValue',
674 'autoComplete',
683 'containerLiveRelevant', 675 'containerLiveRelevant',
684 'containerLiveStatus', 676 'containerLiveStatus',
685 'description', 677 'description',
686 'display', 678 'display',
679 'dropeffect',
680 'help',
681 'htmlTag',
687 'imageDataUrl', 682 'imageDataUrl',
688 'language', 683 'language',
689 'liveRelevant', 684 'liveRelevant',
690 'liveStatus', 685 'liveStatus',
691 'name', 686 'name',
692 'placeholder', 687 'placeholder',
688 'shortcut',
693 'textInputType', 689 'textInputType',
694 'url', 690 'url',
695 'value']; 691 'value'];
696 692
697 var boolAttributes = [ 693 var boolAttributes = [
698 'ariaReadonly', 694 'ariaReadonly',
699 'buttonMixed', 695 'buttonMixed',
696 'canSetValue',
697 'canvasHasFallback',
700 'containerLiveAtomic', 698 'containerLiveAtomic',
701 'containerLiveBusy', 699 'containerLiveBusy',
700 'grabbed',
701 'isAxTreeHost',
702 'liveAtomic', 702 'liveAtomic',
703 'liveBusy']; 703 'liveBusy',
704 'updateLocationOnly'];
704 705
705 var intAttributes = [ 706 var intAttributes = [
706 'backgroundColor', 707 'backgroundColor',
707 'color', 708 'color',
708 'colorValue', 709 'colorValue',
710 'descriptionFrom',
709 'hierarchicalLevel', 711 'hierarchicalLevel',
712 'invalidState',
713 'nameFrom',
710 'posInSet', 714 'posInSet',
711 'scrollX', 715 'scrollX',
712 'scrollXMax', 716 'scrollXMax',
713 'scrollXMin', 717 'scrollXMin',
714 'scrollY', 718 'scrollY',
715 'scrollYMax', 719 'scrollYMax',
716 'scrollYMin', 720 'scrollYMin',
717 'setSize', 721 'setSize',
722 'sortDirection',
718 'tableCellColumnIndex', 723 'tableCellColumnIndex',
719 'tableCellColumnSpan', 724 'tableCellColumnSpan',
720 'tableCellRowIndex', 725 'tableCellRowIndex',
721 'tableCellRowSpan', 726 'tableCellRowSpan',
722 'tableColumnCount', 727 'tableColumnCount',
723 'tableColumnIndex', 728 'tableColumnIndex',
724 'tableRowCount', 729 'tableRowCount',
725 'tableRowIndex', 730 'tableRowIndex',
731 'textDirection',
726 'textSelEnd', 732 'textSelEnd',
727 'textSelStart']; 733 'textSelStart',
734 'textStyle'];
728 735
729 var nodeRefAttributes = [ 736 var nodeRefAttributes = [
730 ['activedescendantId', 'activeDescendant'], 737 ['activedescendantId', 'activeDescendant'],
731 ['nextOnLineId', 'nextOnLine'], 738 ['nextOnLineId', 'nextOnLine'],
732 ['previousOnLineId', 'previousOnLine'], 739 ['previousOnLineId', 'previousOnLine'],
733 ['tableColumnHeaderId', 'tableColumnHeader'], 740 ['tableColumnHeaderId', 'tableColumnHeader'],
734 ['tableHeaderId', 'tableHeader'], 741 ['tableHeaderId', 'tableHeader'],
735 ['tableRowHeaderId', 'tableRowHeader']]; 742 ['tableRowHeaderId', 'tableRowHeader'],
743 ['titleUiElement', 'titleUIElement']];
736 744
737 var intListAttributes = [ 745 var intListAttributes = [
746 'characterOffsets',
738 'lineBreaks', 747 'lineBreaks',
739 'markerEnds', 748 'markerEnds',
740 'markerStarts', 749 'markerStarts',
741 'markerTypes', 750 'markerTypes',
742 'wordEnds', 751 'wordEnds',
743 'wordStarts']; 752 'wordStarts'];
744 753
745 var nodeRefListAttributes = [ 754 var nodeRefListAttributes = [
755 ['cellIds', 'cells'],
746 ['controlsIds', 'controls'], 756 ['controlsIds', 'controls'],
747 ['describedbyIds', 'describedBy'], 757 ['describedbyIds', 'describedBy'],
748 ['flowtoIds', 'flowTo'], 758 ['flowtoIds', 'flowTo'],
749 ['labelledbyIds', 'labelledBy']]; 759 ['labelledbyIds', 'labelledBy'],
760 ['uniqueCellIds', 'uniqueCells']];
750 761
751 var floatAttributes = [ 762 var floatAttributes = [
752 'valueForRange', 763 'valueForRange',
753 'minValueForRange', 764 'minValueForRange',
754 'maxValueForRange']; 765 'maxValueForRange',
766 'fontSize'];
755 767
756 var htmlAttributes = [ 768 var htmlAttributes = [
757 ['type', 'inputType']]; 769 ['type', 'inputType']];
758 770
759 var publicAttributes = []; 771 var publicAttributes = [];
760 772
761 $Array.forEach(stringAttributes, function(attributeName) { 773 $Array.forEach(stringAttributes, function(attributeName) {
762 $Array.push(publicAttributes, attributeName); 774 $Array.push(publicAttributes, attributeName);
763 $Object.defineProperty(AutomationNodeImpl.prototype, attributeName, { 775 $Object.defineProperty(AutomationNodeImpl.prototype, attributeName, {
764 __proto__: null, 776 __proto__: null,
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
1017 return obj; 1029 return obj;
1018 }, 1030 },
1019 1031
1020 remove: function(id) { 1032 remove: function(id) {
1021 if (this.axNodeDataCache_[id]) 1033 if (this.axNodeDataCache_[id])
1022 privates(this.axNodeDataCache_[id]).impl.detach(); 1034 privates(this.axNodeDataCache_[id]).impl.detach();
1023 delete this.axNodeDataCache_[id]; 1035 delete this.axNodeDataCache_[id];
1024 }, 1036 },
1025 1037
1026 destroy: function() { 1038 destroy: function() {
1027 this.dispatchEvent('destroyed', 'none'); 1039 this.dispatchEvent(schema.EventType.destroyed, 'none');
1028 for (var id in this.axNodeDataCache_) 1040 for (var id in this.axNodeDataCache_)
1029 this.remove(id); 1041 this.remove(id);
1030 this.detach(); 1042 this.detach();
1031 }, 1043 },
1032 1044
1033 setHostNode(hostNode) { 1045 setHostNode(hostNode) {
1034 this.hostNode_ = hostNode; 1046 this.hostNode_ = hostNode;
1035 }, 1047 },
1036 1048
1037 onAccessibilityEvent: function(eventParams) { 1049 onAccessibilityEvent: function(eventParams) {
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1101 'previousSibling', 1113 'previousSibling',
1102 'nextSibling', 1114 'nextSibling',
1103 'isRootNode', 1115 'isRootNode',
1104 'role', 1116 'role',
1105 'state', 1117 'state',
1106 'location', 1118 'location',
1107 'indexInParent', 1119 'indexInParent',
1108 'lineStartOffsets', 1120 'lineStartOffsets',
1109 'root', 1121 'root',
1110 'htmlAttributes', 1122 'htmlAttributes',
1111 'nameFrom',
1112 ]), 1123 ]),
1113 }); 1124 });
1114 1125
1115 function AutomationRootNode() { 1126 function AutomationRootNode() {
1116 privates(AutomationRootNode).constructPrivate(this, arguments); 1127 privates(AutomationRootNode).constructPrivate(this, arguments);
1117 } 1128 }
1118 utils.expose(AutomationRootNode, AutomationRootNodeImpl, { 1129 utils.expose(AutomationRootNode, AutomationRootNodeImpl, {
1119 superclass: AutomationNode, 1130 superclass: AutomationNode,
1120 readonly: [ 1131 readonly: [
1121 'chromeChannel', 1132 'chromeChannel',
(...skipping 17 matching lines...) Expand all
1139 utils.defineProperty(AutomationRootNode, 'getOrCreate', function(treeID) { 1150 utils.defineProperty(AutomationRootNode, 'getOrCreate', function(treeID) {
1140 return AutomationRootNodeImpl.getOrCreate(treeID); 1151 return AutomationRootNodeImpl.getOrCreate(treeID);
1141 }); 1152 });
1142 1153
1143 utils.defineProperty(AutomationRootNode, 'destroy', function(treeID) { 1154 utils.defineProperty(AutomationRootNode, 'destroy', function(treeID) {
1144 AutomationRootNodeImpl.destroy(treeID); 1155 AutomationRootNodeImpl.destroy(treeID);
1145 }); 1156 });
1146 1157
1147 exports.$set('AutomationNode', AutomationNode); 1158 exports.$set('AutomationNode', AutomationNode);
1148 exports.$set('AutomationRootNode', AutomationRootNode); 1159 exports.$set('AutomationRootNode', AutomationRootNode);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698