| // Copyright 2014 The Chromium Authors |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| /** |
| * @fileoverview Base class for implementing earcons. |
| * |
| * When adding earcons, please add them to getEarconName and getEarconId. |
| * |
| */ |
| import {LocalStorage} from '../../common/local_storage.js'; |
| |
| import {EarconId} from './earcon_id.js'; |
| |
| export class AbstractEarcons { |
| /** |
| * Plays the specified earcon sound. |
| * @param {EarconId} earcon An earcon identifier. |
| * @param {chrome.automation.Rect=} opt_location A location associated with |
| * the earcon such as a control's bounding rectangle. |
| */ |
| playEarcon(earcon, opt_location) {} |
| |
| /** |
| * Cancels the specified earcon sound. |
| * @param {EarconId} earcon An earcon identifier. |
| */ |
| cancelEarcon(earcon) {} |
| |
| /** |
| * Whether or not earcons are available. |
| * @return {boolean} True if earcons are available. |
| */ |
| earconsAvailable() { |
| return true; |
| } |
| |
| /** |
| * Whether or not earcons are enabled. |
| * @return {boolean} True if earcons are enabled. |
| */ |
| get enabled() { |
| return LocalStorage.get('earcons'); |
| } |
| |
| /** |
| * Set whether or not earcons are enabled. |
| * @param {boolean} value True turns on earcons, false turns off earcons. |
| */ |
| set enabled(value) { |
| LocalStorage.set('earcons', value); |
| } |
| } |