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/speech/google_one_shot_remote_engine.h" | 10 #include "content/browser/speech/google_one_shot_remote_engine.h" |
11 #include "content/browser/speech/google_streaming_remote_engine.h" | 11 #include "content/browser/speech/google_streaming_remote_engine.h" |
12 #include "content/browser/speech/speech_recognition_engine.h" | 12 #include "content/browser/speech/speech_recognition_engine.h" |
13 #include "content/browser/speech/speech_recognizer_impl.h" | 13 #include "content/browser/speech/speech_recognizer_impl.h" |
14 #include "content/browser/speech/speech_recognizer_impl_android.h" | |
14 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
15 #include "content/public/browser/content_browser_client.h" | 16 #include "content/public/browser/content_browser_client.h" |
16 #include "content/public/browser/resource_context.h" | 17 #include "content/public/browser/resource_context.h" |
17 #include "content/public/browser/speech_recognition_event_listener.h" | 18 #include "content/public/browser/speech_recognition_event_listener.h" |
18 #include "content/public/browser/speech_recognition_manager_delegate.h" | 19 #include "content/public/browser/speech_recognition_manager_delegate.h" |
19 #include "content/public/browser/speech_recognition_session_config.h" | 20 #include "content/public/browser/speech_recognition_session_config.h" |
20 #include "content/public/browser/speech_recognition_session_context.h" | 21 #include "content/public/browser/speech_recognition_session_context.h" |
21 #include "content/public/common/speech_recognition_error.h" | 22 #include "content/public/common/speech_recognition_error.h" |
22 #include "content/public/common/speech_recognition_result.h" | 23 #include "content/public/common/speech_recognition_result.h" |
23 #include "media/audio/audio_manager.h" | 24 #include "media/audio/audio_manager.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
125 } | 126 } |
126 | 127 |
127 google_remote_engine->SetConfig(remote_engine_config); | 128 google_remote_engine->SetConfig(remote_engine_config); |
128 | 129 |
129 session.recognizer = new SpeechRecognizerImpl( | 130 session.recognizer = new SpeechRecognizerImpl( |
130 this, | 131 this, |
131 session_id, | 132 session_id, |
132 !config.continuous, | 133 !config.continuous, |
133 google_remote_engine); | 134 google_remote_engine); |
134 #else | 135 #else |
135 // TODO(janx): Implement a SpeechRecognizerImplAndroid with a JNI interface | 136 session.recognizer = new SpeechRecognizerImplAndroid( |
136 // forwarding calls to Android's platform speech recognition service (see | 137 this, |
137 // crbug.com/222352). | 138 config, |
Primiano Tucci (use gerrit)
2013/06/03 16:24:11
Can you just pass session_id and use SpeechRecogni
janx
2013/06/05 13:51:00
Since the config is used only in StartRecognition,
| |
138 session.recognizer = NULL; | 139 session_id); |
139 #endif | 140 #endif |
140 return session_id; | 141 return session_id; |
141 } | 142 } |
142 | 143 |
143 void SpeechRecognitionManagerImpl::StartSession(int session_id) { | 144 void SpeechRecognitionManagerImpl::StartSession(int session_id) { |
144 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 145 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
145 if (!SessionExists(session_id)) | 146 if (!SessionExists(session_id)) |
146 return; | 147 return; |
147 | 148 |
148 // If there is another active session, abort that. | 149 // If there is another active session, abort that. |
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
672 | 673 |
673 SpeechRecognitionManagerImpl::Session::Session() | 674 SpeechRecognitionManagerImpl::Session::Session() |
674 : id(kSessionIDInvalid), | 675 : id(kSessionIDInvalid), |
675 listener_is_active(true) { | 676 listener_is_active(true) { |
676 } | 677 } |
677 | 678 |
678 SpeechRecognitionManagerImpl::Session::~Session() { | 679 SpeechRecognitionManagerImpl::Session::~Session() { |
679 } | 680 } |
680 | 681 |
681 } // namespace content | 682 } // namespace content |
OLD | NEW |