Chromium Code Reviews| Index: chrome/browser/resources/chromeos/chromevox/cvox2/background/earcons_background.js |
| diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/earcons_background.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/earcons_background.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..05a266a99d0232c97d6c39f7e692a80fe3754349 |
| --- /dev/null |
| +++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/earcons_background.js |
| @@ -0,0 +1,111 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +/** |
| + * @fileoverview Earcons library that uses EarconEngine to play back |
| + * auditory cues. |
| + * |
| + */ |
| + |
| + |
| +goog.provide('Cvox2EarconsBackground'); |
|
Peter Lundblad
2015/09/07 21:15:53
Do we need the cvox2 and background parts of this
dmazzoni
2015/09/07 23:43:04
Open to suggestions, but for a short period of tim
dmazzoni
2015/09/22 19:18:17
After discussing with David I renamed the old clas
|
| + |
| +goog.require('EarconEngine'); |
| +goog.require('cvox.AbstractEarcons'); |
| + |
| + |
| +/** |
| + * @constructor |
| + * @extends {cvox.AbstractEarcons} |
| + */ |
| +Cvox2EarconsBackground = function() { |
| + goog.base(this); |
|
Peter Lundblad
2015/09/07 21:15:53
I've stopped using this for new code. Just .call t
dmazzoni
2015/09/22 19:18:17
Done.
|
| + |
| + /** @type {EarconEngine} The ChromeVox Next earcon engine. */ |
| + this.engine_ = new EarconEngine(); |
| +}; |
| +goog.inherits(Cvox2EarconsBackground, cvox.AbstractEarcons); |
|
Peter Lundblad
2015/09/07 21:15:52
And this.
dmazzoni
2015/09/22 19:18:17
Done.
|
| + |
| + |
| +/** |
| + * @return {string} The human-readable name of the earcon set. |
| + */ |
| +Cvox2EarconsBackground.prototype.getName = function() { |
| + return 'ChromeVox Next earcons'; |
| +}; |
| + |
| + |
| +/** |
| + * @override |
| + */ |
| +Cvox2EarconsBackground.prototype.playEarcon = function(earcon) { |
| + goog.base(this, 'playEarcon', earcon); |
| + if (!this.enabled) { |
| + return; |
| + } |
| + if (window['console']) { |
| + window['console']['log']('Earcon ' + earcon); |
| + } |
| + |
| + switch (earcon) { |
| + case cvox.Earcon.ALERT_MODAL: |
| + case cvox.Earcon.ALERT_NONMODAL: |
| + this.engine_.onAlert(); |
| + break; |
| + case cvox.Earcon.BUTTON: |
| + this.engine_.onButton(); |
| + break; |
| + case cvox.Earcon.CHECK_OFF: |
| + this.engine_.onCheckOff(); |
| + break; |
| + case cvox.Earcon.CHECK_ON: |
| + this.engine_.onCheckOn(); |
| + break; |
| + case cvox.Earcon.EDITABLE_TEXT: |
| + this.engine_.onTextField(); |
| + break; |
| + case cvox.Earcon.INVALID_KEYPRESS: |
| + break; |
| + case cvox.Earcon.LINK: |
| + this.engine_.onLink(); |
| + break; |
| + case cvox.Earcon.LISTBOX: |
| + this.engine_.onSelect(); |
| + break; |
| + case cvox.Earcon.LIST_ITEM: |
| + case cvox.Earcon.LONG_DESC: |
| + case cvox.Earcon.MATH: |
| + case cvox.Earcon.OBJECT_CLOSE: |
| + case cvox.Earcon.OBJECT_ENTER: |
| + case cvox.Earcon.OBJECT_EXIT: |
| + case cvox.Earcon.OBJECT_OPEN: |
| + case cvox.Earcon.OBJECT_SELECT: |
| + case cvox.Earcon.PAGE_FINISH_LOADING: |
| + this.engine_.cancelProgress(); |
| + break; |
| + case cvox.Earcon.PAGE_START_LOADING: |
| + this.engine_.startProgress(); |
|
Peter Lundblad
2015/09/07 21:15:53
How does this work if there's more than one page l
dmazzoni
2015/09/22 19:18:18
Added a TODO. I want this to only matter when the
|
| + break; |
| + case cvox.Earcon.POP_UP_BUTTON: |
| + this.engine_.onPopUpButton(); |
| + break; |
| + case cvox.Earcon.RECOVER_FOCUS: |
| + case cvox.Earcon.SELECTION: |
| + this.engine_.onSelection(); |
| + break; |
| + case cvox.Earcon.SELECTION_REVERSE: |
| + this.engine_.onSelectionReverse(); |
| + break; |
| + case cvox.Earcon.SKIP: |
| + this.engine_.onSkim(); |
| + break; |
| + case cvox.Earcon.SLIDER: |
| + this.engine_.onSlider(); |
| + break; |
| + case cvox.Earcon.WRAP: |
| + case cvox.Earcon.WRAP_EDGE: |
| + this.engine_.onWrap(); |
| + break; |
| + } |
| +}; |