| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 void SpeechRecognitionManager::SetManagerForTesting( | 54 void SpeechRecognitionManager::SetManagerForTesting( |
| 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 MediaStreamManager* media_stream_manager) | 65 MediaStreamManager* media_stream_manager) |
| 65 : media_stream_manager_(media_stream_manager), | 66 : audio_system_(audio_system), |
| 67 media_stream_manager_(media_stream_manager), |
| 66 primary_session_id_(kSessionIDInvalid), | 68 primary_session_id_(kSessionIDInvalid), |
| 67 last_session_id_(kSessionIDInvalid), | 69 last_session_id_(kSessionIDInvalid), |
| 68 is_dispatching_event_(false), | 70 is_dispatching_event_(false), |
| 69 delegate_(GetContentClient() | 71 delegate_(GetContentClient() |
| 70 ->browser() | 72 ->browser() |
| 71 ->CreateSpeechRecognitionManagerDelegate()), | 73 ->CreateSpeechRecognitionManagerDelegate()), |
| 72 weak_factory_(this) { | 74 weak_factory_(this) { |
| 73 DCHECK(!g_speech_recognition_manager_impl); | 75 DCHECK(!g_speech_recognition_manager_impl); |
| 74 g_speech_recognition_manager_impl = this; | 76 g_speech_recognition_manager_impl = this; |
| 75 } | 77 } |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 remote_engine_config.origin_url = config.origin_url; | 125 remote_engine_config.origin_url = config.origin_url; |
| 124 remote_engine_config.auth_token = config.auth_token; | 126 remote_engine_config.auth_token = config.auth_token; |
| 125 remote_engine_config.auth_scope = config.auth_scope; | 127 remote_engine_config.auth_scope = config.auth_scope; |
| 126 remote_engine_config.preamble = config.preamble; | 128 remote_engine_config.preamble = config.preamble; |
| 127 | 129 |
| 128 SpeechRecognitionEngine* google_remote_engine = | 130 SpeechRecognitionEngine* google_remote_engine = |
| 129 new SpeechRecognitionEngine(config.url_request_context_getter.get()); | 131 new SpeechRecognitionEngine(config.url_request_context_getter.get()); |
| 130 google_remote_engine->SetConfig(remote_engine_config); | 132 google_remote_engine->SetConfig(remote_engine_config); |
| 131 | 133 |
| 132 session->recognizer = new SpeechRecognizerImpl( | 134 session->recognizer = new SpeechRecognizerImpl( |
| 133 this, | 135 this, audio_system_, session_id, config.continuous, |
| 134 session_id, | 136 config.interim_results, google_remote_engine); |
| 135 config.continuous, | |
| 136 config.interim_results, | |
| 137 google_remote_engine); | |
| 138 #else | 137 #else |
| 139 session->recognizer = new SpeechRecognizerImplAndroid(this, session_id); | 138 session->recognizer = new SpeechRecognizerImplAndroid(this, session_id); |
| 140 #endif | 139 #endif |
| 141 return session_id; | 140 return session_id; |
| 142 } | 141 } |
| 143 | 142 |
| 144 void SpeechRecognitionManagerImpl::StartSession(int session_id) { | 143 void SpeechRecognitionManagerImpl::StartSession(int session_id) { |
| 145 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 144 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 146 if (!SessionExists(session_id)) | 145 if (!SessionExists(session_id)) |
| 147 return; | 146 return; |
| (...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 SpeechRecognitionManagerImpl::Session::Session() | 644 SpeechRecognitionManagerImpl::Session::Session() |
| 646 : id(kSessionIDInvalid), | 645 : id(kSessionIDInvalid), |
| 647 abort_requested(false), | 646 abort_requested(false), |
| 648 listener_is_active(true) { | 647 listener_is_active(true) { |
| 649 } | 648 } |
| 650 | 649 |
| 651 SpeechRecognitionManagerImpl::Session::~Session() { | 650 SpeechRecognitionManagerImpl::Session::~Session() { |
| 652 } | 651 } |
| 653 | 652 |
| 654 } // namespace content | 653 } // namespace content |
| OLD | NEW |