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 * | |
Peter Lundblad
2015/09/29 09:27:34
nit: empty line
dmazzoni
2015/10/01 20:41:43
Done.
| |
9 */ | |
10 | |
11 | |
12 goog.provide('NextEarcons'); | |
13 | |
14 goog.require('EarconEngine'); | |
15 goog.require('cvox.AbstractEarcons'); | |
16 | |
17 | |
18 /** | |
19 * @constructor | |
20 * @extends {cvox.AbstractEarcons} | |
21 */ | |
22 NextEarcons = function() { | |
23 cvox.AbstractEarcons.call(this); | |
24 | |
25 /** | |
26 * The ChromeVox Next earcon engine. | |
Peter Lundblad
2015/09/29 09:27:34
nit: redundant.
dmazzoni
2015/10/01 20:41:43
Done.
| |
27 * @type {EarconEngine} | |
28 * @private | |
29 */ | |
30 this.engine_ = new EarconEngine(); | |
31 }; | |
Peter Lundblad
2015/09/29 09:27:34
The enabled flag is not initialized from the prefs
dmazzoni
2015/10/13 23:07:03
Moved to AbstractEarcons instead.
| |
32 | |
33 | |
34 NextEarcons.prototype = { | |
Peter Lundblad
2015/09/29 09:27:34
nit: no need for double line break.
dmazzoni
2015/10/01 20:41:43
Done.
| |
35 /** | |
36 * @return {string} The human-readable name of the earcon set. | |
37 */ | |
38 getName: function() { | |
39 return 'ChromeVox Next earcons'; | |
40 }, | |
41 | |
42 /** | |
43 * @override | |
44 */ | |
45 playEarcon: function(earcon) { | |
46 if (!this.enabled) { | |
47 return; | |
48 } | |
49 console.log('Earcon ' + earcon); | |
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; | |
Peter Lundblad
2015/09/29 09:27:34
Can you add a comment explaining why this is not h
dmazzoni
2015/10/01 20:41:43
Oops, I meant to map this one to onWrap().
| |
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 break; | |
Peter Lundblad
2015/09/29 09:27:34
Can you add a comment explaining why these are not
dmazzoni
2015/10/01 20:41:43
Done.
| |
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: | |
Peter Lundblad
2015/09/29 09:27:34
Can you add a comment explaining why this is not h
dmazzoni
2015/10/01 20:41:43
Done.
| |
96 break; | |
97 case cvox.Earcon.SELECTION: | |
98 this.engine_.onSelection(); | |
99 break; | |
100 case cvox.Earcon.SELECTION_REVERSE: | |
101 this.engine_.onSelectionReverse(); | |
102 break; | |
103 case cvox.Earcon.SKIP: | |
104 this.engine_.onSkim(); | |
105 break; | |
106 case cvox.Earcon.SLIDER: | |
107 this.engine_.onSlider(); | |
108 break; | |
109 case cvox.Earcon.WRAP: | |
110 case cvox.Earcon.WRAP_EDGE: | |
111 this.engine_.onWrap(); | |
112 break; | |
113 } | |
114 } | |
115 }; | |
OLD | NEW |