Commit c99b8a2c authored by dmazzoni@chromium.org's avatar dmazzoni@chromium.org

Allow spoken feedback to be routed to TTS extensions, not just built-in TTS.

BUG=140248
TEST=Install pkidpnnapnfgjhfhkpmjpbckkbaodldb from the web store, wait for it to finish downloading voice data, then turn speech feedback on/off with Ctrl+Alt+Z and you should hear the high-quality voice.
TBR=derat
Review URL: https://chromiumcodereview.appspot.com/10850018

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@150089 0039d316-1c4b-4281-b951-d872f2087c98
parent 9b3bdfcd
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/speech/extension_api/tts_extension_api_platform.h" #include "chrome/browser/speech/extension_api/tts_extension_api_controller.h"
#include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_messages.h" #include "chrome/common/extensions/extension_messages.h"
#include "chrome/common/extensions/extension_resource.h" #include "chrome/common/extensions/extension_resource.h"
...@@ -197,13 +197,19 @@ void ToggleSpokenFeedback(content::WebUI* login_web_ui) { ...@@ -197,13 +197,19 @@ void ToggleSpokenFeedback(content::WebUI* login_web_ui) {
EnableSpokenFeedback(spoken_feedback_enabled, login_web_ui); EnableSpokenFeedback(spoken_feedback_enabled, login_web_ui);
}; };
void Speak(const std::string& utterance) { void Speak(const std::string& text) {
UtteranceContinuousParameters params; UtteranceContinuousParameters params;
ExtensionTtsPlatformImpl::GetInstance()->Speak(
-1, // No utterance ID because we don't need a callback when it finishes. Profile* profile = ProfileManager::GetDefaultProfile();
utterance.c_str(), Utterance* utterance = new Utterance(profile);
g_browser_process->GetApplicationLocale(), utterance->set_text(text);
params); utterance->set_lang(g_browser_process->GetApplicationLocale());
utterance->set_continuous_parameters(params);
utterance->set_can_enqueue(false);
utterance->set_options(new DictionaryValue());
ExtensionTtsController* controller = ExtensionTtsController::GetInstance();
controller->SpeakOrEnqueue(utterance);
} }
bool IsSpokenFeedbackEnabled() { bool IsSpokenFeedbackEnabled() {
......
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