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('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. | |
27 * @type {EarconEngine} | |
28 * @private | |
29 */ | |
30 this.engine_ = new EarconEngine(); | |
31 }; | |
32 | |
33 | |
34 /** | |
35 * @return {string} The human-readable name of the earcon set. | |
36 */ | |
37 NextEarcons.prototype.getName = function() { | |
Peter Lundblad
2015/09/24 14:56:27
Why not the object literal assigning to the protot
dmazzoni
2015/09/28 16:33:05
Done.
| |
38 return 'ChromeVox Next earcons'; | |
39 }; | |
40 | |
41 | |
42 /** | |
43 * @override | |
44 */ | |
45 NextEarcons.prototype.playEarcon = function(earcon) { | |
46 if (!this.enabled) { | |
47 return; | |
48 } | |
49 if (window['console']) { | |
Peter Lundblad
2015/09/24 14:56:27
What environment do you anticipate this running in
dmazzoni
2015/09/28 16:33:05
Lol, I just inherited this from the other file. Ma
| |
50 window['console']['log']('Earcon ' + earcon); | |
51 } | |
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 break; | |
72 case cvox.Earcon.LINK: | |
73 this.engine_.onLink(); | |
74 break; | |
75 case cvox.Earcon.LISTBOX: | |
76 this.engine_.onSelect(); | |
77 break; | |
78 case cvox.Earcon.LIST_ITEM: | |
79 case cvox.Earcon.LONG_DESC: | |
80 case cvox.Earcon.MATH: | |
81 case cvox.Earcon.OBJECT_CLOSE: | |
82 case cvox.Earcon.OBJECT_ENTER: | |
83 case cvox.Earcon.OBJECT_EXIT: | |
84 case cvox.Earcon.OBJECT_OPEN: | |
85 case cvox.Earcon.OBJECT_SELECT: | |
86 break; | |
87 case cvox.Earcon.PAGE_FINISH_LOADING: | |
88 this.engine_.cancelProgress(); | |
89 break; | |
90 case cvox.Earcon.PAGE_START_LOADING: | |
91 // TODO(dmazzoni): only when the page has focus. | |
92 this.engine_.startProgress(); | |
93 break; | |
94 case cvox.Earcon.POP_UP_BUTTON: | |
95 this.engine_.onPopUpButton(); | |
96 break; | |
97 case cvox.Earcon.RECOVER_FOCUS: | |
98 break; | |
99 case cvox.Earcon.SELECTION: | |
100 this.engine_.onSelection(); | |
101 break; | |
102 case cvox.Earcon.SELECTION_REVERSE: | |
103 this.engine_.onSelectionReverse(); | |
104 break; | |
105 case cvox.Earcon.SKIP: | |
106 this.engine_.onSkim(); | |
107 break; | |
108 case cvox.Earcon.SLIDER: | |
109 this.engine_.onSlider(); | |
110 break; | |
111 case cvox.Earcon.WRAP: | |
112 case cvox.Earcon.WRAP_EDGE: | |
113 this.engine_.onWrap(); | |
114 break; | |
115 } | |
116 }; | |
OLD | NEW |