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

Unified Diff: chrome/browser/resources/chromeos/chromevox/host/chrome/tts_background.js

Issue 1277183003: Add ChromeVox panel and implement caption display functionality. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix GN build Created 5 years, 1 month 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/host/chrome/tts_background.js
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 7edb872033b500ae200773dd974243c09840b6f0..a70c7588cfb8a8d0056ddb0454c22cc17adf56e2 100644
--- a/chrome/browser/resources/chromeos/chromevox/host/chrome/tts_background.js
+++ b/chrome/browser/resources/chromeos/chromevox/host/chrome/tts_background.js
@@ -10,6 +10,7 @@
goog.provide('cvox.TtsBackground');
+goog.require('PanelCommand');
goog.require('cvox.AbstractTts');
goog.require('cvox.ChromeTtsBase');
goog.require('cvox.ChromeVox');
@@ -301,6 +302,9 @@ cvox.TtsBackground.prototype.speakUsingQueue_ = function(utterance, queueMode) {
// make a note that we're going to stop speech.
if (queueMode == cvox.QueueMode.FLUSH ||
queueMode == cvox.QueueMode.CATEGORY_FLUSH) {
+ (new PanelCommand(
+ PanelCommandType.CLEAR_SPEECH)).send();
+
if (this.shouldCancel_(this.currentUtterance_, utterance, queueMode)) {
this.cancelUtterance_(this.currentUtterance_);
this.currentUtterance_ = null;
@@ -320,6 +324,19 @@ cvox.TtsBackground.prototype.speakUsingQueue_ = function(utterance, queueMode) {
// Next, add the new utterance to the queue.
this.utteranceQueue_.push(utterance);
+ // Update the caption panel.
+ if (utterance.properties &&
+ utterance.properties['pitch'] &&
+ utterance.properties['pitch'] < this.ttsProperties['pitch']) {
+ (new PanelCommand(
+ PanelCommandType.ADD_ANNOTATION_SPEECH,
+ utterance.textString)).send();
+ } else {
+ (new PanelCommand(
+ PanelCommandType.ADD_NORMAL_SPEECH,
+ utterance.textString)).send();
+ }
+
// Now start speaking the next item in the queue.
this.startSpeakingNextItemInQueue_();
};
@@ -499,6 +516,7 @@ cvox.TtsBackground.prototype.stop = function() {
this.utteranceQueue_.length = 0;
+ (new PanelCommand(PanelCommandType.CLEAR_SPEECH)).send();
chrome.tts.stop();
};

Powered by Google App Engine
This is Rietveld 408576698