Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 /** | |
| 6 * @fileoverview Earcons library that uses EarconEngine to play back | |
| 7 * auditory cues. | |
| 8 * | |
| 9 */ | |
| 10 | |
| 11 | |
| 12 goog.provide('Cvox2EarconsBackground'); | |
|
Peter Lundblad
2015/09/07 21:15:53
Do we need the cvox2 and background parts of this
dmazzoni
2015/09/07 23:43:04
Open to suggestions, but for a short period of tim
dmazzoni
2015/09/22 19:18:17
After discussing with David I renamed the old clas
| |
| 13 | |
| 14 goog.require('EarconEngine'); | |
| 15 goog.require('cvox.AbstractEarcons'); | |
| 16 | |
| 17 | |
| 18 /** | |
| 19 * @constructor | |
| 20 * @extends {cvox.AbstractEarcons} | |
| 21 */ | |
| 22 Cvox2EarconsBackground = function() { | |
| 23 goog.base(this); | |
|
Peter Lundblad
2015/09/07 21:15:53
I've stopped using this for new code. Just .call t
dmazzoni
2015/09/22 19:18:17
Done.
| |
| 24 | |
| 25 /** @type {EarconEngine} The ChromeVox Next earcon engine. */ | |
| 26 this.engine_ = new EarconEngine(); | |
| 27 }; | |
| 28 goog.inherits(Cvox2EarconsBackground, cvox.AbstractEarcons); | |
|
Peter Lundblad
2015/09/07 21:15:52
And this.
dmazzoni
2015/09/22 19:18:17
Done.
| |
| 29 | |
| 30 | |
| 31 /** | |
| 32 * @return {string} The human-readable name of the earcon set. | |
| 33 */ | |
| 34 Cvox2EarconsBackground.prototype.getName = function() { | |
| 35 return 'ChromeVox Next earcons'; | |
| 36 }; | |
| 37 | |
| 38 | |
| 39 /** | |
| 40 * @override | |
| 41 */ | |
| 42 Cvox2EarconsBackground.prototype.playEarcon = function(earcon) { | |
| 43 goog.base(this, 'playEarcon', earcon); | |
| 44 if (!this.enabled) { | |
| 45 return; | |
| 46 } | |
| 47 if (window['console']) { | |
| 48 window['console']['log']('Earcon ' + earcon); | |
| 49 } | |
| 50 | |
| 51 switch (earcon) { | |
| 52 case cvox.Earcon.ALERT_MODAL: | |
| 53 case cvox.Earcon.ALERT_NONMODAL: | |
| 54 this.engine_.onAlert(); | |
| 55 break; | |
| 56 case cvox.Earcon.BUTTON: | |
| 57 this.engine_.onButton(); | |
| 58 break; | |
| 59 case cvox.Earcon.CHECK_OFF: | |
| 60 this.engine_.onCheckOff(); | |
| 61 break; | |
| 62 case cvox.Earcon.CHECK_ON: | |
| 63 this.engine_.onCheckOn(); | |
| 64 break; | |
| 65 case cvox.Earcon.EDITABLE_TEXT: | |
| 66 this.engine_.onTextField(); | |
| 67 break; | |
| 68 case cvox.Earcon.INVALID_KEYPRESS: | |
| 69 break; | |
| 70 case cvox.Earcon.LINK: | |
| 71 this.engine_.onLink(); | |
| 72 break; | |
| 73 case cvox.Earcon.LISTBOX: | |
| 74 this.engine_.onSelect(); | |
| 75 break; | |
| 76 case cvox.Earcon.LIST_ITEM: | |
| 77 case cvox.Earcon.LONG_DESC: | |
| 78 case cvox.Earcon.MATH: | |
| 79 case cvox.Earcon.OBJECT_CLOSE: | |
| 80 case cvox.Earcon.OBJECT_ENTER: | |
| 81 case cvox.Earcon.OBJECT_EXIT: | |
| 82 case cvox.Earcon.OBJECT_OPEN: | |
| 83 case cvox.Earcon.OBJECT_SELECT: | |
| 84 case cvox.Earcon.PAGE_FINISH_LOADING: | |
| 85 this.engine_.cancelProgress(); | |
| 86 break; | |
| 87 case cvox.Earcon.PAGE_START_LOADING: | |
| 88 this.engine_.startProgress(); | |
|
Peter Lundblad
2015/09/07 21:15:53
How does this work if there's more than one page l
dmazzoni
2015/09/22 19:18:18
Added a TODO. I want this to only matter when the
| |
| 89 break; | |
| 90 case cvox.Earcon.POP_UP_BUTTON: | |
| 91 this.engine_.onPopUpButton(); | |
| 92 break; | |
| 93 case cvox.Earcon.RECOVER_FOCUS: | |
| 94 case cvox.Earcon.SELECTION: | |
| 95 this.engine_.onSelection(); | |
| 96 break; | |
| 97 case cvox.Earcon.SELECTION_REVERSE: | |
| 98 this.engine_.onSelectionReverse(); | |
| 99 break; | |
| 100 case cvox.Earcon.SKIP: | |
| 101 this.engine_.onSkim(); | |
| 102 break; | |
| 103 case cvox.Earcon.SLIDER: | |
| 104 this.engine_.onSlider(); | |
| 105 break; | |
| 106 case cvox.Earcon.WRAP: | |
| 107 case cvox.Earcon.WRAP_EDGE: | |
| 108 this.engine_.onWrap(); | |
| 109 break; | |
| 110 } | |
| 111 }; | |
| OLD | NEW |