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 goog.provide('NextEarcons'); |
| 12 |
| 13 goog.require('EarconEngine'); |
| 14 goog.require('cvox.AbstractEarcons'); |
| 15 |
| 16 |
| 17 /** |
| 18 * @constructor |
| 19 * @extends {cvox.AbstractEarcons} |
| 20 */ |
| 21 NextEarcons = function() { |
| 22 cvox.AbstractEarcons.call(this); |
| 23 |
| 24 /** |
| 25 * @type {EarconEngine} |
| 26 * @private |
| 27 */ |
| 28 this.engine_ = new EarconEngine(); |
| 29 }; |
| 30 |
| 31 NextEarcons.prototype = { |
| 32 /** |
| 33 * @return {string} The human-readable name of the earcon set. |
| 34 */ |
| 35 getName: function() { |
| 36 return 'ChromeVox Next earcons'; |
| 37 }, |
| 38 |
| 39 /** |
| 40 * @override |
| 41 */ |
| 42 playEarcon: function(earcon) { |
| 43 if (!cvox.AbstractEarcons.enabled) { |
| 44 return; |
| 45 } |
| 46 console.log('Earcon ' + earcon); |
| 47 |
| 48 switch (earcon) { |
| 49 case cvox.Earcon.ALERT_MODAL: |
| 50 case cvox.Earcon.ALERT_NONMODAL: |
| 51 this.engine_.onAlert(); |
| 52 break; |
| 53 case cvox.Earcon.BUTTON: |
| 54 this.engine_.onButton(); |
| 55 break; |
| 56 case cvox.Earcon.CHECK_OFF: |
| 57 this.engine_.onCheckOff(); |
| 58 break; |
| 59 case cvox.Earcon.CHECK_ON: |
| 60 this.engine_.onCheckOn(); |
| 61 break; |
| 62 case cvox.Earcon.EDITABLE_TEXT: |
| 63 this.engine_.onTextField(); |
| 64 break; |
| 65 case cvox.Earcon.INVALID_KEYPRESS: |
| 66 this.engine_.onWrap(); |
| 67 break; |
| 68 case cvox.Earcon.LINK: |
| 69 this.engine_.onLink(); |
| 70 break; |
| 71 case cvox.Earcon.LISTBOX: |
| 72 this.engine_.onSelect(); |
| 73 break; |
| 74 case cvox.Earcon.LIST_ITEM: |
| 75 case cvox.Earcon.LONG_DESC: |
| 76 case cvox.Earcon.MATH: |
| 77 case cvox.Earcon.OBJECT_CLOSE: |
| 78 case cvox.Earcon.OBJECT_ENTER: |
| 79 case cvox.Earcon.OBJECT_EXIT: |
| 80 case cvox.Earcon.OBJECT_OPEN: |
| 81 case cvox.Earcon.OBJECT_SELECT: |
| 82 // TODO(dmazzoni): decide if we want new earcons for these |
| 83 // or not. We may choose to not have earcons for some of these. |
| 84 break; |
| 85 case cvox.Earcon.PAGE_FINISH_LOADING: |
| 86 this.engine_.cancelProgress(); |
| 87 break; |
| 88 case cvox.Earcon.PAGE_START_LOADING: |
| 89 // TODO(dmazzoni): only when the page has focus. |
| 90 this.engine_.startProgress(); |
| 91 break; |
| 92 case cvox.Earcon.POP_UP_BUTTON: |
| 93 this.engine_.onPopUpButton(); |
| 94 break; |
| 95 case cvox.Earcon.RECOVER_FOCUS: |
| 96 // TODO(dmazzoni): decide if we want new earcons for this. |
| 97 break; |
| 98 case cvox.Earcon.SELECTION: |
| 99 this.engine_.onSelection(); |
| 100 break; |
| 101 case cvox.Earcon.SELECTION_REVERSE: |
| 102 this.engine_.onSelectionReverse(); |
| 103 break; |
| 104 case cvox.Earcon.SKIP: |
| 105 this.engine_.onSkim(); |
| 106 break; |
| 107 case cvox.Earcon.SLIDER: |
| 108 this.engine_.onSlider(); |
| 109 break; |
| 110 case cvox.Earcon.WRAP: |
| 111 case cvox.Earcon.WRAP_EDGE: |
| 112 this.engine_.onWrap(); |
| 113 break; |
| 114 } |
| 115 } |
| 116 }; |
OLD | NEW |