Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Side by Side Diff: content/browser/speech/speech_recognition_manager_impl.cc

Issue 15907012: Implement SpeechRecognizerImplAndroid (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Convert error codes in Java, refactor *{,JNI} methods into single methods, nits Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "content/browser/speech/google_one_shot_remote_engine.h" 11 #include "content/browser/speech/google_one_shot_remote_engine.h"
12 #include "content/browser/speech/google_streaming_remote_engine.h" 12 #include "content/browser/speech/google_streaming_remote_engine.h"
13 #include "content/browser/speech/speech_recognition_engine.h" 13 #include "content/browser/speech/speech_recognition_engine.h"
14 #include "content/browser/speech/speech_recognizer_impl.h" 14 #include "content/browser/speech/speech_recognizer_impl.h"
15 #include "content/browser/speech/speech_recognizer_impl_android.h"
15 #include "content/public/browser/browser_thread.h" 16 #include "content/public/browser/browser_thread.h"
16 #include "content/public/browser/content_browser_client.h" 17 #include "content/public/browser/content_browser_client.h"
17 #include "content/public/browser/resource_context.h" 18 #include "content/public/browser/resource_context.h"
18 #include "content/public/browser/speech_recognition_event_listener.h" 19 #include "content/public/browser/speech_recognition_event_listener.h"
19 #include "content/public/browser/speech_recognition_manager_delegate.h" 20 #include "content/public/browser/speech_recognition_manager_delegate.h"
20 #include "content/public/browser/speech_recognition_session_config.h" 21 #include "content/public/browser/speech_recognition_session_config.h"
21 #include "content/public/browser/speech_recognition_session_context.h" 22 #include "content/public/browser/speech_recognition_session_context.h"
22 #include "content/public/common/speech_recognition_error.h" 23 #include "content/public/common/speech_recognition_error.h"
23 #include "content/public/common/speech_recognition_result.h" 24 #include "content/public/common/speech_recognition_result.h"
24 #include "media/audio/audio_manager.h" 25 #include "media/audio/audio_manager.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 } 135 }
135 136
136 google_remote_engine->SetConfig(remote_engine_config); 137 google_remote_engine->SetConfig(remote_engine_config);
137 138
138 session->recognizer = new SpeechRecognizerImpl( 139 session->recognizer = new SpeechRecognizerImpl(
139 this, 140 this,
140 session_id, 141 session_id,
141 !config.continuous, 142 !config.continuous,
142 google_remote_engine); 143 google_remote_engine);
143 #else 144 #else
144 // TODO(janx): Implement a SpeechRecognizerImplAndroid with a JNI interface 145 session->recognizer = new SpeechRecognizerImplAndroid(
bulach 2013/06/11 07:24:48 uber nit: fits one line?
janx 2013/06/12 14:47:14 Fits.
145 // forwarding calls to Android's platform speech recognition service (see 146 this,
146 // crbug.com/222352). 147 session_id);
147 session->recognizer = NULL;
148 #endif 148 #endif
149 return session_id; 149 return session_id;
150 } 150 }
151 151
152 void SpeechRecognitionManagerImpl::StartSession(int session_id) { 152 void SpeechRecognitionManagerImpl::StartSession(int session_id) {
153 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 153 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
154 if (!SessionExists(session_id)) 154 if (!SessionExists(session_id))
155 return; 155 return;
156 156
157 // If there is another active session, abort that. 157 // If there is another active session, abort that.
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 659
660 SpeechRecognitionManagerImpl::Session::Session() 660 SpeechRecognitionManagerImpl::Session::Session()
661 : id(kSessionIDInvalid), 661 : id(kSessionIDInvalid),
662 listener_is_active(true) { 662 listener_is_active(true) {
663 } 663 }
664 664
665 SpeechRecognitionManagerImpl::Session::~Session() { 665 SpeechRecognitionManagerImpl::Session::~Session() {
666 } 666 }
667 667
668 } // namespace content 668 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698