OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 /** | 5 /** |
6 * @fileoverview Handles automation from a desktop automation node. | 6 * @fileoverview Handles automation from a desktop automation node. |
7 */ | 7 */ |
8 | 8 |
9 goog.provide('DesktopAutomationHandler'); | 9 goog.provide('DesktopAutomationHandler'); |
10 | 10 |
(...skipping 28 matching lines...) Expand all Loading... |
39 /** | 39 /** |
40 * The last time we handled a value changed event. | 40 * The last time we handled a value changed event. |
41 * @type {!Date} | 41 * @type {!Date} |
42 * @private | 42 * @private |
43 */ | 43 */ |
44 this.lastValueChanged_ = new Date(0); | 44 this.lastValueChanged_ = new Date(0); |
45 | 45 |
46 var e = EventType; | 46 var e = EventType; |
47 this.addListener_(e.activedescendantchanged, this.onActiveDescendantChanged); | 47 this.addListener_(e.activedescendantchanged, this.onActiveDescendantChanged); |
48 this.addListener_(e.alert, this.onAlert); | 48 this.addListener_(e.alert, this.onAlert); |
49 this.addListener_(e.ariaAttributeChanged, this.onEventIfInRange); | 49 this.addListener_(e.ariaAttributeChanged, this.onAriaAttributeChanged); |
50 this.addListener_(e.autocorrectionOccured, this.onEventIfInRange); | 50 this.addListener_(e.autocorrectionOccured, this.onEventIfInRange); |
51 this.addListener_(e.checkedStateChanged, this.onCheckedStateChanged); | 51 this.addListener_(e.checkedStateChanged, this.onCheckedStateChanged); |
52 this.addListener_(e.childrenChanged, this.onActiveDescendantChanged); | 52 this.addListener_(e.childrenChanged, this.onActiveDescendantChanged); |
53 this.addListener_(e.expandedChanged, this.onEventIfInRange); | 53 this.addListener_(e.expandedChanged, this.onEventIfInRange); |
54 this.addListener_(e.focus, this.onFocus); | 54 this.addListener_(e.focus, this.onFocus); |
55 this.addListener_(e.hover, this.onHover); | 55 this.addListener_(e.hover, this.onHover); |
56 this.addListener_(e.invalidStatusChanged, this.onEventIfInRange); | 56 this.addListener_(e.invalidStatusChanged, this.onEventIfInRange); |
57 this.addListener_(e.loadComplete, this.onLoadComplete); | 57 this.addListener_(e.loadComplete, this.onLoadComplete); |
58 this.addListener_(e.menuEnd, this.onMenuEnd); | 58 this.addListener_(e.menuEnd, this.onMenuEnd); |
59 this.addListener_(e.menuListItemSelected, this.onEventIfSelected); | 59 this.addListener_(e.menuListItemSelected, this.onEventIfSelected); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 * @param {!AutomationEvent} evt | 175 * @param {!AutomationEvent} evt |
176 */ | 176 */ |
177 onEventWithFlushedOutput: function(evt) { | 177 onEventWithFlushedOutput: function(evt) { |
178 Output.forceModeForNextSpeechUtterance(cvox.QueueMode.FLUSH); | 178 Output.forceModeForNextSpeechUtterance(cvox.QueueMode.FLUSH); |
179 this.onEventDefault(evt); | 179 this.onEventDefault(evt); |
180 }, | 180 }, |
181 | 181 |
182 /** | 182 /** |
183 * @param {!AutomationEvent} evt | 183 * @param {!AutomationEvent} evt |
184 */ | 184 */ |
| 185 onAriaAttributeChanged: function(evt) { |
| 186 if (evt.target.state.editable) |
| 187 return; |
| 188 this.onEventIfInRange(evt); |
| 189 }, |
| 190 |
| 191 /** |
| 192 * @param {!AutomationEvent} evt |
| 193 */ |
185 onHover: function(evt) { | 194 onHover: function(evt) { |
186 if (ChromeVoxState.instance.currentRange && | 195 if (ChromeVoxState.instance.currentRange && |
187 evt.target == ChromeVoxState.instance.currentRange.start.node) | 196 evt.target == ChromeVoxState.instance.currentRange.start.node) |
188 return; | 197 return; |
189 Output.forceModeForNextSpeechUtterance(cvox.QueueMode.FLUSH); | 198 Output.forceModeForNextSpeechUtterance(cvox.QueueMode.FLUSH); |
190 this.onEventDefault(evt); | 199 this.onEventDefault(evt); |
191 }, | 200 }, |
192 | 201 |
193 /** | 202 /** |
194 * Makes an announcement without changing focus. | 203 * Makes an announcement without changing focus. |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 DesktopAutomationHandler.init_ = function() { | 476 DesktopAutomationHandler.init_ = function() { |
468 chrome.automation.getDesktop(function(desktop) { | 477 chrome.automation.getDesktop(function(desktop) { |
469 ChromeVoxState.desktopAutomationHandler = | 478 ChromeVoxState.desktopAutomationHandler = |
470 new DesktopAutomationHandler(desktop); | 479 new DesktopAutomationHandler(desktop); |
471 }); | 480 }); |
472 }; | 481 }; |
473 | 482 |
474 DesktopAutomationHandler.init_(); | 483 DesktopAutomationHandler.init_(); |
475 | 484 |
476 }); // goog.scope | 485 }); // goog.scope |
OLD | NEW |