| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 SpeechRecognitionManager* manager) { | 55 SpeechRecognitionManager* manager) { |
| 56 manager_for_tests_ = manager; | 56 manager_for_tests_ = manager; |
| 57 } | 57 } |
| 58 | 58 |
| 59 SpeechRecognitionManagerImpl* SpeechRecognitionManagerImpl::GetInstance() { | 59 SpeechRecognitionManagerImpl* SpeechRecognitionManagerImpl::GetInstance() { |
| 60 return g_speech_recognition_manager_impl; | 60 return g_speech_recognition_manager_impl; |
| 61 } | 61 } |
| 62 | 62 |
| 63 SpeechRecognitionManagerImpl::SpeechRecognitionManagerImpl( | 63 SpeechRecognitionManagerImpl::SpeechRecognitionManagerImpl( |
| 64 media::AudioSystem* audio_system, | 64 media::AudioSystem* audio_system, |
| 65 media::AudioManager* audio_manager, |
| 65 MediaStreamManager* media_stream_manager) | 66 MediaStreamManager* media_stream_manager) |
| 66 : audio_system_(audio_system), | 67 : audio_system_(audio_system), |
| 68 audio_manager_(audio_manager), |
| 67 media_stream_manager_(media_stream_manager), | 69 media_stream_manager_(media_stream_manager), |
| 68 primary_session_id_(kSessionIDInvalid), | 70 primary_session_id_(kSessionIDInvalid), |
| 69 last_session_id_(kSessionIDInvalid), | 71 last_session_id_(kSessionIDInvalid), |
| 70 is_dispatching_event_(false), | 72 is_dispatching_event_(false), |
| 71 delegate_(GetContentClient() | 73 delegate_(GetContentClient() |
| 72 ->browser() | 74 ->browser() |
| 73 ->CreateSpeechRecognitionManagerDelegate()), | 75 ->CreateSpeechRecognitionManagerDelegate()), |
| 74 weak_factory_(this) { | 76 weak_factory_(this) { |
| 75 DCHECK(!g_speech_recognition_manager_impl); | 77 DCHECK(!g_speech_recognition_manager_impl); |
| 76 g_speech_recognition_manager_impl = this; | 78 g_speech_recognition_manager_impl = this; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 remote_engine_config.origin_url = config.origin_url; | 127 remote_engine_config.origin_url = config.origin_url; |
| 126 remote_engine_config.auth_token = config.auth_token; | 128 remote_engine_config.auth_token = config.auth_token; |
| 127 remote_engine_config.auth_scope = config.auth_scope; | 129 remote_engine_config.auth_scope = config.auth_scope; |
| 128 remote_engine_config.preamble = config.preamble; | 130 remote_engine_config.preamble = config.preamble; |
| 129 | 131 |
| 130 SpeechRecognitionEngine* google_remote_engine = | 132 SpeechRecognitionEngine* google_remote_engine = |
| 131 new SpeechRecognitionEngine(config.url_request_context_getter.get()); | 133 new SpeechRecognitionEngine(config.url_request_context_getter.get()); |
| 132 google_remote_engine->SetConfig(remote_engine_config); | 134 google_remote_engine->SetConfig(remote_engine_config); |
| 133 | 135 |
| 134 session->recognizer = new SpeechRecognizerImpl( | 136 session->recognizer = new SpeechRecognizerImpl( |
| 135 this, audio_system_, session_id, config.continuous, | 137 this, audio_system_, audio_manager_, session_id, config.continuous, |
| 136 config.interim_results, google_remote_engine); | 138 config.interim_results, google_remote_engine); |
| 137 #else | 139 #else |
| 138 session->recognizer = new SpeechRecognizerImplAndroid(this, session_id); | 140 session->recognizer = new SpeechRecognizerImplAndroid(this, session_id); |
| 139 #endif | 141 #endif |
| 140 return session_id; | 142 return session_id; |
| 141 } | 143 } |
| 142 | 144 |
| 143 void SpeechRecognitionManagerImpl::StartSession(int session_id) { | 145 void SpeechRecognitionManagerImpl::StartSession(int session_id) { |
| 144 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 146 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 145 if (!SessionExists(session_id)) | 147 if (!SessionExists(session_id)) |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 SpeechRecognitionManagerImpl::Session::Session() | 646 SpeechRecognitionManagerImpl::Session::Session() |
| 645 : id(kSessionIDInvalid), | 647 : id(kSessionIDInvalid), |
| 646 abort_requested(false), | 648 abort_requested(false), |
| 647 listener_is_active(true) { | 649 listener_is_active(true) { |
| 648 } | 650 } |
| 649 | 651 |
| 650 SpeechRecognitionManagerImpl::Session::~Session() { | 652 SpeechRecognitionManagerImpl::Session::~Session() { |
| 651 } | 653 } |
| 652 | 654 |
| 653 } // namespace content | 655 } // namespace content |
| OLD | NEW |