 Chromium Code Reviews
 Chromium Code Reviews Issue 636863003:
  Make SpeechRecognition per RenderFrame instead of per RenderView. 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 636863003:
  Make SpeechRecognition per RenderFrame instead of per RenderView. 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| 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..c0081c10f7a59fa0794d9a5f14d7efde71f2d8a1 100644 | 
| --- a/content/browser/speech/speech_recognition_dispatcher_host.h | 
| +++ b/content/browser/speech/speech_recognition_dispatcher_host.h | 
| @@ -10,26 +10,30 @@ | 
| #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 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). | 
| +// BrowserMessageFilter. 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). | 
| class CONTENT_EXPORT SpeechRecognitionDispatcherHost | 
| : public BrowserMessageFilter, | 
| public SpeechRecognitionEventListener { | 
| public: | 
| - SpeechRecognitionDispatcherHost( | 
| - int render_process_id, | 
| - net::URLRequestContextGetter* context_getter); | 
| + explicit SpeechRecognitionDispatcherHost(int render_process_id); | 
| base::WeakPtr<SpeechRecognitionDispatcherHost> AsWeakPtr(); | 
| @@ -51,38 +55,35 @@ class CONTENT_EXPORT SpeechRecognitionDispatcherHost | 
| // BrowserMessageFilter implementation. | 
| void OnDestruct() const override; | 
| - bool OnMessageReceived(const IPC::Message& message) override; | 
| + void OnChannelClosing() override; | 
| void OverrideThreadForMessage(const IPC::Message& message, | 
| BrowserThread::ID* thread) override; | 
| - | 
| - void OnChannelClosing() override; | 
| + bool OnMessageReceived(const IPC::Message& message) override; | 
| private: | 
| friend class base::DeleteHelper<SpeechRecognitionDispatcherHost>; | 
| friend class BrowserThread; | 
| - ~SpeechRecognitionDispatcherHost() override; | 
| + virtual ~SpeechRecognitionDispatcherHost(); | 
| void OnStartRequest( | 
| 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(int request_id, int render_frame_id); | 
| 
Charlie Reis
2014/12/09 00:52:33
Why reverse these parameters?  I would normally ex
 
mlamouri (slow - plz ping)
2015/01/19 11:20:23
Done.
 | 
| + void OnStopCaptureRequest(int request_id, int render_frame_id); | 
| + void OnAbortAllRequests(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) | 
| // since tasks pending on a destroyed WeakPtr are automatically discarded. | 
| base::WeakPtrFactory<SpeechRecognitionDispatcherHost> weak_factory_; | 
| + int render_process_id_; | 
| + | 
| DISALLOW_COPY_AND_ASSIGN(SpeechRecognitionDispatcherHost); | 
| }; |