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