Chromium Code Reviews| Index: content/browser/speech/input_tag_speech_dispatcher_host.h |
| diff --git a/content/browser/speech/input_tag_speech_dispatcher_host.h b/content/browser/speech/input_tag_speech_dispatcher_host.h |
| index 95bd252f4baa9169a95e5859824a1704bfbe46cb..e66531d8133d0da784b0eef401c19d46b1901556 100644 |
| --- a/content/browser/speech/input_tag_speech_dispatcher_host.h |
| +++ b/content/browser/speech/input_tag_speech_dispatcher_host.h |
| @@ -8,6 +8,7 @@ |
| #include "base/memory/scoped_ptr.h" |
| #include "content/common/content_export.h" |
| #include "content/public/browser/browser_message_filter.h" |
| +#include "content/public/browser/speech_recognition_event_listener.h" |
| #include "net/url_request/url_request_context_getter.h" |
| struct InputTagSpeechHostMsg_StartRecognition_Params; |
| @@ -17,32 +18,37 @@ class SpeechRecognitionPreferences; |
| struct SpeechRecognitionResult; |
| } |
| -namespace media { |
| -class AudioManager; |
| -} |
| - |
| namespace speech { |
| class SpeechRecognitionManagerImpl; |
| // InputTagSpeechDispatcherHost is a delegate for Speech API messages used by |
| -// RenderMessageFilter. |
| -// It's the complement of InputTagSpeechDispatcher (owned by RenderView). |
| +// RenderMessageFilter. Basically it acts as a proxy, relaying the events coming |
| +// from the SpeechRecognitionManager to IPC messages (and viceversa). |
|
Satish
2012/04/23 10:25:17
viceversa -> vice versa
Primiano Tucci (use gerrit)
2012/04/23 12:52:25
Done.
|
| +// It's the complement of SpeechRecognitionDispatcher (owned by RenderView). |
| class CONTENT_EXPORT InputTagSpeechDispatcherHost |
| - : public content::BrowserMessageFilter { |
| + : public content::BrowserMessageFilter, |
| + public content::SpeechRecognitionEventListener { |
| public: |
| - class Sessions; |
| - |
| InputTagSpeechDispatcherHost( |
| int render_process_id, |
| - net::URLRequestContextGetter* context_getter, |
| + net::URLRequestContextGetter* url_request_context_getter, |
| content::SpeechRecognitionPreferences* recognition_preferences); |
| - // Methods called by SpeechRecognitionManagerImpl. |
| - void SetRecognitionResult(int session_id, |
| - const content::SpeechRecognitionResult& result); |
| - void DidCompleteRecording(int session_id); |
| - void DidCompleteRecognition(int session_id); |
| + // SpeechRecognitionEventListener methods. |
| + virtual void OnRecognitionStart(int session_id) OVERRIDE; |
| + virtual void OnAudioStart(int session_id) OVERRIDE; |
| + virtual void OnEnvironmentEstimationComplete(int session_id) OVERRIDE; |
| + virtual void OnSoundStart(int session_id) OVERRIDE; |
| + virtual void OnSoundEnd(int session_id) OVERRIDE; |
| + virtual void OnAudioEnd(int session_id) OVERRIDE; |
| + virtual void OnRecognitionEnd(int session_id) OVERRIDE; |
| + virtual void OnRecognitionResult( |
| + int session_id, const content::SpeechRecognitionResult& result) OVERRIDE; |
| + virtual void OnRecognitionError( |
| + int session_id, const content::SpeechRecognitionError& error) OVERRIDE; |
| + virtual void OnAudioLevelsChange( |
| + int session_id, float volume, float noise_volume) OVERRIDE; |
| // content::BrowserMessageFilter implementation. |
| virtual bool OnMessageReceived(const IPC::Message& message, |
| @@ -58,6 +64,7 @@ class CONTENT_EXPORT InputTagSpeechDispatcherHost |
| const InputTagSpeechHostMsg_StartRecognition_Params ¶ms); |
| void OnCancelRecognition(int render_view_id, int request_id); |
| void OnStopRecording(int render_view_id, int request_id); |
| + void LookupContext(int session_id, int* render_view_id, int* request_id); |
| // Returns the speech recognition manager to forward events to, creating one |
| // if needed. |
| @@ -66,7 +73,7 @@ class CONTENT_EXPORT InputTagSpeechDispatcherHost |
| int render_process_id_; |
| bool may_have_pending_requests_; // Set if we received any speech IPC request |
| - scoped_refptr<net::URLRequestContextGetter> context_getter_; |
| + scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; |
| scoped_refptr<content::SpeechRecognitionPreferences> recognition_preferences_; |
| static SpeechRecognitionManagerImpl* manager_; |