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

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

Issue 604423002: Use an enum for ChromeVox queue mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 3 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/chromevox/background/background.js
diff --git a/chrome/browser/resources/chromeos/chromevox/chromevox/background/background.js b/chrome/browser/resources/chromeos/chromevox/chromevox/background/background.js
index f3b0d24390c680da0acdec1ee05e133f51b7ba2c..44c33f51d29e57eb288c24cca8ad2c32064d426b 100644
--- a/chrome/browser/resources/chromeos/chromevox/chromevox/background/background.js
+++ b/chrome/browser/resources/chromeos/chromevox/chromevox/background/background.js
@@ -29,6 +29,7 @@ goog.require('cvox.NavBraille');
goog.require('cvox.OptionsPage');
goog.require('cvox.PlatformFilter');
goog.require('cvox.PlatformUtil');
+goog.require('cvox.QueueMode');
goog.require('cvox.TabsApiHandler');
goog.require('cvox.TtsBackground');
@@ -140,10 +141,12 @@ cvox.ChromeVoxBackground.prototype.init = function() {
if (localStorage['active'] == 'false') {
// Warn the user when the browser first starts if ChromeVox is inactive.
- this.tts.speak(cvox.ChromeVox.msgs.getMsg('chromevox_inactive'), 1);
+ this.tts.speak(cvox.ChromeVox.msgs.getMsg('chromevox_inactive'),
+ cvox.QueueMode.QUEUE);
} else if (cvox.PlatformUtil.matchesPlatform(cvox.PlatformFilter.WML)) {
// Introductory message.
- this.tts.speak(cvox.ChromeVox.msgs.getMsg('chromevox_intro'), 1);
+ this.tts.speak(cvox.ChromeVox.msgs.getMsg('chromevox_intro'),
+ cvox.QueueMode.QUEUE);
cvox.ChromeVox.braille.write(cvox.NavBraille.fromText(
cvox.ChromeVox.msgs.getMsg('intro_brl')));
}
@@ -196,7 +199,7 @@ cvox.ChromeVoxBackground.prototype.injectChromeVoxIntoTabs =
sawError = true;
console.error('Could not inject into tab', tab);
this.tts.speak('Error starting ChromeVox for ' +
- tab.title + ', ' + tab.url, 1);
+ tab.title + ', ' + tab.url, cvox.QueueMode.QUEUE);
}, this));
}, this);
@@ -237,7 +240,9 @@ cvox.ChromeVoxBackground.prototype.onTtsMessage = function(msg) {
// Tell the handler for native UI (chrome of chrome) events that
// the last speech came from web, and not from native UI.
this.accessibilityApiHandler_.setWebContext();
- this.tts.speak(msg['text'], msg['queueMode'], msg['properties']);
+ this.tts.speak(msg['text'],
+ /** cvox.QueueMode */msg['queueMode'],
+ msg['properties']);
} else if (msg['action'] == 'stop') {
this.tts.stop();
} else if (msg['action'] == 'increaseOrDecrease') {
@@ -263,13 +268,13 @@ cvox.ChromeVoxBackground.prototype.onTtsMessage = function(msg) {
}
if (announcement) {
this.tts.speak(announcement,
- cvox.AbstractTts.QUEUE_MODE_FLUSH,
+ cvox.QueueMode.FLUSH,
cvox.AbstractTts.PERSONALITY_ANNOTATION);
}
} else if (msg['action'] == 'cyclePunctuationEcho') {
this.tts.speak(cvox.ChromeVox.msgs.getMsg(
this.backgroundTts_.cyclePunctuationEcho()),
- cvox.AbstractTts.QUEUE_MODE_FLUSH);
+ cvox.QueueMode.FLUSH);
}
};
@@ -339,7 +344,8 @@ cvox.ChromeVoxBackground.prototype.addBridgeListener = function() {
if (msg['pref'] == 'active' &&
msg['value'] != cvox.ChromeVox.isActive) {
if (cvox.ChromeVox.isActive) {
- this.tts.speak(cvox.ChromeVox.msgs.getMsg('chromevox_inactive'));
+ this.tts.speak(cvox.ChromeVox.msgs.getMsg('chromevox_inactive'),
+ cvox.QueueMode.FLUSH);
chrome.accessibilityPrivate.setNativeAccessibilityEnabled(
true);
} else {
@@ -350,10 +356,12 @@ cvox.ChromeVoxBackground.prototype.addBridgeListener = function() {
this.earcons.enabled = msg['value'];
} else if (msg['pref'] == 'sticky' && msg['announce']) {
if (msg['value']) {
- this.tts.speak(cvox.ChromeVox.msgs.getMsg('sticky_mode_enabled'));
+ this.tts.speak(cvox.ChromeVox.msgs.getMsg('sticky_mode_enabled'),
+ cvox.QueueMode.QUEUE);
} else {
this.tts.speak(
- cvox.ChromeVox.msgs.getMsg('sticky_mode_disabled'));
+ cvox.ChromeVox.msgs.getMsg('sticky_mode_disabled'),
+ cvox.QueueMode.QUEUE);
}
} else if (msg['pref'] == 'typingEcho' && msg['announce']) {
var announce = '';
@@ -374,7 +382,7 @@ cvox.ChromeVoxBackground.prototype.addBridgeListener = function() {
break;
}
if (announce) {
- this.tts.speak(announce);
+ this.tts.speak(announce, cvox.QueueMode.QUEUE);
}
} else if (msg['pref'] == 'brailleCaptions') {
cvox.BrailleCaptionsBackground.setActive(msg['value']);
@@ -528,7 +536,7 @@ cvox.ChromeVoxBackground.prototype.onLoadStateChanged = function(
if (loading) {
if (makeAnnouncements) {
cvox.ChromeVox.tts.speak(cvox.ChromeVox.msgs.getMsg('chromevox_intro'),
- 1,
+ cvox.QueueMode.QUEUE,
{doNotInterrupt: true});
cvox.ChromeVox.braille.write(cvox.NavBraille.fromText(
cvox.ChromeVox.msgs.getMsg('intro_brl')));

Powered by Google App Engine
This is Rietveld 408576698