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

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

Issue 15012027: Android implementation of text-to-speech code for Web Speech Synthesis API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@tts_multivoice
Patch Set: Fix clang error Created 7 years, 7 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_message_filter.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/speech/tts_message_filter.cc
diff --git a/chrome/browser/speech/tts_message_filter.cc b/chrome/browser/speech/tts_message_filter.cc
index fb6bb2829ebfe1fc016649ea01cba0cc0ef3b1c5..c7dec7a420b9013a0580cfaa96e3a75dfac3b450 100644
--- a/chrome/browser/speech/tts_message_filter.cc
+++ b/chrome/browser/speech/tts_message_filter.cc
@@ -17,9 +17,7 @@ using content::BrowserThread;
TtsMessageFilter::TtsMessageFilter(int render_process_id, Profile* profile)
: render_process_id_(render_process_id),
profile_(profile) {
-}
-
-TtsMessageFilter::~TtsMessageFilter() {
+ TtsController::GetInstance()->AddVoicesChangedDelegate(this);
}
void TtsMessageFilter::OverrideThreadForMessage(
@@ -36,7 +34,7 @@ void TtsMessageFilter::OverrideThreadForMessage(
}
bool TtsMessageFilter::OnMessageReceived(const IPC::Message& message,
- bool* message_was_ok) {
+ bool* message_was_ok) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP_EX(TtsMessageFilter, message, *message_was_ok)
IPC_MESSAGE_HANDLER(TtsHostMsg_InitializeVoiceList, OnInitializeVoiceList)
@@ -49,6 +47,10 @@ bool TtsMessageFilter::OnMessageReceived(const IPC::Message& message,
return handled;
}
+void TtsMessageFilter::OnChannelClosing() {
+ TtsController::GetInstance()->RemoveVoicesChangedDelegate(this);
+}
+
void TtsMessageFilter::OnInitializeVoiceList() {
TtsController* tts_controller = TtsController::GetInstance();
std::vector<VoiceData> voices;
@@ -130,3 +132,10 @@ void TtsMessageFilter::OnTtsEvent(Utterance* utterance,
break;
}
}
+
+void TtsMessageFilter::OnVoicesChanged() {
+ OnInitializeVoiceList();
+}
+
+TtsMessageFilter::~TtsMessageFilter() {
+}
« no previous file with comments | « chrome/browser/speech/tts_message_filter.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698