| 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 27 matching lines...) Expand all Loading... |
| 38 * The last time we handled a value changed event. | 38 * The last time we handled a value changed event. |
| 39 * @type {!Date} | 39 * @type {!Date} |
| 40 * @private | 40 * @private |
| 41 */ | 41 */ |
| 42 this.lastValueChanged_ = new Date(0); | 42 this.lastValueChanged_ = new Date(0); |
| 43 | 43 |
| 44 var e = EventType; | 44 var e = EventType; |
| 45 this.addListener_(e.activedescendantchanged, this.onActiveDescendantChanged); | 45 this.addListener_(e.activedescendantchanged, this.onActiveDescendantChanged); |
| 46 this.addListener_(e.alert, this.onAlert); | 46 this.addListener_(e.alert, this.onAlert); |
| 47 this.addListener_(e.ariaAttributeChanged, this.onEventIfInRange); | 47 this.addListener_(e.ariaAttributeChanged, this.onEventIfInRange); |
| 48 this.addListener_(e.checkedStateChanged, this.onEventIfInRange); | 48 this.addListener_(e.checkedStateChanged, this.onCheckedStateChanged); |
| 49 this.addListener_(e.focus, this.onFocus); | 49 this.addListener_(e.focus, this.onFocus); |
| 50 this.addListener_(e.hover, this.onHover); | 50 this.addListener_(e.hover, this.onHover); |
| 51 this.addListener_(e.loadComplete, this.onLoadComplete); | 51 this.addListener_(e.loadComplete, this.onLoadComplete); |
| 52 this.addListener_(e.menuEnd, this.onMenuEnd); | 52 this.addListener_(e.menuEnd, this.onMenuEnd); |
| 53 this.addListener_(e.menuListItemSelected, this.onEventIfSelected); | 53 this.addListener_(e.menuListItemSelected, this.onEventIfSelected); |
| 54 this.addListener_(e.menuStart, this.onMenuStart); | 54 this.addListener_(e.menuStart, this.onMenuStart); |
| 55 this.addListener_(e.scrollPositionChanged, this.onScrollPositionChanged); | 55 this.addListener_(e.scrollPositionChanged, this.onScrollPositionChanged); |
| 56 this.addListener_(e.selection, this.onSelection); | 56 this.addListener_(e.selection, this.onSelection); |
| 57 this.addListener_(e.textChanged, this.onTextChanged); | 57 this.addListener_(e.textChanged, this.onTextChanged); |
| 58 this.addListener_(e.textSelectionChanged, this.onTextSelectionChanged); | 58 this.addListener_(e.textSelectionChanged, this.onTextSelectionChanged); |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 ChromeVoxState.instance.mode === ChromeVoxMode.CLASSIC) { | 188 ChromeVoxState.instance.mode === ChromeVoxMode.CLASSIC) { |
| 189 return; | 189 return; |
| 190 } | 190 } |
| 191 | 191 |
| 192 var range = cursors.Range.fromNode(node); | 192 var range = cursors.Range.fromNode(node); |
| 193 | 193 |
| 194 new Output().withSpeechAndBraille(range, null, evt.type).go(); | 194 new Output().withSpeechAndBraille(range, null, evt.type).go(); |
| 195 }, | 195 }, |
| 196 | 196 |
| 197 /** | 197 /** |
| 198 * Provides all feedback once a checked state changed event fires. |
| 199 * @param {!AutomationEvent} evt |
| 200 */ |
| 201 onCheckedStateChanged: function(evt) { |
| 202 if (!AutomationPredicate.checkable(evt.target)) |
| 203 return; |
| 204 |
| 205 this.onEventIfInRange( |
| 206 new chrome.automation.AutomationEvent( |
| 207 EventType.checkedStateChanged, evt.target)); |
| 208 }, |
| 209 |
| 210 /** |
| 198 * Provides all feedback once a focus event fires. | 211 * Provides all feedback once a focus event fires. |
| 199 * @param {!AutomationEvent} evt | 212 * @param {!AutomationEvent} evt |
| 200 */ | 213 */ |
| 201 onFocus: function(evt) { | 214 onFocus: function(evt) { |
| 202 // Invalidate any previous editable text handler state. | 215 // Invalidate any previous editable text handler state. |
| 203 this.textEditHandler_ = null; | 216 this.textEditHandler_ = null; |
| 204 | 217 |
| 205 var node = evt.target; | 218 var node = evt.target; |
| 206 | 219 |
| 207 // Discard focus events on embeddedObject and client nodes. | 220 // Discard focus events on embeddedObject and client nodes. |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 return; | 417 return; |
| 405 chrome.automation.getDesktop(function(desktop) { | 418 chrome.automation.getDesktop(function(desktop) { |
| 406 ChromeVoxState.desktopAutomationHandler = | 419 ChromeVoxState.desktopAutomationHandler = |
| 407 new DesktopAutomationHandler(desktop); | 420 new DesktopAutomationHandler(desktop); |
| 408 }); | 421 }); |
| 409 }; | 422 }; |
| 410 | 423 |
| 411 DesktopAutomationHandler.init_(); | 424 DesktopAutomationHandler.init_(); |
| 412 | 425 |
| 413 }); // goog.scope | 426 }); // goog.scope |
| OLD | NEW |