| Index: chrome/browser/speech/tts_mac.mm
|
| diff --git a/chrome/browser/speech/tts_mac.mm b/chrome/browser/speech/tts_mac.mm
|
| index 689effc7be91c600b7f9dda4c71ba9538c704b8e..b86cf8a24c2948f91e1d80a722ada239f88c9399 100644
|
| --- a/chrome/browser/speech/tts_mac.mm
|
| +++ b/chrome/browser/speech/tts_mac.mm
|
| @@ -63,6 +63,10 @@ class TtsPlatformImplMac : public TtsPlatformImpl {
|
|
|
| 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;
|
| @@ -86,6 +90,7 @@ class TtsPlatformImplMac : public TtsPlatformImpl {
|
| int utterance_id_;
|
| std::string utterance_;
|
| bool sent_start_event_;
|
| + int last_char_index_;
|
|
|
| friend struct DefaultSingletonTraits<TtsPlatformImplMac>;
|
|
|
| @@ -168,6 +173,22 @@ bool TtsPlatformImplMac::StopSpeaking() {
|
| return true;
|
| }
|
|
|
| +void TtsPlatformImplMac::Pause() {
|
| + if (speech_synthesizer_.get() && utterance_id_) {
|
| + [speech_synthesizer_ pauseSpeakingAtBoundary:NSSpeechImmediateBoundary];
|
| + TtsController::GetInstance()->OnTtsEvent(
|
| + utterance_id_, TTS_EVENT_PAUSE, last_char_index_, "");
|
| + }
|
| +}
|
| +
|
| +void TtsPlatformImplMac::Resume() {
|
| + if (speech_synthesizer_.get() && utterance_id_) {
|
| + [speech_synthesizer_ continueSpeaking];
|
| + TtsController::GetInstance()->OnTtsEvent(
|
| + utterance_id_, TTS_EVENT_RESUME, last_char_index_, "");
|
| + }
|
| +}
|
| +
|
| bool TtsPlatformImplMac::IsSpeaking() {
|
| return [NSSpeechSynthesizer isAnyApplicationSpeaking];
|
| }
|
| @@ -223,6 +244,8 @@ void TtsPlatformImplMac::GetVoices(std::vector<VoiceData>* outVoices) {
|
| data.events.insert(TTS_EVENT_ERROR);
|
| data.events.insert(TTS_EVENT_CANCELLED);
|
| data.events.insert(TTS_EVENT_INTERRUPTED);
|
| + data.events.insert(TTS_EVENT_PAUSE);
|
| + data.events.insert(TTS_EVENT_RESUME);
|
| }
|
| }
|
|
|
| @@ -247,6 +270,7 @@ void TtsPlatformImplMac::OnSpeechEvent(
|
| }
|
| controller->OnTtsEvent(
|
| utterance_id_, event_type, char_index, error_message);
|
| + last_char_index_ = char_index;
|
| }
|
|
|
| TtsPlatformImplMac::TtsPlatformImplMac() {
|
|
|