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" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 | 121 |
122 SpeechRecognitionSessionConfig config; | 122 SpeechRecognitionSessionConfig config; |
123 config.language = params.language; | 123 config.language = params.language; |
124 if (!params.grammar.empty()) { | 124 if (!params.grammar.empty()) { |
125 config.grammars.push_back(SpeechRecognitionGrammar(params.grammar)); | 125 config.grammars.push_back(SpeechRecognitionGrammar(params.grammar)); |
126 } | 126 } |
127 config.max_hypotheses = kMaxHypothesesForSpeechInputTag; | 127 config.max_hypotheses = kMaxHypothesesForSpeechInputTag; |
128 config.origin_url = params.origin_url; | 128 config.origin_url = params.origin_url; |
129 config.initial_context = context; | 129 config.initial_context = context; |
130 config.url_request_context_getter = url_request_context_getter_.get(); | 130 config.url_request_context_getter = url_request_context_getter_.get(); |
131 if (recognition_preferences_) { | 131 if (recognition_preferences_.get()) { |
132 config.filter_profanities = recognition_preferences_->FilterProfanities(); | 132 config.filter_profanities = recognition_preferences_->FilterProfanities(); |
133 } else { | 133 } else { |
134 config.filter_profanities = false; | 134 config.filter_profanities = false; |
135 } | 135 } |
136 config.event_listener = this; | 136 config.event_listener = this; |
137 | 137 |
138 int session_id = manager()->CreateSession(config); | 138 int session_id = manager()->CreateSession(config); |
139 DCHECK_NE(session_id, SpeechRecognitionManager::kSessionIDInvalid); | 139 DCHECK_NE(session_id, SpeechRecognitionManager::kSessionIDInvalid); |
140 manager()->StartSession(session_id); | 140 manager()->StartSession(session_id); |
141 } | 141 } |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 void InputTagSpeechDispatcherHost::OnSoundEnd(int session_id) {} | 212 void InputTagSpeechDispatcherHost::OnSoundEnd(int session_id) {} |
213 void InputTagSpeechDispatcherHost::OnRecognitionError( | 213 void InputTagSpeechDispatcherHost::OnRecognitionError( |
214 int session_id, | 214 int session_id, |
215 const SpeechRecognitionError& error) {} | 215 const SpeechRecognitionError& error) {} |
216 void InputTagSpeechDispatcherHost::OnAudioLevelsChange( | 216 void InputTagSpeechDispatcherHost::OnAudioLevelsChange( |
217 int session_id, float volume, float noise_volume) {} | 217 int session_id, float volume, float noise_volume) {} |
218 void InputTagSpeechDispatcherHost::OnEnvironmentEstimationComplete( | 218 void InputTagSpeechDispatcherHost::OnEnvironmentEstimationComplete( |
219 int session_id) {} | 219 int session_id) {} |
220 | 220 |
221 } // namespace content | 221 } // namespace content |
OLD | NEW |