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 #include "content/browser/speech/input_tag_speech_dispatcher_host.h" | 5 #include "content/browser/speech/input_tag_speech_dispatcher_host.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
9 #include "content/browser/browser_plugin/browser_plugin_guest.h" | 9 #include "content/browser/browser_plugin/browser_plugin_guest.h" |
10 #include "content/browser/renderer_host/render_view_host_impl.h" | 10 #include "content/browser/renderer_host/render_view_host_impl.h" |
11 #include "content/browser/speech/speech_recognition_manager_impl.h" | 11 #include "content/browser/speech/speech_recognition_manager_impl.h" |
12 #include "content/browser/web_contents/web_contents_impl.h" | 12 #include "content/browser/web_contents/web_contents_impl.h" |
13 #include "content/common/speech_recognition_messages.h" | 13 #include "content/common/speech_recognition_messages.h" |
14 #include "content/public/browser/speech_recognition_manager_delegate.h" | 14 #include "content/public/browser/speech_recognition_manager_delegate.h" |
15 #include "content/public/browser/speech_recognition_session_config.h" | 15 #include "content/public/browser/speech_recognition_session_config.h" |
16 #include "content/public/browser/speech_recognition_session_context.h" | 16 #include "content/public/browser/speech_recognition_session_context.h" |
17 | 17 |
18 namespace { | 18 namespace { |
19 const uint32 kMaxHypothesesForSpeechInputTag = 6; | 19 const uint32 kMaxHypothesesForSpeechInputTag = 6; |
20 } | 20 } |
21 | 21 |
22 namespace content { | 22 namespace content { |
23 | 23 |
24 InputTagSpeechDispatcherHost::InputTagSpeechDispatcherHost( | 24 InputTagSpeechDispatcherHost::InputTagSpeechDispatcherHost( |
25 bool is_guest, | 25 bool is_guest, |
26 int render_process_id, | 26 int render_process_id, |
27 net::URLRequestContextGetter* url_request_context_getter) | 27 net::URLRequestContextGetter* url_request_context_getter) |
28 : BrowserMessageFilter(SpeechRecognitionMsgStart), | 28 : is_guest_(is_guest), |
29 is_guest_(is_guest), | |
30 render_process_id_(render_process_id), | 29 render_process_id_(render_process_id), |
31 url_request_context_getter_(url_request_context_getter), | 30 url_request_context_getter_(url_request_context_getter), |
32 weak_factory_(this) { | 31 weak_factory_(this) { |
33 // Do not add any non-trivial initialization here, instead do it lazily when | 32 // Do not add any non-trivial initialization here, instead do it lazily when |
34 // required (e.g. see the method |SpeechRecognitionManager::GetInstance()|) or | 33 // required (e.g. see the method |SpeechRecognitionManager::GetInstance()|) or |
35 // add an Init() method. | 34 // add an Init() method. |
36 } | 35 } |
37 | 36 |
38 InputTagSpeechDispatcherHost::~InputTagSpeechDispatcherHost() { | 37 InputTagSpeechDispatcherHost::~InputTagSpeechDispatcherHost() { |
39 SpeechRecognitionManager::GetInstance()->AbortAllSessionsForRenderProcess( | 38 SpeechRecognitionManager::GetInstance()->AbortAllSessionsForRenderProcess( |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 void InputTagSpeechDispatcherHost::OnSoundEnd(int session_id) {} | 218 void InputTagSpeechDispatcherHost::OnSoundEnd(int session_id) {} |
220 void InputTagSpeechDispatcherHost::OnRecognitionError( | 219 void InputTagSpeechDispatcherHost::OnRecognitionError( |
221 int session_id, | 220 int session_id, |
222 const SpeechRecognitionError& error) {} | 221 const SpeechRecognitionError& error) {} |
223 void InputTagSpeechDispatcherHost::OnAudioLevelsChange( | 222 void InputTagSpeechDispatcherHost::OnAudioLevelsChange( |
224 int session_id, float volume, float noise_volume) {} | 223 int session_id, float volume, float noise_volume) {} |
225 void InputTagSpeechDispatcherHost::OnEnvironmentEstimationComplete( | 224 void InputTagSpeechDispatcherHost::OnEnvironmentEstimationComplete( |
226 int session_id) {} | 225 int session_id) {} |
227 | 226 |
228 } // namespace content | 227 } // namespace content |
OLD | NEW |