Chromium Code Reviews| 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()); |