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

Unified Diff: chrome/browser/speech/tts_controller.cc

Issue 188633003: Revert of Eliminate the dependence of tts extension API for tts_controller.cc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 9 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
« no previous file with comments | « chrome/browser/speech/tts_controller.h ('k') | chrome/browser/ui/browser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/speech/tts_controller.cc
diff --git a/chrome/browser/speech/tts_controller.cc b/chrome/browser/speech/tts_controller.cc
index 75d75be4de30c7133b95e49bf05050cf3c50ebef..6d749f3d9f7775a64258a518a8e3d48c2d2d59c0 100644
--- a/chrome/browser/speech/tts_controller.cc
+++ b/chrome/browser/speech/tts_controller.cc
@@ -10,7 +10,13 @@
#include "base/float_util.h"
#include "base/values.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/speech/extension_api/tts_engine_extension_api.h"
+#include "chrome/browser/speech/extension_api/tts_extension_api.h"
#include "chrome/browser/speech/tts_platform.h"
+#include "chrome/common/extensions/api/speech/tts_engine_manifest_handler.h"
+#include "extensions/browser/extension_system.h"
+#include "extensions/common/extension.h"
namespace {
// A value to be used to indicate that there is no char index available.
@@ -114,8 +120,7 @@
TtsController::TtsController()
: current_utterance_(NULL),
paused_(false),
- platform_impl_(NULL),
- tts_engine_delegate_(NULL) {
+ platform_impl_(NULL) {
}
TtsController::~TtsController() {
@@ -167,9 +172,6 @@
if (native_voices.empty() && !voices.empty()) {
// TODO(dtseng): Notify extension caller of an error.
utterance->set_voice_name("");
- // TODO(gaochun): Replace the global variable g_browser_process with
- // GetContentClient()->browser() to eliminate the dependency of browser
- // once TTS implementation was moved to content.
utterance->set_lang(g_browser_process->GetApplicationLocale());
index = GetMatchingVoice(utterance, voices);
@@ -190,8 +192,7 @@
DCHECK(!voice.extension_id.empty());
current_utterance_ = utterance;
utterance->set_extension_id(voice.extension_id);
- if (tts_engine_delegate_)
- tts_engine_delegate_->Speak(utterance, voice);
+ ExtensionTtsEngineSpeak(utterance, voice);
bool sends_end_event =
voice.events.find(TTS_EVENT_END) != voice.events.end();
if (!sends_end_event) {
@@ -236,8 +237,7 @@
paused_ = false;
if (current_utterance_ && !current_utterance_->extension_id().empty()) {
#if !defined(OS_ANDROID)
- if (tts_engine_delegate_)
- tts_engine_delegate_->Stop(current_utterance_);
+ ExtensionTtsEngineStop(current_utterance_);
#endif
} else {
GetPlatformImpl()->clear_error();
@@ -255,8 +255,7 @@
paused_ = true;
if (current_utterance_ && !current_utterance_->extension_id().empty()) {
#if !defined(OS_ANDROID)
- if (tts_engine_delegate_)
- tts_engine_delegate_->Pause(current_utterance_);
+ ExtensionTtsEnginePause(current_utterance_);
#endif
} else if (current_utterance_) {
GetPlatformImpl()->clear_error();
@@ -268,8 +267,7 @@
paused_ = false;
if (current_utterance_ && !current_utterance_->extension_id().empty()) {
#if !defined(OS_ANDROID)
- if (tts_engine_delegate_)
- tts_engine_delegate_->Resume(current_utterance_);
+ ExtensionTtsEngineResume(current_utterance_);
#endif
} else if (current_utterance_) {
GetPlatformImpl()->clear_error();
@@ -300,8 +298,8 @@
void TtsController::GetVoices(Profile* profile,
std::vector<VoiceData>* out_voices) {
#if !defined(OS_ANDROID)
- if (profile && tts_engine_delegate_)
- tts_engine_delegate_->GetVoices(profile, out_voices);
+ if (profile)
+ GetExtensionVoices(profile, out_voices);
#endif
TtsPlatformImpl* platform_impl = GetPlatformImpl();
@@ -443,8 +441,3 @@
VoicesChangedDelegate* delegate) {
voices_changed_delegates_.erase(delegate);
}
-
-void TtsController::SetTtsEngineDelegate(
- TtsEngineDelegate* delegate) {
- tts_engine_delegate_ = delegate;
-}
« no previous file with comments | « chrome/browser/speech/tts_controller.h ('k') | chrome/browser/ui/browser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698