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

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

Issue 1354363002: Cleanup: Pass std::string as const reference from content/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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_recognizer_impl_android.h" 5 #include "content/browser/speech/speech_recognizer_impl_android.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_array.h" 8 #include "base/android/jni_array.h"
9 #include "base/android/jni_string.h" 9 #include "base/android/jni_string.h"
10 #include "base/android/scoped_java_ref.h" 10 #include "base/android/scoped_java_ref.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 base::Unretained(listener()), 44 base::Unretained(listener()),
45 session_id())); 45 session_id()));
46 SpeechRecognitionSessionConfig config = 46 SpeechRecognitionSessionConfig config =
47 SpeechRecognitionManager::GetInstance()->GetSessionConfig(session_id()); 47 SpeechRecognitionManager::GetInstance()->GetSessionConfig(session_id());
48 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind( 48 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind(
49 &content::SpeechRecognizerImplAndroid::StartRecognitionOnUIThread, this, 49 &content::SpeechRecognizerImplAndroid::StartRecognitionOnUIThread, this,
50 config.language, config.continuous, config.interim_results)); 50 config.language, config.continuous, config.interim_results));
51 } 51 }
52 52
53 void SpeechRecognizerImplAndroid::StartRecognitionOnUIThread( 53 void SpeechRecognizerImplAndroid::StartRecognitionOnUIThread(
54 std::string language, bool continuous, bool interim_results) { 54 const std::string& language,
55 bool continuous,
56 bool interim_results) {
55 DCHECK_CURRENTLY_ON(BrowserThread::UI); 57 DCHECK_CURRENTLY_ON(BrowserThread::UI);
56 JNIEnv* env = AttachCurrentThread(); 58 JNIEnv* env = AttachCurrentThread();
57 j_recognition_.Reset(Java_SpeechRecognition_createSpeechRecognition(env, 59 j_recognition_.Reset(Java_SpeechRecognition_createSpeechRecognition(env,
58 GetApplicationContext(), reinterpret_cast<intptr_t>(this))); 60 GetApplicationContext(), reinterpret_cast<intptr_t>(this)));
59 Java_SpeechRecognition_startRecognition(env, j_recognition_.obj(), 61 Java_SpeechRecognition_startRecognition(env, j_recognition_.obj(),
60 ConvertUTF8ToJavaString(env, language).obj(), continuous, 62 ConvertUTF8ToJavaString(env, language).obj(), continuous,
61 interim_results); 63 interim_results);
62 } 64 }
63 65
64 void SpeechRecognizerImplAndroid::AbortRecognition() { 66 void SpeechRecognizerImplAndroid::AbortRecognition() {
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 state_ = STATE_IDLE; 199 state_ = STATE_IDLE;
198 listener()->OnRecognitionEnd(session_id()); 200 listener()->OnRecognitionEnd(session_id());
199 } 201 }
200 202
201 // static 203 // static
202 bool SpeechRecognizerImplAndroid::RegisterSpeechRecognizer(JNIEnv* env) { 204 bool SpeechRecognizerImplAndroid::RegisterSpeechRecognizer(JNIEnv* env) {
203 return RegisterNativesImpl(env); 205 return RegisterNativesImpl(env);
204 } 206 }
205 207
206 } // namespace content 208 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/speech/speech_recognizer_impl_android.h ('k') | content/child/resource_dispatcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698