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 CHECK_OFF: 'check_off',
26 EDITABLE_TEXT: 'editable_text',
27 INVALID_KEYPRESS: 'invalid_keypress',
30 LIST_ITEM: 'list_item',
31 LONG_DESC: 'long_desc',
33 OBJECT_CLOSE: 'object_close',
34 OBJECT_ENTER: 'object_enter',
35 OBJECT_EXIT: 'object_exit',
36 OBJECT_OPEN: 'object_open',
37 OBJECT_SELECT: 'object_select',
38 PAGE_FINISH_LOADING: 'page_finish_loading',
39 PAGE_START_LOADING: 'page_start_loading',
40 RECOVER_FOCUS: 'recover_focus',
41 SELECTION: 'selection',
42 SELECTION_REVERSE: 'selection_reverse',
45 WRAP_EDGE: 'wrap_edge',
52 cvox.AbstractEarcons = function() {
54 * Public flag set to enable or disable earcons. Callers should prefer
55 * toggle(); however, this member is public for initialization.
63 * Plays the specified earcon sound.
64 * @param {cvox.Earcon} earcon An earcon identifier.
66 cvox.AbstractEarcons.prototype.playEarcon = function(earcon) {
71 * Whether or not earcons are available.
72 * @return {boolean} True if earcons are available.
74 cvox.AbstractEarcons.prototype.earconsAvailable = function() {
80 * Toggles earcons on or off.
81 * @return {boolean} True if earcons are now enabled; false otherwise.
83 cvox.AbstractEarcons.prototype.toggle = function() {
84 this.enabled = !this.enabled;