summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authordmazzoni <dmazzoni@chromium.org>2014-09-30 16:35:26 -0700
committerCommit bot <commit-bot@chromium.org>2014-09-30 23:35:40 +0000
commitf7803cb1efe53a363854da07b058da664601eba2 (patch)
treeb91e3fbfb20e459e05d9a469846d8fbc3ad4e343 /chrome/browser
parent9c99a1d7cd522e23f1232e53a181c9b21bda2216 (diff)
downloadchromium_src-f7803cb1efe53a363854da07b058da664601eba2.zip
chromium_src-f7803cb1efe53a363854da07b058da664601eba2.tar.gz
chromium_src-f7803cb1efe53a363854da07b058da664601eba2.tar.bz2
Use an enum for ChromeVox queue mode.
There were lots and lots of lazy uses of this API function! BUG=none Review URL: https://codereview.chromium.org/604423002 Cr-Commit-Position: refs/heads/master@{#297543}
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/resources/chromeos/chromevox/chromevox/background/accessibility_api_handler.js23
-rw-r--r--chrome/browser/resources/chromeos/chromevox/chromevox/background/background.js30
-rw-r--r--chrome/browser/resources/chromeos/chromevox/chromevox/background/braille_captions_background.js2
-rw-r--r--chrome/browser/resources/chromeos/chromevox/chromevox/background/options.js10
-rw-r--r--chrome/browser/resources/chromeos/chromevox/chromevox/background/tabs_api_handler.js6
-rw-r--r--chrome/browser/resources/chromeos/chromevox/chromevox/injected/api_implementation.js10
-rw-r--r--chrome/browser/resources/chromeos/chromevox/chromevox/injected/console_tts.js4
-rw-r--r--chrome/browser/resources/chromeos/chromevox/chromevox/injected/event_watcher.js21
-rw-r--r--chrome/browser/resources/chromeos/chromevox/chromevox/injected/initial_speech.js6
-rw-r--r--chrome/browser/resources/chromeos/chromevox/chromevox/injected/live_regions.js10
-rw-r--r--chrome/browser/resources/chromeos/chromevox/chromevox/injected/navigation_manager.js24
-rw-r--r--chrome/browser/resources/chromeos/chromevox/chromevox/injected/navigation_speaker.js2
-rw-r--r--chrome/browser/resources/chromeos/chromevox/chromevox/injected/pdf_processor.js4
-rw-r--r--chrome/browser/resources/chromeos/chromevox/chromevox/injected/ui/overlay_widget.js3
-rw-r--r--chrome/browser/resources/chromeos/chromevox/chromevox/injected/ui/search_widget.js14
-rw-r--r--chrome/browser/resources/chromeos/chromevox/chromevox/injected/ui/widget.js2
-rw-r--r--chrome/browser/resources/chromeos/chromevox/chromevox/injected/user_commands.js28
-rw-r--r--chrome/browser/resources/chromeos/chromevox/chromevox/messages/spoken_message.js2
-rw-r--r--chrome/browser/resources/chromeos/chromevox/chromevox/messages/spoken_messages.js31
-rw-r--r--chrome/browser/resources/chromeos/chromevox/common/editable_text.js4
-rw-r--r--chrome/browser/resources/chromeos/chromevox/common/nav_description.js23
-rw-r--r--chrome/browser/resources/chromeos/chromevox/common/time_widget.js41
-rw-r--r--chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js2
-rw-r--r--chrome/browser/resources/chromeos/chromevox/extensions/searchvox/results.js14
-rw-r--r--chrome/browser/resources/chromeos/chromevox/extensions/searchvox/search.js14
-rw-r--r--chrome/browser/resources/chromeos/chromevox/host/chrome/tts.js6
-rw-r--r--chrome/browser/resources/chromeos/chromevox/host/chrome/tts_background.js27
-rw-r--r--chrome/browser/resources/chromeos/chromevox/host/interface/abstract_tts.js22
-rw-r--r--chrome/browser/resources/chromeos/chromevox/host/interface/tts_interface.js23
-rw-r--r--chrome/browser/resources/chromeos/chromevox/host/testing/tts.js2
-rw-r--r--chrome/browser/resources/chromeos/chromevox/strings/chromevox_strings.grd9
-rw-r--r--chrome/browser/resources/chromeos/chromevox/testing/spoken_list_builder.js8
-rw-r--r--chrome/browser/resources/chromeos/chromevox/testing/tester.js5
-rw-r--r--chrome/browser/resources/chromeos/chromevox/walkers/table_walker.js5
34 files changed, 244 insertions, 193 deletions
diff --git a/chrome/browser/resources/chromeos/chromevox/chromevox/background/accessibility_api_handler.js b/chrome/browser/resources/chromeos/chromevox/chromevox/background/accessibility_api_handler.js
index fd1bdb5..3667b60 100644
--- a/chrome/browser/resources/chromeos/chromevox/chromevox/background/accessibility_api_handler.js
+++ b/chrome/browser/resources/chromeos/chromevox/chromevox/background/accessibility_api_handler.js
@@ -15,6 +15,7 @@ goog.require('cvox.BrailleInterface');
goog.require('cvox.BrailleUtil');
goog.require('cvox.ChromeVoxEditableTextBase');
goog.require('cvox.NavBraille');
+goog.require('cvox.QueueMode');
/**
@@ -106,9 +107,9 @@ cvox.AccessibilityApiHandler.prototype.editableTextName = '';
/**
* The queue mode for the next focus event.
- * @type {number}
+ * @type {cvox.QueueMode}
*/
-cvox.AccessibilityApiHandler.prototype.nextQueueMode = 0;
+cvox.AccessibilityApiHandler.prototype.nextQueueMode = cvox.QueueMode.FLUSH;
/**
* The timeout id for the pending text changed event - the return
@@ -198,12 +199,12 @@ cvox.AccessibilityApiHandler.prototype.addEventListeners_ = function() {
return;
}
this.tts.speak(win.name,
- cvox.AbstractTts.QUEUE_MODE_FLUSH,
+ cvox.QueueMode.FLUSH,
cvox.AbstractTts.PERSONALITY_ANNOUNCEMENT);
this.braille.write(cvox.NavBraille.fromText(win.name));
// Queue the next utterance because a window opening is always followed
// by a focus event.
- this.nextQueueMode = 1;
+ this.nextQueueMode = cvox.QueueMode.QUEUE;
this.earcons.playEarcon(cvox.AbstractEarcons.OBJECT_OPEN);
this.queueAlertsForActiveTab();
}, this));
@@ -223,7 +224,7 @@ cvox.AccessibilityApiHandler.prototype.addEventListeners_ = function() {
return;
}
this.tts.speak(msg('chrome_menu_opened', [menu.name]),
- cvox.AbstractTts.QUEUE_MODE_FLUSH,
+ cvox.QueueMode.FLUSH,
cvox.AbstractTts.PERSONALITY_ANNOUNCEMENT);
this.braille.write(
cvox.NavBraille.fromText(msg('chrome_menu_opened', [menu.name])));
@@ -281,7 +282,7 @@ cvox.AccessibilityApiHandler.prototype.addEventListeners_ = function() {
this.earcons.playEarcon(cvox.AbstractEarcons.TASK_SUCCESS);
this.tts.speak(
msg('chrome_brightness_changed', [brightness.brightness]),
- cvox.AbstractTts.QUEUE_MODE_FLUSH,
+ cvox.QueueMode.FLUSH,
cvox.AbstractTts.PERSONALITY_ANNOUNCEMENT);
this.braille.write(cvox.NavBraille.fromText(
msg('chrome_brightness_changed', [brightness.brightness])));
@@ -296,7 +297,7 @@ cvox.AccessibilityApiHandler.prototype.addEventListeners_ = function() {
// Speak about system update when it's ready, otherwise speak nothing.
if (status.state == 'NeedRestart') {
this.tts.speak(msg('chrome_system_need_restart'),
- cvox.AbstractTts.QUEUE_MODE_FLUSH,
+ cvox.QueueMode.FLUSH,
cvox.AbstractTts.PERSONALITY_ANNOUNCEMENT);
this.braille.write(
cvox.NavBraille.fromText(msg('chrome_system_need_restart')));
@@ -324,7 +325,7 @@ cvox.AccessibilityApiHandler.prototype.addEventListeners_ = function() {
var description = this.describe(ctl, true);
this.tts.speak(description.utterance,
- cvox.AbstractTts.QUEUE_MODE_FLUSH,
+ cvox.QueueMode.FLUSH,
description.ttsProps);
description.braille.write();
if (description.earcon) {
@@ -346,7 +347,7 @@ cvox.AccessibilityApiHandler.prototype.addEventListeners_ = function() {
var description = this.describe(ctl, false);
this.tts.speak(description.utterance,
- cvox.AbstractTts.QUEUE_MODE_FLUSH,
+ cvox.QueueMode.FLUSH,
description.ttsProps);
description.braille.write();
if (description.earcon) {
@@ -439,7 +440,7 @@ cvox.AccessibilityApiHandler.prototype.onControlFocused = function(ctl) {
this.nextQueueMode,
description.ttsProps);
description.braille.write();
- this.nextQueueMode = 0;
+ this.nextQueueMode = cvox.QueueMode.FLUSH;
if (description.earcon) {
this.earcons.playEarcon(description.earcon);
}
@@ -476,7 +477,7 @@ cvox.AccessibilityApiHandler.prototype.onTtsIdle = function() {
var utterance = this.idleSpeechQueue_.shift();
var msg = goog.bind(cvox.ChromeVox.msgs.getMsg, cvox.ChromeVox.msgs);
this.tts.speak(utterance,
- cvox.AbstractTts.QUEUE_MODE_FLUSH,
+ cvox.QueueMode.FLUSH,
cvox.AbstractTts.PERSONALITY_ANNOUNCEMENT);
};
diff --git a/chrome/browser/resources/chromeos/chromevox/chromevox/background/background.js b/chrome/browser/resources/chromeos/chromevox/chromevox/background/background.js
index e223c5c..760366b 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')));
diff --git a/chrome/browser/resources/chromeos/chromevox/chromevox/background/braille_captions_background.js b/chrome/browser/resources/chromeos/chromevox/chromevox/background/braille_captions_background.js
index 3e4d386e..0d2183c 100644
--- a/chrome/browser/resources/chromeos/chromevox/chromevox/background/braille_captions_background.js
+++ b/chrome/browser/resources/chromeos/chromevox/chromevox/background/braille_captions_background.js
@@ -88,7 +88,7 @@ cvox.BrailleCaptionsBackground.setActive = function(newValue) {
var msg = newValue ?
cvox.ChromeVox.msgs.getMsg('braille_captions_enabled') :
cvox.ChromeVox.msgs.getMsg('braille_captions_disabled');
- cvox.ChromeVox.tts.speak(msg);
+ cvox.ChromeVox.tts.speak(msg, cvox.QueueMode.QUEUE);
cvox.ChromeVox.braille.write(cvox.NavBraille.fromText(msg));
}
};
diff --git a/chrome/browser/resources/chromeos/chromevox/chromevox/background/options.js b/chrome/browser/resources/chromeos/chromevox/chromevox/background/options.js
index 8ba469e..461c043 100644
--- a/chrome/browser/resources/chromeos/chromevox/chromevox/background/options.js
+++ b/chrome/browser/resources/chromeos/chromevox/chromevox/background/options.js
@@ -186,7 +186,7 @@ cvox.OptionsPage.addKeys = function() {
} else {
announce = cvox.ChromeVox.msgs.getMsg('key_conflict', [announce]);
}
- cvox.OptionsPage.speak(announce);
+ cvox.OptionsPage.speak(announce, cvox.QueueMode.QUEUE);
this.prevTime = currentTime;
evt.preventDefault();
@@ -289,7 +289,8 @@ cvox.OptionsPage.addKeys = function() {
// Indicate error and instructions excluding tab.
if (evt.keyCode != 9) {
cvox.OptionsPage.speak(
- cvox.ChromeVox.msgs.getMsg('modifier_entry_error'), 0, {});
+ cvox.ChromeVox.msgs.getMsg('modifier_entry_error'),
+ cvox.QueueMode.FLUSH, {});
}
this.modifierSeq_ = null;
} else {
@@ -312,7 +313,8 @@ cvox.OptionsPage.addKeys = function() {
cvox.KeyUtil.keySequenceToString(this.modifierSeq_, true, true);
evt.target.value = modifierStr;
cvox.OptionsPage.speak(
- cvox.ChromeVox.msgs.getMsg('modifier_entry_set', [modifierStr]));
+ cvox.ChromeVox.msgs.getMsg('modifier_entry_set', [modifierStr]),
+ cvox.QueueMode.QUEUE);
localStorage['cvoxKey'] = modifierStr;
this.modifierSeq_ = null;
}
@@ -555,7 +557,7 @@ cvox.OptionsPage.hidePlatformSpecifics = function() {
* Calls a {@code cvox.TtsInterface.speak} method in the background page to
* speak an utterance. See that method for further details.
* @param {string} textString The string of text to be spoken.
- * @param {number=} queueMode The queue mode to use.
+ * @param {cvox.QueueMode} queueMode The queue mode to use.
* @param {Object=} properties Speech properties to use for this utterance.
*/
cvox.OptionsPage.speak = function(textString, queueMode, properties) {
diff --git a/chrome/browser/resources/chromeos/chromevox/chromevox/background/tabs_api_handler.js b/chrome/browser/resources/chromeos/chromevox/chromevox/background/tabs_api_handler.js
index 8623331..55ef869 100644
--- a/chrome/browser/resources/chromeos/chromevox/chromevox/background/tabs_api_handler.js
+++ b/chrome/browser/resources/chromeos/chromevox/chromevox/background/tabs_api_handler.js
@@ -52,7 +52,7 @@ cvox.TabsApiHandler.prototype = {
return;
}
this.tts_.speak(this.msg_('chrome_tab_created'),
- cvox.AbstractTts.QUEUE_MODE_FLUSH,
+ cvox.QueueMode.FLUSH,
cvox.AbstractTts.PERSONALITY_ANNOUNCEMENT);
this.braille_.write(
cvox.NavBraille.fromText(this.msg_('chrome_tab_created')));
@@ -85,7 +85,7 @@ cvox.TabsApiHandler.prototype = {
var title = tab.title ? tab.title : tab.url;
this.tts_.speak(this.msg_('chrome_tab_selected',
[title]),
- cvox.AbstractTts.QUEUE_MODE_FLUSH,
+ cvox.QueueMode.FLUSH,
cvox.AbstractTts.PERSONALITY_ANNOUNCEMENT);
this.braille_.write(
cvox.NavBraille.fromText(this.msg_('chrome_tab_selected', [title])));
@@ -131,7 +131,7 @@ cvox.TabsApiHandler.prototype = {
'chrome_normal_window_selected';
var title = tab.title ? tab.title : tab.url;
this.tts_.speak(this.msg_(msgId, [title]),
- cvox.AbstractTts.QUEUE_MODE_FLUSH,
+ cvox.QueueMode.FLUSH,
cvox.AbstractTts.PERSONALITY_ANNOUNCEMENT);
this.braille_.write(
cvox.NavBraille.fromText(this.msg_(msgId, [title])));
diff --git a/chrome/browser/resources/chromeos/chromevox/chromevox/injected/api_implementation.js b/chrome/browser/resources/chromeos/chromevox/chromevox/injected/api_implementation.js
index eee5db6..0db02e9 100644
--- a/chrome/browser/resources/chromeos/chromevox/chromevox/injected/api_implementation.js
+++ b/chrome/browser/resources/chromeos/chromevox/chromevox/injected/api_implementation.js
@@ -143,7 +143,9 @@ cvox.ApiImplementation.speak = function(
properties = {};
}
setupEndCallback_(properties, callbackId);
- cvox.ChromeVox.tts.speak(textString, queueMode, properties);
+ cvox.ChromeVox.tts.speak(textString,
+ /** @type {cvox.QueueMode} */ (queueMode),
+ properties);
}
};
@@ -158,7 +160,7 @@ cvox.ApiImplementation.speakNode = function(node, queueMode, properties) {
if (cvox.ChromeVox.isActive) {
cvox.ChromeVox.tts.speak(
cvox.DomUtil.getName(node),
- queueMode,
+ /** @type {cvox.QueueMode} */ (queueMode),
properties);
}
};
@@ -261,7 +263,7 @@ cvox.ApiImplementation.syncToNode = function(
}
if (opt_queueMode == undefined) {
- opt_queueMode = cvox.AbstractTts.QUEUE_MODE_CATEGORY_FLUSH;
+ opt_queueMode = cvox.QueueMode.CATEGORY_FLUSH;
}
cvox.ChromeVox.navigationManager.updateSelToArbitraryNode(targetNode, true);
@@ -279,7 +281,7 @@ cvox.ApiImplementation.syncToNode = function(
if (opt_speakNode) {
cvox.ChromeVox.navigationManager.speakDescriptionArray(
cvox.ApiImplementation.getDesc_(targetNode),
- opt_queueMode,
+ /** @type {cvox.QueueMode} */ (opt_queueMode),
null,
null,
cvox.TtsCategory.NAV);
diff --git a/chrome/browser/resources/chromeos/chromevox/chromevox/injected/console_tts.js b/chrome/browser/resources/chromeos/chromevox/chromevox/injected/console_tts.js
index 09d4716..00abb03 100644
--- a/chrome/browser/resources/chromeos/chromevox/chromevox/injected/console_tts.js
+++ b/chrome/browser/resources/chromeos/chromevox/chromevox/injected/console_tts.js
@@ -30,9 +30,9 @@ goog.addSingletonGetter(cvox.ConsoleTts);
cvox.ConsoleTts.prototype.speak = function(textString, queueMode, properties) {
if (this.enabled_ && window['console']) {
var logStr = 'Speak';
- if (queueMode == cvox.AbstractTts.QUEUE_MODE_FLUSH) {
+ if (queueMode == cvox.QueueMode.FLUSH) {
logStr += ' (I)';
- } else if (queueMode == cvox.AbstractTts.QUEUE_MODE_CATEGORY_FLUSH) {
+ } else if (queueMode == cvox.QueueMode.CATEGORY_FLUSH) {
logStr += ' (C)';
} else {
logStr += ' (Q)';
diff --git a/chrome/browser/resources/chromeos/chromevox/chromevox/injected/event_watcher.js b/chrome/browser/resources/chromeos/chromevox/chromevox/injected/event_watcher.js
index d060e28..04aef51 100644
--- a/chrome/browser/resources/chromeos/chromevox/chromevox/injected/event_watcher.js
+++ b/chrome/browser/resources/chromeos/chromevox/chromevox/injected/event_watcher.js
@@ -29,6 +29,7 @@ goog.require('cvox.Memoize');
goog.require('cvox.NavigationSpeaker');
goog.require('cvox.PlatformFilter'); // TODO: Find a better place for this.
goog.require('cvox.PlatformUtil');
+goog.require('cvox.QueueMode');
goog.require('cvox.TextHandlerInterface');
goog.require('cvox.UserEventDetail');
@@ -672,11 +673,11 @@ cvox.ChromeVoxEventWatcher.focusHandler = function(evt) {
if (cvox.ChromeVoxEventWatcher.getInitialVisibility() ||
cvox.ChromeVoxEventWatcher.handleDialogFocus(target)) {
- queueMode = cvox.AbstractTts.QUEUE_MODE_QUEUE;
+ queueMode = cvox.QueueMode.QUEUE;
}
if (cvox.ChromeVox.navigationManager.clearPageSel(true)) {
- queueMode = cvox.AbstractTts.QUEUE_MODE_QUEUE;
+ queueMode = cvox.QueueMode.QUEUE;
}
// Navigate to this control so that it will be the same for focus as for
@@ -839,7 +840,8 @@ cvox.ChromeVoxEventWatcher.keyPressEventWatcher = function(evt) {
if (cvox.ChromeVoxEditableTextBase.eventTypingEcho && (speakChar &&
cvox.DomPredicates.editTextPredicate([document.activeElement])) &&
document.activeElement.type !== 'password') {
- cvox.ChromeVox.tts.speak(String.fromCharCode(evt.charCode), 0);
+ cvox.ChromeVox.tts.speak(String.fromCharCode(evt.charCode),
+ cvox.QueueMode.FLUSH);
}
cvox.ChromeVoxEventWatcher.addEvent(evt);
if (cvox.ChromeVoxEventWatcher.eventToEat &&
@@ -870,7 +872,8 @@ cvox.ChromeVoxEventWatcher.changeEventWatcher = function(evt) {
* @return {boolean} True if the default action should be performed.
*/
cvox.ChromeVoxEventWatcher.clipboardEventWatcher = function(evt) {
- cvox.ChromeVox.tts.speak(cvox.ChromeVox.msgs.getMsg(evt.type).toLowerCase());
+ cvox.ChromeVox.tts.speak(cvox.ChromeVox.msgs.getMsg(evt.type).toLowerCase(),
+ cvox.QueueMode.QUEUE);
var text = '';
switch (evt.type) {
case 'paste':
@@ -881,7 +884,7 @@ cvox.ChromeVoxEventWatcher.clipboardEventWatcher = function(evt) {
text = window.getSelection().toString();
break;
}
- cvox.ChromeVox.tts.speak(text, cvox.AbstractTts.QUEUE_MODE_QUEUE);
+ cvox.ChromeVox.tts.speak(text, cvox.QueueMode.QUEUE);
cvox.ChromeVox.navigationManager.clearPageSel();
return true;
};
@@ -1247,7 +1250,7 @@ cvox.ChromeVoxEventWatcher.handleDialogFocus = function(target) {
cvox.DescriptionUtil.getFullDescriptionsFromChildren(null, dialog);
var descSpeaker = new cvox.NavigationSpeaker();
descSpeaker.speakDescriptionArray(dialogDescArray,
- cvox.AbstractTts.QUEUE_MODE_QUEUE,
+ cvox.QueueMode.QUEUE,
null);
}
return true;
@@ -1300,15 +1303,15 @@ cvox.ChromeVoxEventWatcherUtil.shouldWaitToProcess = function(
* a result of an event or navigation. The first utterance that's spoken
* after an explicit user action like a key press will flush, and
* subsequent events will return a category flush.
- * @return {number} Either QUEUE_MODE_FLUSH or QUEUE_MODE_QUEUE.
+ * @return {cvox.QueueMode} The queue mode.
* @private
*/
cvox.ChromeVoxEventWatcher.queueMode_ = function() {
if (cvox.ChromeVoxEventWatcher.shouldFlushNextUtterance) {
cvox.ChromeVoxEventWatcher.shouldFlushNextUtterance = false;
- return cvox.AbstractTts.QUEUE_MODE_FLUSH;
+ return cvox.QueueMode.FLUSH;
}
- return cvox.AbstractTts.QUEUE_MODE_CATEGORY_FLUSH;
+ return cvox.QueueMode.CATEGORY_FLUSH;
};
diff --git a/chrome/browser/resources/chromeos/chromevox/chromevox/injected/initial_speech.js b/chrome/browser/resources/chromeos/chromevox/chromevox/injected/initial_speech.js
index 654769a..3e13f57 100644
--- a/chrome/browser/resources/chromeos/chromevox/chromevox/injected/initial_speech.js
+++ b/chrome/browser/resources/chromeos/chromevox/chromevox/injected/initial_speech.js
@@ -49,14 +49,14 @@ cvox.InitialSpeech.speak = function() {
if (title && !disableSpeak) {
cvox.ChromeVox.tts.speak(
- title, cvox.AbstractTts.QUEUE_MODE_FLUSH);
+ title, cvox.QueueMode.FLUSH);
}
cvox.BrailleOverlayWidget.getInstance().init();
}
// Initialize live regions and speak alerts.
cvox.LiveRegions.init(
- new Date(), cvox.AbstractTts.QUEUE_MODE_QUEUE, disableSpeak);
+ new Date(), cvox.QueueMode.QUEUE, disableSpeak);
// If our activeElement is on body, try to sync to the first element. This
// actually happens inside of NavigationManager.reset, which doesn't get
@@ -78,7 +78,7 @@ cvox.InitialSpeech.speak = function() {
if (!disableSpeak) {
cvox.ChromeVoxEventSuspender.withSuspendedEvents(function() {
cvox.ChromeVox.navigationManager.finishNavCommand(
- '', true, cvox.AbstractTts.QUEUE_MODE_QUEUE);
+ '', true, cvox.QueueMode.QUEUE);
})();
}
}
diff --git a/chrome/browser/resources/chromeos/chromevox/chromevox/injected/live_regions.js b/chrome/browser/resources/chromeos/chromevox/chromevox/injected/live_regions.js
index c72efde..a08723f 100644
--- a/chrome/browser/resources/chromeos/chromevox/chromevox/injected/live_regions.js
+++ b/chrome/browser/resources/chromeos/chromevox/chromevox/injected/live_regions.js
@@ -82,16 +82,12 @@ cvox.LiveRegions.nodesAlreadyHandled = [];
/**
* @param {Date} pageLoadTime The time the page was loaded. Live region
* updates within the first INITIAL_SILENCE_MS milliseconds are ignored.
- * @param {number} queueMode Interrupt or flush. Polite live region
+ * @param {cvox.QueueMode} queueMode Interrupt or flush. Polite live region
* changes always queue.
* @param {boolean} disableSpeak true if change announcement should be disabled.
* @return {boolean} true if any regions announced.
*/
cvox.LiveRegions.init = function(pageLoadTime, queueMode, disableSpeak) {
- if (queueMode == undefined) {
- queueMode = cvox.AbstractTts.QUEUE_MODE_FLUSH;
- }
-
cvox.LiveRegions.pageLoadTime = pageLoadTime;
if (disableSpeak || !document.hasFocus()) {
@@ -109,8 +105,8 @@ cvox.LiveRegions.init = function(pageLoadTime, queueMode, disableSpeak) {
false,
false,
function(assertive, navDescriptions) {
- if (!assertive && queueMode == cvox.AbstractTts.QUEUE_MODE_FLUSH) {
- queueMode = cvox.AbstractTts.QUEUE_MODE_QUEUE;
+ if (!assertive && queueMode == cvox.QueueMode.FLUSH) {
+ queueMode = cvox.QueueMode.QUEUE;
}
var descSpeaker = new cvox.NavigationSpeaker();
descSpeaker.speakDescriptionArray(navDescriptions, queueMode, null);
diff --git a/chrome/browser/resources/chromeos/chromevox/chromevox/injected/navigation_manager.js b/chrome/browser/resources/chromeos/chromevox/chromevox/injected/navigation_manager.js
index 3fd9ea2..2ec204e 100644
--- a/chrome/browser/resources/chromeos/chromevox/chromevox/injected/navigation_manager.js
+++ b/chrome/browser/resources/chromeos/chromevox/chromevox/injected/navigation_manager.js
@@ -66,7 +66,7 @@ cvox.NavigationManager.prototype.readFrom = function(store) {
this.curSel_.setReversed(store['reversed']);
this.shifter_.readFrom(store);
if (store['keepReading']) {
- this.startReading(cvox.AbstractTts.QUEUE_MODE_FLUSH);
+ this.startReading(cvox.QueueMode.FLUSH);
}
};
@@ -391,7 +391,7 @@ cvox.NavigationManager.prototype.clearPageSel = function(opt_announce) {
var hasSel = !!this.pageSel_;
if (hasSel && opt_announce) {
var announcement = cvox.ChromeVox.msgs.getMsg('clear_page_selection');
- cvox.ChromeVox.tts.speak(announcement, cvox.AbstractTts.QUEUE_MODE_FLUSH,
+ cvox.ChromeVox.tts.speak(announcement, cvox.QueueMode.FLUSH,
cvox.AbstractTts.PERSONALITY_ANNOTATION);
}
this.pageSel_ = null;
@@ -635,7 +635,7 @@ cvox.NavigationManager.prototype.ensureNotSubnavigating = function() {
* Delegates to NavigationSpeaker.
* @param {Array.<cvox.NavDescription>} descriptionArray The array of
* NavDescriptions to speak.
- * @param {number} initialQueueMode The initial queue mode.
+ * @param {cvox.QueueMode} initialQueueMode The initial queue mode.
* @param {Function} completionFunction Function to call when finished speaking.
* @param {Object=} opt_personality Optional personality for all descriptions.
* @param {string=} opt_category Optional category for all descriptions.
@@ -693,7 +693,7 @@ cvox.NavigationManager.prototype.updatePosition = function(node) {
* is spoken to the user.
* @param {boolean=} opt_setFocus Whether or not to focus the current node.
* Defaults to true.
- * @param {number=} opt_queueMode Initial queue mode to use.
+ * @param {cvox.QueueMode=} opt_queueMode Initial queue mode to use.
* @param {function(): ?=} opt_callback Function to call after speaking.
*/
cvox.NavigationManager.prototype.finishNavCommand = function(
@@ -707,7 +707,7 @@ cvox.NavigationManager.prototype.finishNavCommand = function(
if (this.isReversed()) {
msg = cvox.ChromeVox.msgs.getMsg('wrapped_to_bottom');
}
- cvox.ChromeVox.tts.speak(msg, cvox.AbstractTts.QUEUE_MODE_QUEUE,
+ cvox.ChromeVox.tts.speak(msg, cvox.QueueMode.QUEUE,
cvox.AbstractTts.PERSONALITY_ANNOTATION);
}
return;
@@ -727,12 +727,12 @@ cvox.NavigationManager.prototype.finishNavCommand = function(
}
this.updateIndicator();
- var queueMode = opt_queueMode || cvox.AbstractTts.QUEUE_MODE_FLUSH;
+ var queueMode = opt_queueMode || cvox.QueueMode.FLUSH;
if (opt_prefix) {
cvox.ChromeVox.tts.speak(
opt_prefix, queueMode, cvox.AbstractTts.PERSONALITY_ANNOTATION);
- queueMode = cvox.AbstractTts.QUEUE_MODE_QUEUE;
+ queueMode = cvox.QueueMode.QUEUE;
}
this.speakDescriptionArray(descriptionArray,
queueMode,
@@ -802,7 +802,7 @@ cvox.NavigationManager.prototype.skip = function() {
if (cvox.ChromeVox.host.hasTtsCallback()) {
this.skipped_ = true;
this.setReversed(false);
- this.startCallbackReading_(cvox.AbstractTts.QUEUE_MODE_FLUSH);
+ this.startCallbackReading_(cvox.QueueMode.FLUSH);
}
return true;
};
@@ -810,7 +810,7 @@ cvox.NavigationManager.prototype.skip = function() {
/**
* Starts reading the page from the current selection.
- * @param {number} queueMode Either flush or queue.
+ * @param {cvox.QueueMode} queueMode Either flush or queue.
*/
cvox.NavigationManager.prototype.startReading = function(queueMode) {
this.keepReading_ = true;
@@ -848,14 +848,14 @@ cvox.NavigationManager.prototype.isReading = function() {
/**
* Starts reading the page from the current selection if there are callbacks.
- * @param {number} queueMode Either flush or queue.
+ * @param {cvox.QueueMode} queueMode Either flush or queue.
* @private
*/
cvox.NavigationManager.prototype.startCallbackReading_ =
cvox.ChromeVoxEventSuspender.withSuspendedEvents(function(queueMode) {
this.finishNavCommand('', true, queueMode, goog.bind(function() {
if (this.next_(true) && this.keepReading_) {
- this.startCallbackReading_(cvox.AbstractTts.QUEUE_MODE_QUEUE);
+ this.startCallbackReading_(cvox.QueueMode.QUEUE);
}
}, this));
});
@@ -864,7 +864,7 @@ cvox.NavigationManager.prototype.startCallbackReading_ =
/**
* Starts reading the page from the current selection if there are no callbacks.
* With this method, we poll the keepReading_ var and stop when it is false.
- * @param {number} queueMode Either flush or queue.
+ * @param {cvox.QueueMode} queueMode Either flush or queue.
* @private
*/
cvox.NavigationManager.prototype.startNonCallbackReading_ =
diff --git a/chrome/browser/resources/chromeos/chromevox/chromevox/injected/navigation_speaker.js b/chrome/browser/resources/chromeos/chromevox/chromevox/injected/navigation_speaker.js
index 3308de6..70cac8d 100644
--- a/chrome/browser/resources/chromeos/chromevox/chromevox/injected/navigation_speaker.js
+++ b/chrome/browser/resources/chromeos/chromevox/chromevox/injected/navigation_speaker.js
@@ -63,7 +63,7 @@ cvox.NavigationSpeaker.prototype.speakDescriptionArray = function(
}
};
var endCallbackHelper = function() {
- speakDescriptionChain(i + 1, cvox.AbstractTts.QUEUE_MODE_QUEUE, id);
+ speakDescriptionChain(i + 1, cvox.QueueMode.QUEUE, id);
};
var endCallback = function() {
// We process content-script specific properties here for now.
diff --git a/chrome/browser/resources/chromeos/chromevox/chromevox/injected/pdf_processor.js b/chrome/browser/resources/chromeos/chromevox/chromevox/injected/pdf_processor.js
index 1cfa2cc..b6ca6d1 100644
--- a/chrome/browser/resources/chromeos/chromevox/chromevox/injected/pdf_processor.js
+++ b/chrome/browser/resources/chromeos/chromevox/chromevox/injected/pdf_processor.js
@@ -8,6 +8,7 @@
*/
goog.provide('cvox.PdfProcessor');
+goog.require('cvox.QueueMode');
/**
* Process PDFs created with Chrome's built-in PDF plug-in, which has an
@@ -31,7 +32,8 @@ cvox.PdfProcessor.processEmbeddedPdfs = function() {
}
if (!info.copyable) {
cvox.ChromeVox.tts.speak(
- 'Unable to access copy-protected PDF. Skipping.');
+ cvox.ChromeVox.msgs.getMsg('copy_protected_pdf'),
+ cvox.QueueMode.QUEUE);
continue;
}
diff --git a/chrome/browser/resources/chromeos/chromevox/chromevox/injected/ui/overlay_widget.js b/chrome/browser/resources/chromeos/chromevox/chromevox/injected/ui/overlay_widget.js
index 8752b37..d40c7af 100644
--- a/chrome/browser/resources/chromeos/chromevox/chromevox/injected/ui/overlay_widget.js
+++ b/chrome/browser/resources/chromeos/chromevox/chromevox/injected/ui/overlay_widget.js
@@ -77,6 +77,7 @@ cvox.OverlayWidget.prototype.onKeyDown = function(evt) {
}
this.onNavigate();
cvox.ChromeVox.navigationManager.speakDescriptionArray(
- cvox.ChromeVox.navigationManager.getDescription(), 0, null);
+ cvox.ChromeVox.navigationManager.getDescription(),
+ cvox.QueueMode.FLUSH, null);
}
};
diff --git a/chrome/browser/resources/chromeos/chromevox/chromevox/injected/ui/search_widget.js b/chrome/browser/resources/chromeos/chromevox/chromevox/injected/ui/search_widget.js
index 7f50592..479adbc 100644
--- a/chrome/browser/resources/chromeos/chromevox/chromevox/injected/ui/search_widget.js
+++ b/chrome/browser/resources/chromeos/chromevox/chromevox/injected/ui/search_widget.js
@@ -131,7 +131,7 @@ cvox.SearchWidget.prototype.hide = function(opt_noSync) {
cvox.ChromeVox.navigationManager))(true);
cvox.ChromeVox.navigationManager.speakDescriptionArray(
cvox.ChromeVox.navigationManager.getDescription(),
- cvox.AbstractTts.QUEUE_MODE_QUEUE,
+ cvox.QueueMode.QUEUE,
null,
cvox.AbstractTts.PERSONALITY_ANNOUNCEMENT);
@@ -321,10 +321,14 @@ cvox.SearchWidget.prototype.createTextAreaNode_ = function() {
cvox.SearchWidget.prototype.toggleCaseSensitivity_ = function() {
if (this.caseSensitive_) {
cvox.SearchWidget.caseSensitive_ = false;
- cvox.ChromeVox.tts.speak('Ignoring case.', 0, null);
+ cvox.ChromeVox.tts.speak(
+ cvox.ChromeVox.msgs.getMsg('ignoring_case'),
+ cvox.QueueMode.FLUSH, null);
} else {
this.caseSensitive_ = true;
- cvox.ChromeVox.tts.speak('Case sensitive.', 0, null);
+ cvox.ChromeVox.tts.speak(
+ cvox.ChromeVox.msgs.getMsg('case_sensitive'),
+ cvox.QueueMode.FLUSH, null);
}
};
@@ -453,12 +457,12 @@ cvox.SearchWidget.prototype.outputSearchResult_ = function(result, searchStr) {
cvox.ChromeVox.navigationManager.speakDescriptionArray(
result,
- cvox.AbstractTts.QUEUE_MODE_FLUSH,
+ cvox.QueueMode.FLUSH,
null,
cvox.AbstractTts.PERSONALITY_ANNOUNCEMENT);
cvox.ChromeVox.tts.speak(cvox.ChromeVox.msgs.getMsg('search_help_item'),
- cvox.AbstractTts.QUEUE_MODE_QUEUE,
+ cvox.QueueMode.QUEUE,
cvox.AbstractTts.PERSONALITY_ANNOTATION);
// Output to Braille.
diff --git a/chrome/browser/resources/chromeos/chromevox/chromevox/injected/ui/widget.js b/chrome/browser/resources/chromeos/chromevox/chromevox/injected/ui/widget.js
index 3b69a18..da44a57 100644
--- a/chrome/browser/resources/chromeos/chromevox/chromevox/injected/ui/widget.js
+++ b/chrome/browser/resources/chromeos/chromevox/chromevox/injected/ui/widget.js
@@ -116,7 +116,7 @@ cvox.Widget.prototype.hide = function(opt_noSync) {
this.initialNode : this.initialNode.parentNode;
cvox.ApiImplementation.syncToNode(this.initialNode,
true,
- cvox.AbstractTts.QUEUE_MODE_QUEUE);
+ cvox.QueueMode.QUEUE);
}
this.active = false;
diff --git a/chrome/browser/resources/chromeos/chromevox/chromevox/injected/user_commands.js b/chrome/browser/resources/chromeos/chromevox/chromevox/injected/user_commands.js
index 4b37861..2d6bb5a 100644
--- a/chrome/browser/resources/chromeos/chromevox/chromevox/injected/user_commands.js
+++ b/chrome/browser/resources/chromeos/chromevox/chromevox/injected/user_commands.js
@@ -443,7 +443,7 @@ cvox.ChromeVoxUserCommands.doCommand_ = function(cmdStruct) {
cvox.ChromeVox.navigationManager.setGranularity(
cvox.NavigationShifter.GRANULARITIES.OBJECT, true, true);
cvox.ChromeVox.navigationManager.startReading(
- cvox.AbstractTts.QUEUE_MODE_FLUSH);
+ cvox.QueueMode.FLUSH);
break;
case 'cycleTypingEcho':
cvox.ChromeVox.host.sendToBackgroundPage({
@@ -518,16 +518,17 @@ cvox.ChromeVoxUserCommands.doCommand_ = function(cmdStruct) {
}
if (url != '') {
- cvox.ChromeVox.tts.speak(url);
+ cvox.ChromeVox.tts.speak(url, cvox.QueueMode.QUEUE);
} else {
- cvox.ChromeVox.tts.speak(cvox.ChromeVox.msgs.getMsg('no_url_found'));
+ cvox.ChromeVox.tts.speak(cvox.ChromeVox.msgs.getMsg('no_url_found'),
+ cvox.QueueMode.QUEUE);
}
break;
case 'readCurrentTitle':
- cvox.ChromeVox.tts.speak(document.title);
+ cvox.ChromeVox.tts.speak(document.title, cvox.QueueMode.QUEUE);
break;
case 'readCurrentURL':
- cvox.ChromeVox.tts.speak(document.URL);
+ cvox.ChromeVox.tts.speak(document.URL, cvox.QueueMode.QUEUE);
break;
case 'performDefaultAction':
if (cvox.DomPredicates.linkPredicate([document.activeElement])) {
@@ -563,13 +564,14 @@ cvox.ChromeVoxUserCommands.doCommand_ = function(cmdStruct) {
var descs = cvox.ChromeVox.navigationManager.getFullDescription();
cvox.ChromeVox.navigationManager.speakDescriptionArray(
descs,
- cvox.AbstractTts.QUEUE_MODE_FLUSH,
+ cvox.QueueMode.FLUSH,
null);
break;
case 'speakTimeAndDate':
var dateTime = new Date();
cvox.ChromeVox.tts.speak(
- dateTime.toLocaleTimeString() + ', ' + dateTime.toLocaleDateString());
+ dateTime.toLocaleTimeString() + ', ' + dateTime.toLocaleDateString(),
+ cvox.QueueMode.QUEUE);
break;
case 'toggleSelection':
var selState = cvox.ChromeVox.navigationManager.togglePageSel();
@@ -664,7 +666,7 @@ cvox.ChromeVoxUserCommands.doCommand_ = function(cmdStruct) {
case 'passThroughMode':
cvox.ChromeVox.passThroughMode = true;
cvox.ChromeVox.tts.speak(
- cvox.ChromeVox.msgs.getMsg('pass_through_key'));
+ cvox.ChromeVox.msgs.getMsg('pass_through_key'), cvox.QueueMode.QUEUE);
break;
case 'toggleSearchWidget':
cvox.SearchWidget.getInstance().toggle();
@@ -703,7 +705,7 @@ cvox.ChromeVoxUserCommands.doCommand_ = function(cmdStruct) {
} else {
cvox.ChromeVox.tts.speak(
cvox.ChromeVox.msgs.getMsg('no_long_desc'),
- cvox.AbstractTts.QUEUE_MODE_FLUSH,
+ cvox.QueueMode.FLUSH,
cvox.AbstractTts.PERSONALITY_ANNOTATION);
}
break;
@@ -722,9 +724,11 @@ cvox.ChromeVoxUserCommands.doCommand_ = function(cmdStruct) {
// Math specific commands.
case 'toggleSemantics':
if (cvox.TraverseMath.toggleSemantic()) {
- cvox.ChromeVox.tts.speak(cvox.ChromeVox.msgs.getMsg('semantics_on'));
+ cvox.ChromeVox.tts.speak(cvox.ChromeVox.msgs.getMsg('semantics_on'),
+ cvox.QueueMode.QUEUE);
} else {
- cvox.ChromeVox.tts.speak(cvox.ChromeVox.msgs.getMsg('semantics_off'));
+ cvox.ChromeVox.tts.speak(cvox.ChromeVox.msgs.getMsg('semantics_off'),
+ cvox.QueueMode.QUEUE);
}
break;
@@ -760,7 +764,7 @@ cvox.ChromeVoxUserCommands.doCommand_ = function(cmdStruct) {
if (errorMsg != '') {
cvox.ChromeVox.tts.speak(
cvox.ChromeVox.msgs.getMsg(errorMsg),
- cvox.AbstractTts.QUEUE_MODE_FLUSH,
+ cvox.QueueMode.FLUSH,
cvox.AbstractTts.PERSONALITY_ANNOTATION);
} else if (cvox.ChromeVox.navigationManager.isReading()) {
if (cmdStruct.disallowContinuation) {
diff --git a/chrome/browser/resources/chromeos/chromevox/chromevox/messages/spoken_message.js b/chrome/browser/resources/chromeos/chromevox/chromevox/messages/spoken_message.js
index 7e10958..30790ad 100644
--- a/chrome/browser/resources/chromeos/chromevox/chromevox/messages/spoken_message.js
+++ b/chrome/browser/resources/chromeos/chromevox/chromevox/messages/spoken_message.js
@@ -13,7 +13,7 @@ goog.provide('cvox.SpokenMessage');
* @constructor
*/
cvox.SpokenMessage = function() {
- /** @type {?Number} */
+ /** @type {?number} */
this.count = null;
/** @type {Array} */
diff --git a/chrome/browser/resources/chromeos/chromevox/chromevox/messages/spoken_messages.js b/chrome/browser/resources/chromeos/chromevox/chromevox/messages/spoken_messages.js
index 49e2575..ba2c55f 100644
--- a/chrome/browser/resources/chromeos/chromevox/chromevox/messages/spoken_messages.js
+++ b/chrome/browser/resources/chromeos/chromevox/chromevox/messages/spoken_messages.js
@@ -30,19 +30,19 @@ cvox.SpokenMessages.messages = [];
* Speaks the message chain and interrupts any on-going speech.
*/
cvox.SpokenMessages.speakFlush = function() {
- cvox.SpokenMessages.speak(cvox.AbstractTts.QUEUE_MODE_FLUSH);
+ cvox.SpokenMessages.speak(cvox.QueueMode.FLUSH);
};
/**
* Speaks the message chain after on-going speech finishes.
*/
cvox.SpokenMessages.speakQueued = function() {
- cvox.SpokenMessages.speak(cvox.AbstractTts.QUEUE_MODE_QUEUE);
+ cvox.SpokenMessages.speak(cvox.QueueMode.QUEUE);
};
/**
* Speak the message chain.
- * @param {number} mode The speech queue mode.
+ * @param {cvox.QueueMode} mode The speech queue mode.
*/
cvox.SpokenMessages.speak = function(mode) {
for (var i = 0; i < cvox.SpokenMessages.messages.length; ++i) {
@@ -81,16 +81,16 @@ cvox.SpokenMessages.speak = function(mode) {
cvox.AbstractTts.PERSONALITY_ANNOUNCEMENT);
// Always queue after the first message.
- mode = cvox.AbstractTts.QUEUE_MODE_QUEUE;
+ mode = cvox.QueueMode.QUEUE;
}
cvox.SpokenMessages.messages = [];
-}
+};
- /**
- * The newest message.
- * @return {cvox.SpokenMessage} The newest (current) message.
- */
+/**
+ * The newest message.
+ * @return {cvox.SpokenMessage} The newest (current) message.
+ */
cvox.SpokenMessages.currentMessage = function() {
if (cvox.SpokenMessages.messages.length == 0)
throw 'Invalid usage of SpokenMessages; start the chain using $m()';
@@ -102,13 +102,13 @@ cvox.SpokenMessages.currentMessage = function() {
* This will modify the way the message gets read.
* For example, if the count is 2, the message becomes pluralized according
* to our i18n resources. The message "2 links" is a possible output.
- * @param {Number} count Quantifies current message.
+ * @param {number} count Quantifies current message.
* @return {Object} This object, useful for chaining.
*/
cvox.SpokenMessages.withCount = function(count) {
cvox.SpokenMessages.currentMessage().count = count;
return cvox.SpokenMessages;
-}
+};
/**
* Quantifies the current message.
@@ -123,7 +123,7 @@ cvox.SpokenMessages.andIndexTotal = function(index, total) {
newMessage.raw = cvox.ChromeVox.msgs.getMsg('index_total', [index, total]);
cvox.SpokenMessages.messages.push(newMessage);
return cvox.SpokenMessages;
-}
+};
/**
* Ends a message. with an appropriate marker.
@@ -156,7 +156,7 @@ cvox.SpokenMessages.andRawMessage = function(message) {
newMessage.raw = message;
cvox.SpokenMessages.messages.push(newMessage);
return cvox.SpokenMessages;
-}
+};
/**
* Pauses after the message, with an appropriate marker.
@@ -166,4 +166,9 @@ cvox.SpokenMessages.andPause = function() {
return cvox.SpokenMessages.andMessage('pause');
};
+/**
+ * Adds a message.
+ * @param {string|Array} messageId The id of the message.
+ * @return {Object} This object, useful for chaining.
+ */
cvox.$m = cvox.SpokenMessages.andMessage;
diff --git a/chrome/browser/resources/chromeos/chromevox/common/editable_text.js b/chrome/browser/resources/chromeos/chromevox/common/editable_text.js
index 3a4fa0c..5968c61 100644
--- a/chrome/browser/resources/chromeos/chromevox/common/editable_text.js
+++ b/chrome/browser/resources/chromeos/chromevox/common/editable_text.js
@@ -344,9 +344,9 @@ cvox.ChromeVoxEditableTextBase.prototype.speak =
if (this.node && (document.activeElement != this.node)) {
return;
}
- var queueMode = cvox.AbstractTts.QUEUE_MODE_QUEUE;
+ var queueMode = cvox.QueueMode.QUEUE;
if (opt_triggeredByUser === true) {
- queueMode = cvox.AbstractTts.QUEUE_MODE_FLUSH;
+ queueMode = cvox.QueueMode.FLUSH;
}
this.tts.speak(str, queueMode, opt_personality || {});
};
diff --git a/chrome/browser/resources/chromeos/chromevox/common/nav_description.js b/chrome/browser/resources/chromeos/chromevox/common/nav_description.js
index 3dea53a..1a94646 100644
--- a/chrome/browser/resources/chromeos/chromevox/common/nav_description.js
+++ b/chrome/browser/resources/chromeos/chromevox/common/nav_description.js
@@ -14,6 +14,7 @@ goog.provide('cvox.NavDescription');
goog.require('cvox.AbstractTts');
goog.require('cvox.ChromeVox');
goog.require('cvox.CursorSelection');
+goog.require('cvox.QueueMode');
/**
* A class representing the description of navigation from one object to
@@ -90,13 +91,13 @@ cvox.NavDescription.prototype.pushEarcon = function(earconId) {
/**
* Speak this nav description with the given queue mode.
- * @param {number=} queueMode The queue mode: cvox.AbstractTts.QUEUE_MODE_FLUSH
- * for flush, cvox.AbstractTts.QUEUE_MODE_QUEUE for adding to queue.
- * @param {function()=} startCallback Function called when this starts speaking.
- * @param {function()=} endCallback Function called when this ends speaking.
+ * @param {cvox.QueueMode=} queueMode The queue mode.
+ * @param {function()=} opt_startCallback Function called when this
+ * starts speaking.
+ * @param {function()=} opt_endCallback Function called when this ends speaking.
*/
cvox.NavDescription.prototype.speak = function(
- queueMode, startCallback, endCallback) {
+ queueMode, opt_startCallback, opt_endCallback) {
/**
* Return a deep copy of PERSONALITY_ANNOTATION for modifying.
* @return {Object} The newly created properties object.
@@ -113,13 +114,13 @@ cvox.NavDescription.prototype.speak = function(
var speakArgs = new Array();
if (this.context) {
speakArgs.push([this.context, queueMode, makeAnnotationProps()]);
- queueMode = 1;
+ queueMode = cvox.QueueMode.QUEUE;
}
speakArgs.push([this.text,
queueMode,
this.personality ? this.personality : {}]);
- queueMode = 1;
+ queueMode = cvox.QueueMode.QUEUE;
if (this.userValue) {
speakArgs.push([this.userValue, queueMode, {}]);
@@ -135,11 +136,11 @@ cvox.NavDescription.prototype.speak = function(
var length = speakArgs.length;
for (var i = 0; i < length; i++) {
- if (i == 0 && startCallback) {
- speakArgs[i][2]['startCallback'] = startCallback;
+ if (i == 0 && opt_startCallback) {
+ speakArgs[i][2]['startCallback'] = opt_startCallback;
}
- if (i == length - 1 && endCallback) {
- speakArgs[i][2]['endCallback'] = endCallback;
+ if (i == length - 1 && opt_endCallback) {
+ speakArgs[i][2]['endCallback'] = opt_endCallback;
}
if (this.category) {
speakArgs[i][2]['category'] = this.category;
diff --git a/chrome/browser/resources/chromeos/chromevox/common/time_widget.js b/chrome/browser/resources/chromeos/chromevox/common/time_widget.js
index 5fe2ffe..869189d 100644
--- a/chrome/browser/resources/chromeos/chromevox/common/time_widget.js
+++ b/chrome/browser/resources/chromeos/chromevox/common/time_widget.js
@@ -18,7 +18,7 @@ goog.provide('cvox.ChromeVoxHTMLTimeWidget');
* @param {Element} timeElem The time widget element.
* @param {cvox.TtsInterface} tts The TTS object from ChromeVox.
*/
-cvox.ChromeVoxHTMLTimeWidget = function(timeElem, tts){
+cvox.ChromeVoxHTMLTimeWidget = function(timeElem, tts) {
var self = this;
this.timeElem_ = timeElem;
this.timeTts_ = tts;
@@ -31,12 +31,12 @@ cvox.ChromeVoxHTMLTimeWidget = function(timeElem, tts){
this.maxPos_ = 2;
this.keyListener_ = function(evt) {
self.eventHandler_(evt);
- }
+ };
this.blurListener_ = function(evt) {
self.shutdown();
- }
+ };
if (this.timeElem_.hasAttribute('step')) {
- var step = this.timeElem_.getAttribute('step');
+ var step = this.timeElem_.getAttribute('step');
if (step > 0) { // 0 or invalid values show hh:mm AM/PM
if (step >= 1) {
this.maxPos_ = 3; // Anything larger than 1 shows hh:mm:ss AM/PM
@@ -80,24 +80,32 @@ cvox.ChromeVoxHTMLTimeWidget.prototype.shutdown = function() {
this.timeElem_.removeEventListener('keyup', this.keyListener_, false);
};
+/**
+ * Initialize to midnight.
+ * @private
+ */
cvox.ChromeVoxHTMLTimeWidget.prototype.forceInitTime_ = function() {
this.timeElem_.setAttribute('value', '12:00');
};
+/**
+ * Called when the position changes.
+ * @private
+ */
cvox.ChromeVoxHTMLTimeWidget.prototype.handlePosChange_ = function() {
- if (this.pos_ < 0){
+ if (this.pos_ < 0) {
this.pos_ = 0;
}
- if (this.pos_ > this.maxPos_){
+ if (this.pos_ > this.maxPos_) {
this.pos_ = this.maxPos_;
}
// Reset the cached state of the new field so that the field will be spoken
// in the update.
- if (this.pos_ == this.maxPos_){
+ if (this.pos_ == this.maxPos_) {
this.pAmpm_ = '';
return;
}
- switch (this.pos_){
+ switch (this.pos_) {
case 0:
this.pHours_ = -1;
break;
@@ -113,10 +121,13 @@ cvox.ChromeVoxHTMLTimeWidget.prototype.handlePosChange_ = function() {
}
};
-
+/**
+ * @param {boolean} shouldSpeakLabel True if the label should be spoken.
+ * @private
+ */
cvox.ChromeVoxHTMLTimeWidget.prototype.update_ = function(shouldSpeakLabel) {
- var splitTime = this.timeElem_.value.split(":");
- if (splitTime.length < 1){
+ var splitTime = this.timeElem_.value.split(':');
+ if (splitTime.length < 1) {
this.forceInitTime_();
return;
}
@@ -132,7 +143,7 @@ cvox.ChromeVoxHTMLTimeWidget.prototype.update_ = function(shouldSpeakLabel) {
if (splitTime.length > 2) {
var splitSecondsAndMilliseconds = splitTime[2].split('.');
seconds = splitSecondsAndMilliseconds[0];
- if (splitSecondsAndMilliseconds.length > 1){
+ if (splitSecondsAndMilliseconds.length > 1) {
milliseconds = splitSecondsAndMilliseconds[1];
}
}
@@ -184,10 +195,14 @@ cvox.ChromeVoxHTMLTimeWidget.prototype.update_ = function(shouldSpeakLabel) {
}
if (changeMessage.length > 0) {
- this.timeTts_.speak(changeMessage, 0, null);
+ this.timeTts_.speak(changeMessage, cvox.QueueMode.FLUSH, null);
}
};
+/**
+ * @param {Object} evt The event to handle.
+ * @private
+ */
cvox.ChromeVoxHTMLTimeWidget.prototype.eventHandler_ = function(evt) {
var shouldSpeakLabel = false;
if (evt.type == 'keydown') {
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js
index 4bc00e5..03823f0 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js
@@ -189,7 +189,7 @@ cvox2.Background.prototype = {
var output =
[node.attributes.name, node.attributes.value, role].join(', ');
- cvox.ChromeVox.tts.speak(output, cvox.AbstractTts.QUEUE_MODE_FLUSH);
+ cvox.ChromeVox.tts.speak(output, cvox.QueueMode.FLUSH);
cvox.ChromeVox.braille.write(cvox.NavBraille.fromText(output));
chrome.accessibilityPrivate.setFocusRing([evt.target.location]);
diff --git a/chrome/browser/resources/chromeos/chromevox/extensions/searchvox/results.js b/chrome/browser/resources/chromeos/chromevox/extensions/searchvox/results.js
index 3672206..db2799e 100644
--- a/chrome/browser/resources/chromeos/chromevox/extensions/searchvox/results.js
+++ b/chrome/browser/resources/chromeos/chromevox/extensions/searchvox/results.js
@@ -31,11 +31,11 @@ cvox.SearchResults.speakResultBySelectTexts = function(result, selectTexts) {
if (selectText.select) {
var elems = result.querySelectorAll(selectText.select);
for (var i = 0; i < elems.length; i++) {
- cvox.ChromeVox.speakNode(elems.item(i), 1);
+ cvox.ChromeVox.speakNode(elems.item(i), cvox.QueueMode.QUEUE);
}
}
if (selectText.text) {
- cvox.ChromeVox.tts.speak(selectText.text, 1);
+ cvox.ChromeVox.tts.speak(selectText.text, cvox.QueueMode.QUEUE);
}
}
};
@@ -100,8 +100,8 @@ cvox.NormalResult.prototype.speak = function(result) {
var discussTitles = result.querySelectorAll(DISCUSS_TITLE_SELECT);
var discussDates = result.querySelectorAll(DISCUSS_DATE_SELECT);
for (var i = 0; i < discussTitles.length; i++) {
- cvox.ChromeVox.speakNode(discussTitles.item(i), 1);
- cvox.ChromeVox.speakNode(discussDates.item(i), 1);
+ cvox.ChromeVox.speakNode(discussTitles.item(i), cvox.QueueMode.QUEUE);
+ cvox.ChromeVox.speakNode(discussDates.item(i), cvox.QueueMode.QUEUE);
}
return true;
};
@@ -191,7 +191,7 @@ cvox.WeatherResult.prototype.speak = function(result) {
var WEATHER_FORCAST_CLASS = 'wob_df';
var forecasts = result.getElementsByClassName(WEATHER_FORCAST_CLASS);
- cvox.ChromeVox.tts.speak(FORE_INTRO, 1);
+ cvox.ChromeVox.tts.speak(FORE_INTRO, cvox.QueueMode.QUEUE);
for (var i = 0; i < forecasts.length; i++) {
var forecast = forecasts.item(i);
cvox.WeatherResult.speakForecast(forecast);
@@ -226,7 +226,7 @@ cvox.KnowResult.prototype.isType = function(result) {
* @override
*/
cvox.KnowResult.prototype.speak = function(result) {
- cvox.ChromeVox.speakNode(result, 1);
+ cvox.ChromeVox.speakNode(result, cvox.QueueMode.QUEUE);
return true;
};
@@ -404,7 +404,7 @@ cvox.CategoryResult.prototype.speak = function(result) {
}
var LABEL_SELECT = '.rg_bb_label';
var label = result.querySelector(LABEL_SELECT);
- cvox.ChromeVox.speakNode(label, 1);
+ cvox.ChromeVox.speakNode(label, cvox.QueueMode.QUEUE);
return true;
};
diff --git a/chrome/browser/resources/chromeos/chromevox/extensions/searchvox/search.js b/chrome/browser/resources/chromeos/chromevox/extensions/searchvox/search.js
index 7ef10ea..4b53144 100644
--- a/chrome/browser/resources/chromeos/chromevox/extensions/searchvox/search.js
+++ b/chrome/browser/resources/chromeos/chromevox/extensions/searchvox/search.js
@@ -102,9 +102,9 @@ cvox.Search.syncToIndex = function() {
cvox.ChromeVox.tts.stop();
var prop = { endCallback: cvox.Search.speakSync_ };
if (cvox.Search.index === 0) {
- cvox.ChromeVox.tts.speak('First result', 1, prop);
+ cvox.ChromeVox.tts.speak('First result', cvox.QueueMode.QUEUE, prop);
} else if (cvox.Search.index === cvox.Search.results.length - 1) {
- cvox.ChromeVox.tts.speak('Last result', 1, prop);
+ cvox.ChromeVox.tts.speak('Last result', cvox.QueueMode.QUEUE, prop);
} else {
cvox.Search.speakSync_();
}
@@ -173,9 +173,10 @@ cvox.Search.navigatePage = function(next) {
if (url) {
var pageNumber = cvox.Search.getPageNumber(url);
if (!isNaN(pageNumber)) {
- cvox.ChromeVox.tts.speak('Page ' + pageNumber, 0, prop);
+ cvox.ChromeVox.tts.speak('Page ' + pageNumber, cvox.QueueMode.FLUSH,
+ prop);
} else {
- cvox.ChromeVox.tts.speak('Unknown page.', 0, prop);
+ cvox.ChromeVox.tts.speak('Unknown page.', cvox.QueueMode.FLUSH, prop);
}
}
};
@@ -186,11 +187,12 @@ cvox.Search.navigatePage = function(next) {
cvox.Search.goToPane = function() {
var pane = cvox.Search.panes[cvox.Search.paneIndex];
if (pane.className === cvox.Search.SELECTED_PANE_CLASS) {
- cvox.ChromeVox.tts.speak('You are already on that page.');
+ cvox.ChromeVox.tts.speak('You are already on that page.',
+ cvox.QueueMode.QUEUE);
return;
}
var anchor = pane.querySelector('a');
- cvox.ChromeVox.tts.speak(anchor.textContent);
+ cvox.ChromeVox.tts.speak(anchor.textContent, cvox.QueueMode.QUEUE);
var url = cvox.SearchUtil.extractURL(pane);
if (url) {
window.location = url;
diff --git a/chrome/browser/resources/chromeos/chromevox/host/chrome/tts.js b/chrome/browser/resources/chromeos/chromevox/host/chrome/tts.js
index 508938b..6d466a5 100644
--- a/chrome/browser/resources/chromeos/chromevox/host/chrome/tts.js
+++ b/chrome/browser/resources/chromeos/chromevox/host/chrome/tts.js
@@ -107,8 +107,7 @@ cvox.ChromeTts.prototype.addBridgeListener = function() {
/**
* Creates a message suitable for sending as a speak action to background tts.
* @param {string} textString The string of text to be spoken.
- * @param {number=} queueMode The queue mode: cvox.AbstractTts.QUEUE_MODE_FLUSH,
- * for flush, cvox.AbstractTts.QUEUE_MODE_QUEUE for adding to queue.
+ * @param {cvox.QueueMode} queueMode The queue mode.
* @param {Object=} properties Speech properties to use for this utterance.
* @return {Object} A message.
* @private
@@ -132,6 +131,7 @@ cvox.ChromeTts.prototype.createMessageForProperties_ =
message['endCallbackId'] = cvox.ChromeTts.callId++;
}
return message;
- };
+};
+/** @override */
cvox.HostFactory.ttsConstructor = cvox.ChromeTts;
diff --git a/chrome/browser/resources/chromeos/chromevox/host/chrome/tts_background.js b/chrome/browser/resources/chromeos/chromevox/host/chrome/tts_background.js
index 064573d..9886e2f 100644
--- a/chrome/browser/resources/chromeos/chromevox/host/chrome/tts_background.js
+++ b/chrome/browser/resources/chromeos/chromevox/host/chrome/tts_background.js
@@ -218,9 +218,6 @@ cvox.TtsBackground.prototype.speak = function(
if (!properties) {
properties = {};
}
- if (queueMode === undefined) {
- queueMode = cvox.AbstractTts.QUEUE_MODE_QUEUE;
- }
// Chunk to improve responsiveness. Use a replace/split pattern in order to
// retain the original punctuation.
@@ -241,7 +238,7 @@ cvox.TtsBackground.prototype.speak = function(
propertiesCopy['endCallback'] =
i == (splitTextString.length - 1) ? endCallback : null;
this.speak(splitTextString[i], queueMode, propertiesCopy);
- queueMode = cvox.AbstractTts.QUEUE_MODE_QUEUE;
+ queueMode = cvox.QueueMode.QUEUE;
}
return this;
}
@@ -268,7 +265,7 @@ cvox.TtsBackground.prototype.speak = function(
} catch (e) {
}
}
- if (queueMode === cvox.AbstractTts.QUEUE_MODE_FLUSH) {
+ if (queueMode === cvox.QueueMode.FLUSH) {
this.stop();
}
return this;
@@ -280,9 +277,9 @@ cvox.TtsBackground.prototype.speak = function(
mergedProperties['voiceName'] = this.currentVoice;
}
- if (queueMode == cvox.AbstractTts.QUEUE_MODE_CATEGORY_FLUSH &&
+ if (queueMode == cvox.QueueMode.CATEGORY_FLUSH &&
!mergedProperties['category']) {
- queueMode = cvox.AbstractTts.QUEUE_MODE_FLUSH;
+ queueMode = cvox.QueueMode.FLUSH;
}
var utterance = new cvox.Utterance(textString, mergedProperties);
@@ -292,15 +289,15 @@ cvox.TtsBackground.prototype.speak = function(
/**
* Use the speech queue to handle the given speech request.
* @param {cvox.Utterance} utterance The utterance to speak.
- * @param {number} queueMode The queue mode.
+ * @param {cvox.QueueMode} queueMode The queue mode.
* @private
*/
cvox.TtsBackground.prototype.speakUsingQueue_ = function(utterance, queueMode) {
// First, take care of removing the current utterance and flushing
// anything from the queue we need to. If we remove the current utterance,
// make a note that we're going to stop speech.
- if (queueMode == cvox.AbstractTts.QUEUE_MODE_FLUSH ||
- queueMode == cvox.AbstractTts.QUEUE_MODE_CATEGORY_FLUSH) {
+ if (queueMode == cvox.QueueMode.FLUSH ||
+ queueMode == cvox.QueueMode.CATEGORY_FLUSH) {
if (this.shouldCancel_(this.currentUtterance_, utterance, queueMode)) {
this.cancelUtterance_(this.currentUtterance_);
this.currentUtterance_ = null;
@@ -422,7 +419,7 @@ cvox.TtsBackground.prototype.onTtsEvent_ = function(event, utteranceId) {
*
* @param {cvox.Utterance} utteranceToCancel The utterance in question.
* @param {cvox.Utterance} newUtterance The new utterance we're enqueueing.
- * @param {number} queueMode The queue mode.
+ * @param {cvox.QueueMode} queueMode The queue mode.
* @return {boolean} True if this utterance should be canceled.
* @private
*/
@@ -435,11 +432,11 @@ cvox.TtsBackground.prototype.shouldCancel_ =
return false;
}
switch (queueMode) {
- case cvox.AbstractTts.QUEUE_MODE_QUEUE:
+ case cvox.QueueMode.QUEUE:
return false;
- case cvox.AbstractTts.QUEUE_MODE_FLUSH:
+ case cvox.QueueMode.FLUSH:
return true;
- case cvox.AbstractTts.QUEUE_MODE_CATEGORY_FLUSH:
+ case cvox.QueueMode.CATEGORY_FLUSH:
return (utteranceToCancel.properties['category'] ==
newUtterance.properties['category']);
}
@@ -655,7 +652,7 @@ cvox.TtsBackground.prototype.pronouncePhonetically_ = function(text) {
this.clearTimeout_();
var self = this;
this.timeoutId_ = setTimeout(function() {
- self.speak(text, 1);
+ self.speak(text, cvox.QueueMode.QUEUE);
}, cvox.TtsBackground.PHONETIC_DELAY_MS_);
return true;
}
diff --git a/chrome/browser/resources/chromeos/chromevox/host/interface/abstract_tts.js b/chrome/browser/resources/chromeos/chromevox/host/interface/abstract_tts.js
index d17f1cc..ae4346b 100644
--- a/chrome/browser/resources/chromeos/chromevox/host/interface/abstract_tts.js
+++ b/chrome/browser/resources/chromeos/chromevox/host/interface/abstract_tts.js
@@ -420,28 +420,6 @@ cvox.AbstractTts.DEBUG = true;
/**
- * Speech queue mode that interrupts the current utterance.
- * @type {number}
- */
-cvox.AbstractTts.QUEUE_MODE_FLUSH = 0;
-
-
-/**
- * Speech queue mode that does not interrupt the current utterance.
- * @type {number}
- */
-cvox.AbstractTts.QUEUE_MODE_QUEUE = 1;
-
-
-/**
- * Speech queue mode that flushes all utterances of the same category
- * (as set by properties['category']).
- * @type {number}
- */
-cvox.AbstractTts.QUEUE_MODE_CATEGORY_FLUSH = 2;
-
-
-/**
* Character dictionary. These symbols are replaced with their human readable
* equivalents. This replacement only occurs for single character utterances.
* @type {Object.<string, string>}
diff --git a/chrome/browser/resources/chromeos/chromevox/host/interface/tts_interface.js b/chrome/browser/resources/chromeos/chromevox/host/interface/tts_interface.js
index efc98d7..9a1b63d 100644
--- a/chrome/browser/resources/chromeos/chromevox/host/interface/tts_interface.js
+++ b/chrome/browser/resources/chromeos/chromevox/host/interface/tts_interface.js
@@ -9,6 +9,7 @@
*
*/
+goog.provide('cvox.QueueMode');
goog.provide('cvox.TtsCapturingEventListener');
goog.provide('cvox.TtsCategory');
goog.provide('cvox.TtsInterface');
@@ -19,6 +20,7 @@ goog.provide('cvox.TtsInterface');
* category but not other utterances.
*
* NAV: speech related to explicit navigation, or focus changing.
+ * LIVE: speech coming from changes to live regions.
*
* @enum {string}
*/
@@ -28,6 +30,24 @@ cvox.TtsCategory = {
};
/**
+ * Queue modes for calls to {@code cvox.TtsInterface.speak}.
+ * @enum
+ */
+cvox.QueueMode = {
+ /** Stop speech, clear everything, then speak this utterance. */
+ FLUSH: 0,
+
+ /** Append this utterance to the end of the queue. */
+ QUEUE: 1,
+
+ /**
+ * Clear any utterances of the same category (as set by
+ * properties['category']) from the queue, then enqueue this utterance.
+ */
+ CATEGORY_FLUSH: 2
+};
+
+/**
* @interface
* An interface for clients who want to get notified when an utterance
* starts or ends from any source.
@@ -53,8 +73,7 @@ cvox.TtsInterface = function() { };
/**
* Speaks the given string using the specified queueMode and properties.
* @param {string} textString The string of text to be spoken.
- * @param {number=} queueMode The queue mode: cvox.AbstractTts.QUEUE_MODE_FLUSH
- * for flush, cvox.AbstractTts.QUEUE_MODE_QUEUE for adding to queue.
+ * @param {cvox.QueueMode} queueMode The queue mode to use for speaking.
* @param {Object=} properties Speech properties to use for this utterance.
* @return {cvox.TtsInterface} A tts object useful for chaining speak calls.
*/
diff --git a/chrome/browser/resources/chromeos/chromevox/host/testing/tts.js b/chrome/browser/resources/chromeos/chromevox/host/testing/tts.js
index 956cdc4..a16e300 100644
--- a/chrome/browser/resources/chromeos/chromevox/host/testing/tts.js
+++ b/chrome/browser/resources/chromeos/chromevox/host/testing/tts.js
@@ -131,7 +131,7 @@ cvox.TestTts.prototype.getUtteranceList = function() {
/**
* Return a list of strings of what was spoken by tts.speak().
- * @return {Array.<{text: string, queueMode: number}>}
+ * @return {Array.<{text: string, queueMode: cvox.QueueMode}>}
* A list of info about all utterances spoken since
* initialization or the last call to clearUtterances.
*/
diff --git a/chrome/browser/resources/chromeos/chromevox/strings/chromevox_strings.grd b/chrome/browser/resources/chromeos/chromevox/strings/chromevox_strings.grd
index 5ab7528..67c15d2 100644
--- a/chrome/browser/resources/chromeos/chromevox/strings/chromevox_strings.grd
+++ b/chrome/browser/resources/chromeos/chromevox/strings/chromevox_strings.grd
@@ -2464,6 +2464,15 @@
<message desc="Spoken and brailled when the braille captions feature is disabled. This feature shows the braille output in a small overlay on the screen for development and demonstration purposes." name="IDS_CHROMEVOX_BRAILLE_CAPTIONS_DISABLED">
Braille captions disabled.
</message>
+ <message desc="Message displayed and spoken to user if they open a copy-protected PDF and the browser is unable to offer accessible text." name="IDS_CHROMEVOX_COPY_PROTECTED_PDF">
+ Unable to access accessible text from copy-protected PDF.
+ </message>
+ <message desc="Message spoken to user when switching to a mode where searching is not case-sensitive." name="IDS_CHROMEVOX_IGNORING_CASE">
+ Ignoring case.
+ </message>
+ <message desc="Message spoken to user when switching to a mode where searching is case-sensitive." name="IDS_CHROMEVOX_CASE_SENSITIVE">
+ Case sensitive.
+ </message>
</messages>
</release>
</grit>
diff --git a/chrome/browser/resources/chromeos/chromevox/testing/spoken_list_builder.js b/chrome/browser/resources/chromeos/chromevox/testing/spoken_list_builder.js
index 56a7ec0..64bc467 100644
--- a/chrome/browser/resources/chromeos/chromevox/testing/spoken_list_builder.js
+++ b/chrome/browser/resources/chromeos/chromevox/testing/spoken_list_builder.js
@@ -7,7 +7,7 @@
*/
goog.provide('cvox.SpokenListBuilder');
-
+goog.require('cvox.QueueMode');
/**
@@ -25,7 +25,7 @@ cvox.SpokenListBuilder = function() {
* @return {cvox.SpokenListBuilder} this.
*/
cvox.SpokenListBuilder.prototype.flush = function(expectedText) {
- this.list_.push([expectedText, cvox.AbstractTts.QUEUE_MODE_FLUSH]);
+ this.list_.push([expectedText, cvox.QueueMode.FLUSH]);
return this; // for chaining
};
@@ -36,7 +36,7 @@ cvox.SpokenListBuilder.prototype.flush = function(expectedText) {
* @return {cvox.SpokenListBuilder} this.
*/
cvox.SpokenListBuilder.prototype.queue = function(expectedText) {
- this.list_.push([expectedText, cvox.AbstractTts.QUEUE_MODE_QUEUE]);
+ this.list_.push([expectedText, cvox.QueueMode.QUEUE]);
return this; // for chaining
};
@@ -47,7 +47,7 @@ cvox.SpokenListBuilder.prototype.queue = function(expectedText) {
* @return {cvox.SpokenListBuilder} this.
*/
cvox.SpokenListBuilder.prototype.categoryFlush = function(expectedText) {
- this.list_.push([expectedText, cvox.AbstractTts.QUEUE_MODE_CATEGORY_FLUSH]);
+ this.list_.push([expectedText, cvox.QueueMode.CATEGORY_FLUSH]);
return this; // for chaining
};
diff --git a/chrome/browser/resources/chromeos/chromevox/testing/tester.js b/chrome/browser/resources/chromeos/chromevox/testing/tester.js
index ed5f67d..1f226bd 100644
--- a/chrome/browser/resources/chromeos/chromevox/testing/tester.js
+++ b/chrome/browser/resources/chromeos/chromevox/testing/tester.js
@@ -11,6 +11,7 @@ goog.require('cvox.ChromeVoxUserCommands');
goog.require('cvox.LiveRegions');
goog.require('cvox.NavigationManager');
goog.require('cvox.NavigationShifter');
+goog.require('cvox.QueueMode');
goog.require('cvox.TestHost');
goog.require('cvox.TestMathJax');
goog.require('cvox.TestMsgs');
@@ -48,7 +49,7 @@ cvox.ChromeVoxTester.setUp = function(doc) {
// Init LiveRegions with a date of 0 so that the initial delay before
// things is spoken is skipped.
- cvox.LiveRegions.init(new Date(0), cvox.AbstractTts.QUEUE_MODE_QUEUE, false);
+ cvox.LiveRegions.init(new Date(0), cvox.QueueMode.QUEUE, false);
cvox.ChromeVoxEventWatcher.init(doc);
window.console.log('done setup');
@@ -115,7 +116,7 @@ cvox.ChromeVoxTester.setStrategy = function(strategy) {
*/
cvox.ChromeVoxTester.readFromHere = function() {
cvox.ChromeVox.navigationManager.startReading(
- cvox.AbstractTts.QUEUE_MODE_FLUSH);
+ cvox.QueueMode.FLUSH);
};
/**
diff --git a/chrome/browser/resources/chromeos/chromevox/walkers/table_walker.js b/chrome/browser/resources/chromeos/chromevox/walkers/table_walker.js
index c8b85c07..ba4444e 100644
--- a/chrome/browser/resources/chromeos/chromevox/walkers/table_walker.js
+++ b/chrome/browser/resources/chromeos/chromevox/walkers/table_walker.js
@@ -18,6 +18,7 @@ goog.require('cvox.BrailleUtil');
goog.require('cvox.DescriptionUtil');
goog.require('cvox.DomUtil');
goog.require('cvox.NavDescription');
+goog.require('cvox.QueueMode');
goog.require('cvox.TraverseTable');
/**
@@ -204,7 +205,7 @@ cvox.TableWalker.prototype.nextCol = function(sel) {
*/
cvox.TableWalker.prototype.announceHeaders = function(sel) {
cvox.ChromeVox.tts.speak(this.getHeaderText_(sel),
- cvox.AbstractTts.QUEUE_MODE_FLUSH,
+ cvox.QueueMode.FLUSH,
cvox.AbstractTts.PERSONALITY_ANNOTATION);
return sel;
};
@@ -217,7 +218,7 @@ cvox.TableWalker.prototype.announceHeaders = function(sel) {
cvox.TableWalker.prototype.speakTableLocation = function(sel) {
cvox.ChromeVox.navigationManager.speakDescriptionArray(
this.getLocationDescription_(sel),
- cvox.AbstractTts.QUEUE_MODE_FLUSH,
+ cvox.QueueMode.FLUSH,
null);
return sel;
};