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

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

Issue 955643006: Allows endCallbacks in tts to queue up speech in the speech queue and simplify speech output logic. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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/output.js
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js
index 12181bf79b8c075905d4019a7a733a3e86f44eb4..fd65f4b02db4563eadb8ac6bce258614c390a01f 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js
@@ -56,8 +56,6 @@ Output = function() {
this.speechStartCallback_;
/** @type {function()} */
this.speechEndCallback_;
- /** @type {function()} */
- this.speechInterruptedCallback_;
/**
* Current global options.
@@ -305,40 +303,17 @@ Output.prototype = {
},
/**
- * Triggers callback for a speech event.
- * @param {function()} callback
- */
- onSpeechInterrupted: function(callback) {
- this.speechInterruptedCallback_ = callback;
- return this;
- },
-
- /**
* Executes all specified output.
*/
go: function() {
// Speech.
var buff = this.buffer_;
-
- var onEvent = function(evt) {
- switch (evt.type) {
- case 'start':
- this.speechStartCallback_();
- break;
- case 'end':
- this.speechEndCallback_();
- break;
- case 'interrupted':
- this.speechInterruptedCallback_ && this.speechInterruptedCallback_();
- break;
- }
- }.bind(this);
-
if (buff.toString()) {
- if (this.speechStartCallback_ ||
- this.speechEndCallback_ ||
- this.speechInterruptedCallback_)
- this.speechProperties_['onEvent'] = onEvent;
+ if (this.speechStartCallback_)
+ this.speechProperties_['startCallback'] = this.speechStartCallback_;
+ if (this.speechEndCallback_) {
+ this.speechProperties_['endCallback'] = this.speechEndCallback_;
+ }
cvox.ChromeVox.tts.speak(
buff.toString(), cvox.QueueMode.FLUSH, this.speechProperties_);
@@ -701,7 +676,7 @@ Output.prototype = {
*/
addToSpannable_: function(spannable, value, opt_options) {
opt_options = opt_options || {ifEmpty: false, annotation: undefined};
- if (value.length == 0 && !opt_options.annotation)
+ if ((!value || value.length == 0) && !opt_options.annotation)
return;
var spannableToAdd = new cvox.Spannable(value, opt_options.annotation);

Powered by Google App Engine
This is Rietveld 408576698