Chromium Code Reviews| 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 195 ChromeVoxState.instance.mode === ChromeVoxMode.CLASSIC) { | 195 ChromeVoxState.instance.mode === ChromeVoxMode.CLASSIC) { |
| 196 return; | 196 return; |
| 197 } | 197 } |
| 198 | 198 |
| 199 var range = cursors.Range.fromNode(node); | 199 var range = cursors.Range.fromNode(node); |
| 200 | 200 |
| 201 new Output().withSpeechAndBraille(range, null, evt.type).go(); | 201 new Output().withSpeechAndBraille(range, null, evt.type).go(); |
| 202 }, | 202 }, |
| 203 | 203 |
| 204 /** | 204 /** |
| 205 * Provides all feedback once a checked state changed event fires. | |
| 206 * @param {!AutomationEvent} evt | |
| 207 */ | |
| 208 onCheckedStateChanged: function(evt) { | |
| 209 if (!AutomationPredicate.checkable(evt.target)) | |
| 210 return; | |
| 211 this.onEventDefault( | |
|
dmazzoni
2016/06/22 05:20:01
Should this maybe be onEventIfInRange?
I don't th
David Tseng
2016/06/28 19:36:55
Done.
| |
| 212 new chrome.automation.AutomationEvent( | |
| 213 EventType.checkedStateChanged, evt.target)); | |
| 214 | |
| 215 | |
| 216 }, | |
| 217 | |
| 218 /** | |
| 205 * Provides all feedback once a focus event fires. | 219 * Provides all feedback once a focus event fires. |
| 206 * @param {!AutomationEvent} evt | 220 * @param {!AutomationEvent} evt |
| 207 */ | 221 */ |
| 208 onFocus: function(evt) { | 222 onFocus: function(evt) { |
| 209 // Invalidate any previous editable text handler state. | 223 // Invalidate any previous editable text handler state. |
| 210 this.textEditHandler_ = null; | 224 this.textEditHandler_ = null; |
| 211 | 225 |
| 212 var node = evt.target; | 226 var node = evt.target; |
| 213 | 227 |
| 214 // Discard focus events on embeddedObject and client nodes. | 228 // Discard focus events on embeddedObject and client nodes. |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 412 if (cvox.ChromeVox.isMac) | 426 if (cvox.ChromeVox.isMac) |
| 413 return; | 427 return; |
| 414 chrome.automation.getDesktop(function(desktop) { | 428 chrome.automation.getDesktop(function(desktop) { |
| 415 global.desktopAutomationHandler = new DesktopAutomationHandler(desktop); | 429 global.desktopAutomationHandler = new DesktopAutomationHandler(desktop); |
| 416 }); | 430 }); |
| 417 }; | 431 }; |
| 418 | 432 |
| 419 DesktopAutomationHandler.init_(); | 433 DesktopAutomationHandler.init_(); |
| 420 | 434 |
| 421 }); // goog.scope | 435 }); // goog.scope |
| OLD | NEW |