Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1422)

Unified Diff: chrome/browser/resources/chromeos/chromevox/cvox2/background/next_earcons.js

Issue 1319093003: Use new earcons in ChromeVox Next. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@automation_node_id_fix_2
Patch Set: Rebase Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/chromeos/chromevox/cvox2/background/next_earcons.js
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/next_earcons.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/next_earcons.js
new file mode 100644
index 0000000000000000000000000000000000000000..519edc674b16ac22dfe5a2d91a6349fc6dc36ce6
--- /dev/null
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/next_earcons.js
@@ -0,0 +1,121 @@
+// 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('NextEarcons');
+
+goog.require('EarconEngine');
+goog.require('cvox.AbstractEarcons');
+goog.require('cvox.HostFactory');
+
+
+/**
+ * @constructor
+ * @extends {cvox.AbstractEarcons}
+ */
+NextEarcons = function() {
+ cvox.AbstractEarcons.call(this);
+
+ if (localStorage['earcons'] === 'false') {
+ cvox.AbstractEarcons.enabled = false;
+ }
+
+ /**
+ * @type {EarconEngine}
+ * @private
+ */
+ this.engine_ = new EarconEngine();
+};
+
+NextEarcons.prototype = {
+ /**
+ * @return {string} The human-readable name of the earcon set.
+ */
+ getName: function() {
+ return 'ChromeVox Next earcons';
+ },
+
+ /**
+ * @override
+ */
+ playEarcon: function(earcon) {
+ if (!cvox.AbstractEarcons.enabled) {
+ return;
+ }
+ 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:
+ this.engine_.onWrap();
+ 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:
+ // TODO(dmazzoni): decide if we want new earcons for these
+ // or not. We may choose to not have earcons for some of these.
+ break;
+ case cvox.Earcon.PAGE_FINISH_LOADING:
+ this.engine_.cancelProgress();
+ break;
+ case cvox.Earcon.PAGE_START_LOADING:
+ // TODO(dmazzoni): only when the page has focus.
+ this.engine_.startProgress();
+ break;
+ case cvox.Earcon.POP_UP_BUTTON:
+ this.engine_.onPopUpButton();
+ break;
+ case cvox.Earcon.RECOVER_FOCUS:
+ // TODO(dmazzoni): decide if we want new earcons for this.
+ break;
+ 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;
+ }
+ }
+};

Powered by Google App Engine
This is Rietveld 408576698