Commit 4a15dd66 authored by Katie D's avatar Katie D Committed by Commit Bot

Select-to-Speak should only use voices with required event types.

Some voices are missing callbacks Select-to-Speak needs. Those voices
shouldn't be displayed to the user in Select-to-Speak settings, or
available from select-to-speak at all.

Bug: 822440
Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation
Change-Id: If998f430fcc0854052b7d9bb1ed89c41b0069fb8
Reviewed-on: https://chromium-review.googlesource.com/967266Reviewed-by: default avatarDavid Tseng <dtseng@chromium.org>
Commit-Queue: Katie Dektar <katie@chromium.org>
Cr-Commit-Position: refs/heads/master@{#544093}
parent 9404868d
...@@ -944,9 +944,15 @@ SelectToSpeak.prototype = { ...@@ -944,9 +944,15 @@ SelectToSpeak.prototype = {
if (voices.length == 0) if (voices.length == 0)
return; return;
voices.forEach((function(voice) { voices.forEach((voice) => {
if (!voice.eventTypes.includes('start') ||
!voice.eventTypes.includes('end') ||
!voice.eventTypes.includes('word') ||
!voice.eventTypes.includes('cancelled')) {
return;
}
this.validVoiceNames_.add(voice.voiceName); this.validVoiceNames_.add(voice.voiceName);
}).bind(this)); });
voices.sort(function(a, b) { voices.sort(function(a, b) {
function score(voice) { function score(voice) {
......
...@@ -96,6 +96,13 @@ SelectToSpeakOptionsPage.prototype = { ...@@ -96,6 +96,13 @@ SelectToSpeakOptionsPage.prototype = {
voices.forEach(function(voice) { voices.forEach(function(voice) {
if (!voice.voiceName) if (!voice.voiceName)
return; return;
if (!voice.eventTypes.includes('start') ||
!voice.eventTypes.includes('end') ||
!voice.eventTypes.includes('word') ||
!voice.eventTypes.includes('cancelled')) {
// Required event types for Select-to-Speak.
return;
}
var option = document.createElement('option'); var option = document.createElement('option');
option.voiceName = voice.voiceName; option.voiceName = voice.voiceName;
option.innerText = option.voiceName; option.innerText = option.voiceName;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment