OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_BROWSER_SPEECH_SPEECH_RECOGNITION_DISPATCHER_HOST_H_ | 5 #ifndef CONTENT_BROWSER_SPEECH_SPEECH_RECOGNITION_DISPATCHER_HOST_H_ |
6 #define CONTENT_BROWSER_SPEECH_SPEECH_RECOGNITION_DISPATCHER_HOST_H_ | 6 #define CONTENT_BROWSER_SPEECH_SPEECH_RECOGNITION_DISPATCHER_HOST_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 // SpeechRecognitionDispatcherHost is a delegate for Speech API messages used by | 22 // SpeechRecognitionDispatcherHost is a delegate for Speech API messages used by |
23 // RenderMessageFilter. Basically it acts as a proxy, relaying the events coming | 23 // RenderMessageFilter. Basically it acts as a proxy, relaying the events coming |
24 // from the SpeechRecognitionManager to IPC messages (and vice versa). | 24 // from the SpeechRecognitionManager to IPC messages (and vice versa). |
25 // It's the complement of SpeechRecognitionDispatcher (owned by RenderView). | 25 // It's the complement of SpeechRecognitionDispatcher (owned by RenderView). |
26 class CONTENT_EXPORT SpeechRecognitionDispatcherHost | 26 class CONTENT_EXPORT SpeechRecognitionDispatcherHost |
27 : public BrowserMessageFilter, | 27 : public BrowserMessageFilter, |
28 public SpeechRecognitionEventListener { | 28 public SpeechRecognitionEventListener { |
29 public: | 29 public: |
30 SpeechRecognitionDispatcherHost( | 30 SpeechRecognitionDispatcherHost( |
31 bool is_guest, | |
32 int render_process_id, | 31 int render_process_id, |
33 net::URLRequestContextGetter* context_getter); | 32 net::URLRequestContextGetter* context_getter); |
34 | 33 |
35 base::WeakPtr<SpeechRecognitionDispatcherHost> AsWeakPtr(); | 34 base::WeakPtr<SpeechRecognitionDispatcherHost> AsWeakPtr(); |
36 | 35 |
37 // SpeechRecognitionEventListener methods. | 36 // SpeechRecognitionEventListener methods. |
38 virtual void OnRecognitionStart(int session_id) OVERRIDE; | 37 virtual void OnRecognitionStart(int session_id) OVERRIDE; |
39 virtual void OnAudioStart(int session_id) OVERRIDE; | 38 virtual void OnAudioStart(int session_id) OVERRIDE; |
40 virtual void OnEnvironmentEstimationComplete(int session_id) OVERRIDE; | 39 virtual void OnEnvironmentEstimationComplete(int session_id) OVERRIDE; |
41 virtual void OnSoundStart(int session_id) OVERRIDE; | 40 virtual void OnSoundStart(int session_id) OVERRIDE; |
(...skipping 24 matching lines...) Expand all Loading... |
66 void OnStartRequest( | 65 void OnStartRequest( |
67 const SpeechRecognitionHostMsg_StartRequest_Params& params); | 66 const SpeechRecognitionHostMsg_StartRequest_Params& params); |
68 void OnStartRequestOnIO( | 67 void OnStartRequestOnIO( |
69 int embedder_render_process_id, | 68 int embedder_render_process_id, |
70 int embedder_render_view_id, | 69 int embedder_render_view_id, |
71 const SpeechRecognitionHostMsg_StartRequest_Params& params, | 70 const SpeechRecognitionHostMsg_StartRequest_Params& params, |
72 bool filter_profanities); | 71 bool filter_profanities); |
73 void OnAbortRequest(int render_view_id, int request_id); | 72 void OnAbortRequest(int render_view_id, int request_id); |
74 void OnStopCaptureRequest(int render_view_id, int request_id); | 73 void OnStopCaptureRequest(int render_view_id, int request_id); |
75 | 74 |
76 bool is_guest_; | |
77 int render_process_id_; | 75 int render_process_id_; |
78 scoped_refptr<net::URLRequestContextGetter> context_getter_; | 76 scoped_refptr<net::URLRequestContextGetter> context_getter_; |
79 | 77 |
80 // Used for posting asynchronous tasks (on the IO thread) without worrying | 78 // Used for posting asynchronous tasks (on the IO thread) without worrying |
81 // about this class being destroyed in the meanwhile (due to browser shutdown) | 79 // about this class being destroyed in the meanwhile (due to browser shutdown) |
82 // since tasks pending on a destroyed WeakPtr are automatically discarded. | 80 // since tasks pending on a destroyed WeakPtr are automatically discarded. |
83 base::WeakPtrFactory<SpeechRecognitionDispatcherHost> weak_factory_; | 81 base::WeakPtrFactory<SpeechRecognitionDispatcherHost> weak_factory_; |
84 | 82 |
85 DISALLOW_COPY_AND_ASSIGN(SpeechRecognitionDispatcherHost); | 83 DISALLOW_COPY_AND_ASSIGN(SpeechRecognitionDispatcherHost); |
86 }; | 84 }; |
87 | 85 |
88 } // namespace content | 86 } // namespace content |
89 | 87 |
90 #endif // CONTENT_BROWSER_SPEECH_SPEECH_RECOGNITION_DISPATCHER_HOST_H_ | 88 #endif // CONTENT_BROWSER_SPEECH_SPEECH_RECOGNITION_DISPATCHER_HOST_H_ |
OLD | NEW |