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

Unified Diff: content/browser/speech/input_tag_speech_dispatcher_host.h

Issue 9972011: Speech refactoring: Reimplemented SpeechRecognitionManagerImpl as a FSM. (CL1.7) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed according to hans and jam review. Created 8 years, 8 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
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..6a7358b3764a8c77645f19b16f603e79b6313cef 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 vice versa).
+// 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,
@@ -66,7 +72,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_;

Powered by Google App Engine
This is Rietveld 408576698