OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_SPEECH_TTS_DISPATCHER_HOST_IMPL_H_ |
| 6 #define CONTENT_BROWSER_SPEECH_TTS_DISPATCHER_HOST_IMPL_H_ |
| 7 |
| 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "content/common/content_export.h" |
| 10 #include "content/common/tts_messages.h" |
| 11 #include "content/public/browser/browser_message_filter.h" |
| 12 #include "content/public/browser/tts_dispatcher_host.h" |
| 13 |
| 14 namespace content { |
| 15 |
| 16 // TtsDispatcherHost is a delegate for Speech API messages used by |
| 17 // RenderMessageFilter. |
| 18 class CONTENT_EXPORT TtsDispatcherHostImpl |
| 19 : public BrowserMessageFilter, |
| 20 public TtsDispatcherHost { |
| 21 public: |
| 22 TtsDispatcherHostImpl(int render_process_id, |
| 23 BrowserContext* browser_context); |
| 24 |
| 25 virtual BrowserContext* GetBrowserContext() OVERRIDE; |
| 26 |
| 27 // TtsDispatcherHost methods. |
| 28 virtual void DidStartSpeaking(int utterance_id) OVERRIDE; |
| 29 virtual void DidFinishSpeaking(int utterance_id) OVERRIDE; |
| 30 virtual void DidPauseSpeaking(int utterance_id) OVERRIDE; |
| 31 virtual void DidResumeSpeaking(int utterance_id) OVERRIDE; |
| 32 virtual void WordBoundary(int utterance_id, int char_index) OVERRIDE; |
| 33 virtual void SentenceBoundary( |
| 34 int utterance_id, int char_index) OVERRIDE; |
| 35 virtual void MarkerEvent(int utterance_id, int char_index) OVERRIDE; |
| 36 virtual void WasInterrupted(int utterance_id) OVERRIDE; |
| 37 virtual void WasCancelled(int utterance_id) OVERRIDE; |
| 38 virtual void SpeakingErrorOccurred( |
| 39 int utterance_id, const std::string& error_message) OVERRIDE; |
| 40 virtual void SendVoiceList(const std::vector<content::TtsVoice>&) OVERRIDE; |
| 41 |
| 42 // BrowserMessageFilter implementation. |
| 43 virtual bool OnMessageReceived(const IPC::Message& message, |
| 44 bool* message_was_ok) OVERRIDE; |
| 45 |
| 46 private: |
| 47 virtual ~TtsDispatcherHostImpl(); |
| 48 |
| 49 void OnInitializeVoiceList(); |
| 50 void OnSpeak(const TtsUtteranceRequest& utterance); |
| 51 void OnPause(); |
| 52 void OnResume(); |
| 53 void OnCancel(); |
| 54 |
| 55 int render_process_id_; |
| 56 BrowserContext* browser_context_; |
| 57 TtsDispatcherHostDelegate* delegate_; |
| 58 |
| 59 DISALLOW_COPY_AND_ASSIGN(TtsDispatcherHostImpl); |
| 60 }; |
| 61 |
| 62 } // namespace content |
| 63 |
| 64 #endif // CONTENT_BROWSER_SPEECH_TTS_DISPATCHER_HOST_IMPL_H_ |
OLD | NEW |