OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/speech_input_manager.h" | 5 #include "content/browser/speech/speech_input_manager.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 // subsequent requests may have the hardware info available if the fetch | 220 // subsequent requests may have the hardware info available if the fetch |
221 // completed before them. This way we don't end up stalling the user with | 221 // completed before them. This way we don't end up stalling the user with |
222 // a long wait and disk seeks when they click on a UI element and start | 222 // a long wait and disk seeks when they click on a UI element and start |
223 // speaking. | 223 // speaking. |
224 optional_request_info_->Refresh(); | 224 optional_request_info_->Refresh(); |
225 } | 225 } |
226 | 226 |
227 SpeechInputRequest* request = &requests_[caller_id]; | 227 SpeechInputRequest* request = &requests_[caller_id]; |
228 request->delegate = delegate; | 228 request->delegate = delegate; |
229 request->recognizer = new SpeechRecognizer( | 229 request->recognizer = new SpeechRecognizer( |
230 this, caller_id, language, grammar, optional_request_info_->value(), | 230 this, caller_id, language, grammar, censor_results(), |
| 231 optional_request_info_->value(), |
231 optional_request_info_->can_report_metrics() ? origin_url : ""); | 232 optional_request_info_->can_report_metrics() ? origin_url : ""); |
232 request->is_active = false; | 233 request->is_active = false; |
233 | 234 |
234 StartRecognitionForRequest(caller_id); | 235 StartRecognitionForRequest(caller_id); |
235 } | 236 } |
236 | 237 |
237 void SpeechInputManagerImpl::StartRecognitionForRequest(int caller_id) { | 238 void SpeechInputManagerImpl::StartRecognitionForRequest(int caller_id) { |
238 DCHECK(HasPendingRequest(caller_id)); | 239 DCHECK(HasPendingRequest(caller_id)); |
239 | 240 |
240 // If we are currently recording audio for another caller, abort that cleanly. | 241 // If we are currently recording audio for another caller, abort that cleanly. |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 // to the user, abort it since user has switched focus. Otherwise | 388 // to the user, abort it since user has switched focus. Otherwise |
388 // recognition has started and keep that going so user can start speaking to | 389 // recognition has started and keep that going so user can start speaking to |
389 // another element while this gets the results in parallel. | 390 // another element while this gets the results in parallel. |
390 if (recording_caller_id_ == caller_id || !requests_[caller_id].is_active) { | 391 if (recording_caller_id_ == caller_id || !requests_[caller_id].is_active) { |
391 CancelRecognitionAndInformDelegate(caller_id); | 392 CancelRecognitionAndInformDelegate(caller_id); |
392 } | 393 } |
393 } | 394 } |
394 } | 395 } |
395 | 396 |
396 } // namespace speech_input | 397 } // namespace speech_input |
OLD | NEW |