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 16 matching lines...) Expand all Loading... |
27 : public BrowserMessageFilter, | 27 : public BrowserMessageFilter, |
28 public SpeechRecognitionEventListener { | 28 public SpeechRecognitionEventListener { |
29 public: | 29 public: |
30 SpeechRecognitionDispatcherHost( | 30 SpeechRecognitionDispatcherHost( |
31 int render_process_id, | 31 int render_process_id, |
32 net::URLRequestContextGetter* context_getter); | 32 net::URLRequestContextGetter* context_getter); |
33 | 33 |
34 base::WeakPtr<SpeechRecognitionDispatcherHost> AsWeakPtr(); | 34 base::WeakPtr<SpeechRecognitionDispatcherHost> AsWeakPtr(); |
35 | 35 |
36 // SpeechRecognitionEventListener methods. | 36 // SpeechRecognitionEventListener methods. |
37 virtual void OnRecognitionStart(int session_id) override; | 37 void OnRecognitionStart(int session_id) override; |
38 virtual void OnAudioStart(int session_id) override; | 38 void OnAudioStart(int session_id) override; |
39 virtual void OnEnvironmentEstimationComplete(int session_id) override; | 39 void OnEnvironmentEstimationComplete(int session_id) override; |
40 virtual void OnSoundStart(int session_id) override; | 40 void OnSoundStart(int session_id) override; |
41 virtual void OnSoundEnd(int session_id) override; | 41 void OnSoundEnd(int session_id) override; |
42 virtual void OnAudioEnd(int session_id) override; | 42 void OnAudioEnd(int session_id) override; |
43 virtual void OnRecognitionEnd(int session_id) override; | 43 void OnRecognitionEnd(int session_id) override; |
44 virtual void OnRecognitionResults( | 44 void OnRecognitionResults(int session_id, |
45 int session_id, | 45 const SpeechRecognitionResults& results) override; |
46 const SpeechRecognitionResults& results) override; | 46 void OnRecognitionError(int session_id, |
47 virtual void OnRecognitionError( | 47 const SpeechRecognitionError& error) override; |
48 int session_id, | 48 void OnAudioLevelsChange(int session_id, |
49 const SpeechRecognitionError& error) override; | 49 float volume, |
50 virtual void OnAudioLevelsChange(int session_id, | 50 float noise_volume) override; |
51 float volume, | |
52 float noise_volume) override; | |
53 | 51 |
54 // BrowserMessageFilter implementation. | 52 // BrowserMessageFilter implementation. |
55 virtual bool OnMessageReceived(const IPC::Message& message) override; | 53 bool OnMessageReceived(const IPC::Message& message) override; |
56 virtual void OverrideThreadForMessage( | 54 void OverrideThreadForMessage(const IPC::Message& message, |
57 const IPC::Message& message, | 55 BrowserThread::ID* thread) override; |
58 BrowserThread::ID* thread) override; | |
59 | 56 |
60 virtual void OnChannelClosing() override; | 57 void OnChannelClosing() override; |
61 | 58 |
62 private: | 59 private: |
63 virtual ~SpeechRecognitionDispatcherHost(); | 60 ~SpeechRecognitionDispatcherHost() override; |
64 | 61 |
65 void OnStartRequest( | 62 void OnStartRequest( |
66 const SpeechRecognitionHostMsg_StartRequest_Params& params); | 63 const SpeechRecognitionHostMsg_StartRequest_Params& params); |
67 void OnStartRequestOnIO( | 64 void OnStartRequestOnIO( |
68 int embedder_render_process_id, | 65 int embedder_render_process_id, |
69 int embedder_render_view_id, | 66 int embedder_render_view_id, |
70 const SpeechRecognitionHostMsg_StartRequest_Params& params, | 67 const SpeechRecognitionHostMsg_StartRequest_Params& params, |
71 int params_render_frame_id, | 68 int params_render_frame_id, |
72 bool filter_profanities); | 69 bool filter_profanities); |
73 void OnAbortRequest(int render_view_id, int request_id); | 70 void OnAbortRequest(int render_view_id, int request_id); |
74 void OnStopCaptureRequest(int render_view_id, int request_id); | 71 void OnStopCaptureRequest(int render_view_id, int request_id); |
75 void OnAbortAllRequests(int render_view_id); | 72 void OnAbortAllRequests(int render_view_id); |
76 | 73 |
77 int render_process_id_; | 74 int render_process_id_; |
78 scoped_refptr<net::URLRequestContextGetter> context_getter_; | 75 scoped_refptr<net::URLRequestContextGetter> context_getter_; |
79 | 76 |
80 // Used for posting asynchronous tasks (on the IO thread) without worrying | 77 // Used for posting asynchronous tasks (on the IO thread) without worrying |
81 // about this class being destroyed in the meanwhile (due to browser shutdown) | 78 // about this class being destroyed in the meanwhile (due to browser shutdown) |
82 // since tasks pending on a destroyed WeakPtr are automatically discarded. | 79 // since tasks pending on a destroyed WeakPtr are automatically discarded. |
83 base::WeakPtrFactory<SpeechRecognitionDispatcherHost> weak_factory_; | 80 base::WeakPtrFactory<SpeechRecognitionDispatcherHost> weak_factory_; |
84 | 81 |
85 DISALLOW_COPY_AND_ASSIGN(SpeechRecognitionDispatcherHost); | 82 DISALLOW_COPY_AND_ASSIGN(SpeechRecognitionDispatcherHost); |
86 }; | 83 }; |
87 | 84 |
88 } // namespace content | 85 } // namespace content |
89 | 86 |
90 #endif // CONTENT_BROWSER_SPEECH_SPEECH_RECOGNITION_DISPATCHER_HOST_H_ | 87 #endif // CONTENT_BROWSER_SPEECH_SPEECH_RECOGNITION_DISPATCHER_HOST_H_ |
OLD | NEW |