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

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

Issue 15108002: Add Pause and Resume to Web TTS & Extension TTS APIs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix typo 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
Index: chrome/browser/speech/tts_linux.cc
diff --git a/chrome/browser/speech/tts_linux.cc b/chrome/browser/speech/tts_linux.cc
index 9ab9fe85ef25f735b99481ad4f51b815511627c6..f2f488f9ef16966235ef8124cce502a02271e32d 100644
--- a/chrome/browser/speech/tts_linux.cc
+++ b/chrome/browser/speech/tts_linux.cc
@@ -30,6 +30,8 @@ class TtsPlatformImplLinux : public TtsPlatformImpl {
const VoiceData& voice,
const UtteranceContinuousParameters& params) OVERRIDE;
virtual bool StopSpeaking() OVERRIDE;
+ virtual void Pause() OVERRIDE;
+ virtual void Resume() OVERRIDE;
virtual bool IsSpeaking() OVERRIDE;
virtual void GetVoices(std::vector<VoiceData>* out_voices) OVERRIDE;
@@ -179,6 +181,18 @@ bool TtsPlatformImplLinux::StopSpeaking() {
return true;
}
+void TtsPlatformImplLinux::Pause() {
+ if (!PlatformImplAvailable())
+ return;
+ libspeechd_loader_.spd_pause(conn_);
David Tseng 2013/05/13 21:22:48 Any issues with calling pause (or resume) repeated
dmazzoni 2013/05/14 16:50:27 The Linux speech dispatcher is the only one that a
+}
+
+void TtsPlatformImplLinux::Resume() {
+ if (!PlatformImplAvailable())
+ return;
+ libspeechd_loader_.spd_resume(conn_);
+}
+
bool TtsPlatformImplLinux::IsSpeaking() {
return current_notification_ == SPD_EVENT_BEGIN;
}
@@ -195,20 +209,27 @@ void TtsPlatformImplLinux::GetVoices(
voice.events.insert(TTS_EVENT_END);
voice.events.insert(TTS_EVENT_CANCELLED);
voice.events.insert(TTS_EVENT_MARKER);
+ voice.events.insert(TTS_EVENT_PAUSE);
+ voice.events.insert(TTS_EVENT_RESUME);
}
void TtsPlatformImplLinux::OnSpeechEvent(SPDNotificationType type) {
TtsController* controller = TtsController::GetInstance();
switch (type) {
case SPD_EVENT_BEGIN:
- case SPD_EVENT_RESUME:
controller->OnTtsEvent(utterance_id_, TTS_EVENT_START, 0, std::string());
break;
+ case SPD_EVENT_RESUME:
+ controller->OnTtsEvent(utterance_id_, TTS_EVENT_RESUME, 0, std::string());
+ break;
case SPD_EVENT_END:
- case SPD_EVENT_PAUSE:
controller->OnTtsEvent(
utterance_id_, TTS_EVENT_END, utterance_.size(), std::string());
break;
+ case SPD_EVENT_PAUSE:
+ controller->OnTtsEvent(
+ utterance_id_, TTS_EVENT_PAUSE, utterance_.size(), std::string());
+ break;
case SPD_EVENT_CANCEL:
controller->OnTtsEvent(
utterance_id_, TTS_EVENT_CANCELLED, 0, std::string());

Powered by Google App Engine
This is Rietveld 408576698