| 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 29 matching lines...) Expand all Loading... |
| 40 * @type {!Date} | 40 * @type {!Date} |
| 41 * @private | 41 * @private |
| 42 */ | 42 */ |
| 43 this.lastValueChanged_ = new Date(0); | 43 this.lastValueChanged_ = new Date(0); |
| 44 | 44 |
| 45 var e = EventType; | 45 var e = EventType; |
| 46 this.addListener_(e.activedescendantchanged, this.onActiveDescendantChanged); | 46 this.addListener_(e.activedescendantchanged, this.onActiveDescendantChanged); |
| 47 this.addListener_(e.alert, this.onAlert); | 47 this.addListener_(e.alert, this.onAlert); |
| 48 this.addListener_(e.ariaAttributeChanged, this.onEventIfInRange); | 48 this.addListener_(e.ariaAttributeChanged, this.onEventIfInRange); |
| 49 this.addListener_(e.checkedStateChanged, this.onCheckedStateChanged); | 49 this.addListener_(e.checkedStateChanged, this.onCheckedStateChanged); |
| 50 this.addListener_(e.childrenChanged, this.onActiveDescendantChanged); |
| 50 this.addListener_(e.focus, this.onFocus); | 51 this.addListener_(e.focus, this.onFocus); |
| 51 this.addListener_(e.hover, this.onHover); | 52 this.addListener_(e.hover, this.onHover); |
| 52 this.addListener_(e.loadComplete, this.onLoadComplete); | 53 this.addListener_(e.loadComplete, this.onLoadComplete); |
| 53 this.addListener_(e.menuEnd, this.onMenuEnd); | 54 this.addListener_(e.menuEnd, this.onMenuEnd); |
| 54 this.addListener_(e.menuListItemSelected, this.onEventIfSelected); | 55 this.addListener_(e.menuListItemSelected, this.onEventIfSelected); |
| 55 this.addListener_(e.menuStart, this.onMenuStart); | 56 this.addListener_(e.menuStart, this.onMenuStart); |
| 56 this.addListener_(e.scrollPositionChanged, this.onScrollPositionChanged); | 57 this.addListener_(e.scrollPositionChanged, this.onScrollPositionChanged); |
| 57 this.addListener_(e.selection, this.onSelection); | 58 this.addListener_(e.selection, this.onSelection); |
| 58 this.addListener_(e.textChanged, this.onTextChanged); | 59 this.addListener_(e.textChanged, this.onTextChanged); |
| 59 this.addListener_(e.textSelectionChanged, this.onTextSelectionChanged); | 60 this.addListener_(e.textSelectionChanged, this.onTextSelectionChanged); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 return; | 172 return; |
| 172 Output.flushNextSpeechUtterance(); | 173 Output.flushNextSpeechUtterance(); |
| 173 this.onEventDefault(evt); | 174 this.onEventDefault(evt); |
| 174 }, | 175 }, |
| 175 | 176 |
| 176 /** | 177 /** |
| 177 * Makes an announcement without changing focus. | 178 * Makes an announcement without changing focus. |
| 178 * @param {!AutomationEvent} evt | 179 * @param {!AutomationEvent} evt |
| 179 */ | 180 */ |
| 180 onActiveDescendantChanged: function(evt) { | 181 onActiveDescendantChanged: function(evt) { |
| 181 if (!evt.target.activeDescendant) | 182 if (!evt.target.activeDescendant || !evt.target.state.focused) |
| 182 return; | 183 return; |
| 183 this.onEventDefault(new chrome.automation.AutomationEvent( | 184 this.onEventDefault(new chrome.automation.AutomationEvent( |
| 184 EventType.focus, evt.target.activeDescendant)); | 185 EventType.focus, evt.target.activeDescendant)); |
| 185 }, | 186 }, |
| 186 | 187 |
| 187 /** | 188 /** |
| 188 * Makes an announcement without changing focus. | 189 * Makes an announcement without changing focus. |
| 189 * @param {!AutomationEvent} evt | 190 * @param {!AutomationEvent} evt |
| 190 */ | 191 */ |
| 191 onAlert: function(evt) { | 192 onAlert: function(evt) { |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 DesktopAutomationHandler.init_ = function() { | 450 DesktopAutomationHandler.init_ = function() { |
| 450 chrome.automation.getDesktop(function(desktop) { | 451 chrome.automation.getDesktop(function(desktop) { |
| 451 ChromeVoxState.desktopAutomationHandler = | 452 ChromeVoxState.desktopAutomationHandler = |
| 452 new DesktopAutomationHandler(desktop); | 453 new DesktopAutomationHandler(desktop); |
| 453 }); | 454 }); |
| 454 }; | 455 }; |
| 455 | 456 |
| 456 DesktopAutomationHandler.init_(); | 457 DesktopAutomationHandler.init_(); |
| 457 | 458 |
| 458 }); // goog.scope | 459 }); // goog.scope |
| OLD | NEW |