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

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: Rebase 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_controller_unittest.cc ('k') | chrome/browser/speech/tts_mac.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/speech/tts_linux.cc
diff --git a/chrome/browser/speech/tts_linux.cc b/chrome/browser/speech/tts_linux.cc
index 83e1e2778f050a7730ad15b7c015db1222e173de..0a61373cca1da8ac13002634ca65e291955b5e8f 100644
--- a/chrome/browser/speech/tts_linux.cc
+++ b/chrome/browser/speech/tts_linux.cc
@@ -38,6 +38,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;
@@ -198,6 +200,18 @@ bool TtsPlatformImplLinux::StopSpeaking() {
return true;
}
+void TtsPlatformImplLinux::Pause() {
+ if (!PlatformImplAvailable())
+ return;
+ libspeechd_loader_.spd_pause(conn_);
+}
+
+void TtsPlatformImplLinux::Resume() {
+ if (!PlatformImplAvailable())
+ return;
+ libspeechd_loader_.spd_resume(conn_);
+}
+
bool TtsPlatformImplLinux::IsSpeaking() {
return current_notification_ == SPD_EVENT_BEGIN;
}
@@ -247,6 +261,8 @@ 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);
}
}
@@ -254,14 +270,19 @@ 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());
« no previous file with comments | « chrome/browser/speech/tts_controller_unittest.cc ('k') | chrome/browser/speech/tts_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698