Chromium Code Reviews| Index: content/browser/speech/speech_recognition_dispatcher_host.h |
| diff --git a/content/browser/speech/speech_recognition_dispatcher_host.h b/content/browser/speech/speech_recognition_dispatcher_host.h |
| index 34b333207e8e51f6dae30d29c513003fb873c947..b46c7f322dcc62e549ab533d4d33017374984712 100644 |
| --- a/content/browser/speech/speech_recognition_dispatcher_host.h |
| +++ b/content/browser/speech/speech_recognition_dispatcher_host.h |
| @@ -8,28 +8,34 @@ |
| #include "base/memory/scoped_ptr.h" |
| #include "base/memory/weak_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" |
| +#include "content/public/browser/web_contents_observer.h" |
| struct SpeechRecognitionHostMsg_StartRequest_Params; |
| +namespace net { |
| +class URLRequestContextGetter; |
| +} // namespace net |
| + |
| namespace content { |
| class SpeechRecognitionManager; |
| +class WebContents; |
| struct SpeechRecognitionResult; |
| +struct SpeechRecognitionSessionContext; |
| +struct SpeechRecognitionSessionConfig; |
| // SpeechRecognitionDispatcherHost is a delegate for Speech API messages used by |
| -// 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). |
| +// WebContents. 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 RenderFrame). |
| +// It MUST be deleted from the BrowserThread::IO thread. |
| class CONTENT_EXPORT SpeechRecognitionDispatcherHost |
| - : public BrowserMessageFilter, |
| + : public WebContentsObserver, |
|
Charlie Reis
2014/12/01 23:49:43
What benefits are we getting from making this a We
mlamouri (slow - plz ping)
2014/12/08 17:41:04
The only real benefit from using WebContentsObserv
Charlie Reis
2014/12/08 20:02:57
Ah, I see.
Yes, I think we can handle that more c
mlamouri (slow - plz ping)
2014/12/08 21:08:00
Done. I haven't done anything with RenderFrameDele
Charlie Reis
2014/12/09 00:52:33
Is this a bug, though? We're now tracking things
|
| public SpeechRecognitionEventListener { |
| public: |
| - SpeechRecognitionDispatcherHost( |
| - int render_process_id, |
| - net::URLRequestContextGetter* context_getter); |
| + explicit SpeechRecognitionDispatcherHost(WebContents* web_contents); |
| + virtual ~SpeechRecognitionDispatcherHost(); |
| base::WeakPtr<SpeechRecognitionDispatcherHost> AsWeakPtr(); |
| @@ -49,34 +55,30 @@ class CONTENT_EXPORT SpeechRecognitionDispatcherHost |
| float volume, |
| float noise_volume) override; |
| - // BrowserMessageFilter implementation. |
| - void OnDestruct() const override; |
| - bool OnMessageReceived(const IPC::Message& message) override; |
| - void OverrideThreadForMessage(const IPC::Message& message, |
| - BrowserThread::ID* thread) override; |
| - |
| - void OnChannelClosing() override; |
| + // WebContentsObserver implementation. |
| + bool OnMessageReceived(const IPC::Message& message, |
| + RenderFrameHost* render_frame_host) override; |
| + void RenderFrameDeleted(RenderFrameHost* render_frame_host) override; |
| private: |
| - friend class base::DeleteHelper<SpeechRecognitionDispatcherHost>; |
| - friend class BrowserThread; |
| - |
| - ~SpeechRecognitionDispatcherHost() override; |
| - |
| void OnStartRequest( |
| + RenderFrameHost* render_frame_host, |
| const SpeechRecognitionHostMsg_StartRequest_Params& params); |
| - void OnStartRequestOnIO( |
| - int embedder_render_process_id, |
| - int embedder_render_view_id, |
| + void StartSession( |
| const SpeechRecognitionHostMsg_StartRequest_Params& params, |
| - int params_render_frame_id, |
| + const SpeechRecognitionSessionContext& context, |
| + net::URLRequestContextGetter* url_request_context_getter, |
| bool filter_profanities); |
| - void OnAbortRequest(int render_view_id, int request_id); |
| - void OnStopCaptureRequest(int render_view_id, int request_id); |
| - void OnAbortAllRequests(int render_view_id); |
| - |
| - int render_process_id_; |
| - scoped_refptr<net::URLRequestContextGetter> context_getter_; |
| + void OnAbortRequest(RenderFrameHost* render_frame_host, int request_id); |
| + void OnAbortRequestIO(int render_process_id, |
|
Charlie Reis
2014/12/01 23:49:43
nit: AbortRequestOnIO (similar below)
|
| + int render_frame_id, |
| + int request_id); |
| + void OnStopCaptureRequest(RenderFrameHost* render_frame_host, int request_id); |
| + void OnStopCaptureRequestIO(int render_process_id, |
| + int render_frame_id, |
| + int request_id); |
| + void OnAbortAllRequests(RenderFrameHost* render_frame_host); |
| + void OnAbortAllRequestsIO(int render_process_id, int render_frame_id); |
| // Used for posting asynchronous tasks (on the IO thread) without worrying |
| // about this class being destroyed in the meanwhile (due to browser shutdown) |