OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_recognition_manager_impl.h" | 5 #include "content/browser/speech/speech_recognition_manager_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "content/browser/browser_main_loop.h" | 8 #include "content/browser/browser_main_loop.h" |
9 #include "content/browser/renderer_host/media/media_stream_manager.h" | 9 #include "content/browser/renderer_host/media/media_stream_manager.h" |
10 #include "content/browser/renderer_host/media/media_stream_ui_proxy.h" | 10 #include "content/browser/renderer_host/media/media_stream_ui_proxy.h" |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 SpeechRecognizerImpl::kAudioSampleRate; | 125 SpeechRecognizerImpl::kAudioSampleRate; |
126 remote_engine_config.audio_num_bits_per_sample = | 126 remote_engine_config.audio_num_bits_per_sample = |
127 SpeechRecognizerImpl::kNumBitsPerAudioSample; | 127 SpeechRecognizerImpl::kNumBitsPerAudioSample; |
128 remote_engine_config.filter_profanities = config.filter_profanities; | 128 remote_engine_config.filter_profanities = config.filter_profanities; |
129 remote_engine_config.continuous = config.continuous; | 129 remote_engine_config.continuous = config.continuous; |
130 remote_engine_config.interim_results = config.interim_results; | 130 remote_engine_config.interim_results = config.interim_results; |
131 remote_engine_config.max_hypotheses = config.max_hypotheses; | 131 remote_engine_config.max_hypotheses = config.max_hypotheses; |
132 remote_engine_config.hardware_info = hardware_info; | 132 remote_engine_config.hardware_info = hardware_info; |
133 remote_engine_config.origin_url = | 133 remote_engine_config.origin_url = |
134 can_report_metrics ? config.origin_url : std::string(); | 134 can_report_metrics ? config.origin_url : std::string(); |
| 135 remote_engine_config.auth_token = config.auth_token; |
| 136 remote_engine_config.auth_scope = config.auth_scope; |
135 | 137 |
136 SpeechRecognitionEngine* google_remote_engine; | 138 SpeechRecognitionEngine* google_remote_engine; |
137 if (config.is_legacy_api) { | 139 if (config.is_legacy_api) { |
138 google_remote_engine = | 140 google_remote_engine = |
139 new GoogleOneShotRemoteEngine(config.url_request_context_getter.get()); | 141 new GoogleOneShotRemoteEngine(config.url_request_context_getter.get()); |
140 } else { | 142 } else { |
141 google_remote_engine = new GoogleStreamingRemoteEngine( | 143 google_remote_engine = new GoogleStreamingRemoteEngine( |
142 config.url_request_context_getter.get()); | 144 config.url_request_context_getter.get()); |
143 } | 145 } |
144 | 146 |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 base::Bind(&SpeechRecognitionManagerImpl::DispatchEvent, | 429 base::Bind(&SpeechRecognitionManagerImpl::DispatchEvent, |
428 weak_factory_.GetWeakPtr(), | 430 weak_factory_.GetWeakPtr(), |
429 session_id, | 431 session_id, |
430 EVENT_RECOGNITION_ENDED)); | 432 EVENT_RECOGNITION_ENDED)); |
431 } | 433 } |
432 | 434 |
433 int SpeechRecognitionManagerImpl::GetSession( | 435 int SpeechRecognitionManagerImpl::GetSession( |
434 int render_process_id, int render_view_id, int request_id) const { | 436 int render_process_id, int render_view_id, int request_id) const { |
435 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 437 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
436 SessionsTable::const_iterator iter; | 438 SessionsTable::const_iterator iter; |
437 for(iter = sessions_.begin(); iter != sessions_.end(); ++iter) { | 439 for (iter = sessions_.begin(); iter != sessions_.end(); ++iter) { |
438 const int session_id = iter->first; | 440 const int session_id = iter->first; |
439 const SpeechRecognitionSessionContext& context = iter->second->context; | 441 const SpeechRecognitionSessionContext& context = iter->second->context; |
440 if (context.render_process_id == render_process_id && | 442 if (context.render_process_id == render_process_id && |
441 context.render_view_id == render_view_id && | 443 context.render_view_id == render_view_id && |
442 context.request_id == request_id) { | 444 context.request_id == request_id) { |
443 return session_id; | 445 return session_id; |
444 } | 446 } |
445 } | 447 } |
446 return kSessionIDInvalid; | 448 return kSessionIDInvalid; |
447 } | 449 } |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
691 SpeechRecognitionManagerImpl::Session::Session() | 693 SpeechRecognitionManagerImpl::Session::Session() |
692 : id(kSessionIDInvalid), | 694 : id(kSessionIDInvalid), |
693 abort_requested(false), | 695 abort_requested(false), |
694 listener_is_active(true) { | 696 listener_is_active(true) { |
695 } | 697 } |
696 | 698 |
697 SpeechRecognitionManagerImpl::Session::~Session() { | 699 SpeechRecognitionManagerImpl::Session::~Session() { |
698 } | 700 } |
699 | 701 |
700 } // namespace content | 702 } // namespace content |
OLD | NEW |