1 // Copyright 2014 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.
6 * @fileoverview Base class for implementing earcons.
8 * When adding earcons, please add them to getEarconName and getEarconId.
12 goog
.provide('cvox.AbstractEarcons');
13 goog
.provide('cvox.Earcon');
21 ALERT_MODAL
: 'alert_modal',
22 ALERT_NONMODAL
: 'alert_nonmodal',
24 BUSY_PROGRESS_LOOP
: 'busy_progress_loop',
26 CHECK_OFF
: 'check_off',
28 EDITABLE_TEXT
: 'editable_text',
29 FONT_CHANGE
: 'font_change',
30 INVALID_KEYPRESS
: 'invalid_keypress',
34 LONG_DESC
: 'long_desc',
35 OBJECT_CLOSE
: 'object_close',
36 OBJECT_ENTER
: 'object_enter',
37 OBJECT_EXIT
: 'object_exit',
38 OBJECT_OPEN
: 'object_open',
39 OBJECT_SELECT
: 'object_select',
40 PARAGRAPH_BREAK
: 'paragraph_break',
42 SELECTION
: 'selection',
43 SELECTION_REVERSE
: 'selection_reverse',
44 SPECIAL_CONTENT
: 'special_content',
45 TASK_SUCCESS
: 'task_success',
47 WRAP_EDGE
: 'wrap_edge',
54 cvox
.AbstractEarcons = function() {
56 * Public flag set to enable or disable earcons. Callers should prefer
57 * toggle(); however, this member is public for initialization.
65 * Plays the specified earcon sound.
66 * @param {cvox.Earcon} earcon An earcon identifier.
68 cvox
.AbstractEarcons
.prototype.playEarcon = function(earcon
) {
73 * Whether or not earcons are available.
74 * @return {boolean} True if earcons are available.
76 cvox
.AbstractEarcons
.prototype.earconsAvailable = function() {
82 * Toggles earcons on or off.
83 * @return {boolean} True if earcons are now enabled; false otherwise.
85 cvox
.AbstractEarcons
.prototype.toggle = function() {
86 this.enabled
= !this.enabled
;