diff options
author | janx@chromium.org <janx@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-15 17:28:36 +0000 |
---|---|---|
committer | janx@chromium.org <janx@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-15 17:28:36 +0000 |
commit | a819c937a6982e73c0ad1b1a53ea67f0d3960b2b (patch) | |
tree | 61d2d53d567ec76b73268ec095d4894e7e6d1cf5 /content/browser/speech | |
parent | f084f975440a99d4af97993d8b10bb8c9198b127 (diff) | |
download | chromium_src-a819c937a6982e73c0ad1b1a53ea67f0d3960b2b.zip chromium_src-a819c937a6982e73c0ad1b1a53ea67f0d3960b2b.tar.gz chromium_src-a819c937a6982e73c0ad1b1a53ea67f0d3960b2b.tar.bz2 |
Android: Speech Recognition now considers IETF BCP 47 language tags.
The Web Speech API defines a language tag parameter as defined by IETF's
BCP 47 (e.g. "en-GB") that needs to be passed along to Android's Speech
RecognizerIntent.
BUG=258973
Review URL: https://chromiumcodereview.appspot.com/5342114682503168
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@211656 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/speech')
-rw-r--r-- | content/browser/speech/speech_recognizer_impl_android.cc | 8 | ||||
-rw-r--r-- | content/browser/speech/speech_recognizer_impl_android.h | 3 |
2 files changed, 7 insertions, 4 deletions
diff --git a/content/browser/speech/speech_recognizer_impl_android.cc b/content/browser/speech/speech_recognizer_impl_android.cc index bb422cc..eb3f793 100644 --- a/content/browser/speech/speech_recognizer_impl_android.cc +++ b/content/browser/speech/speech_recognizer_impl_android.cc @@ -20,6 +20,7 @@ using base::android::AppendJavaStringArrayToStringVector; using base::android::AttachCurrentThread; +using base::android::ConvertUTF8ToJavaString; using base::android::GetApplicationContext; using base::android::JavaFloatArrayToFloatVector; @@ -46,16 +47,17 @@ void SpeechRecognizerImplAndroid::StartRecognition( SpeechRecognitionManager::GetInstance()->GetSessionConfig(session_id()); BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind( &content::SpeechRecognizerImplAndroid::StartRecognitionOnUIThread, this, - config.continuous, config.interim_results)); + config.language, config.continuous, config.interim_results)); } void SpeechRecognizerImplAndroid::StartRecognitionOnUIThread( - bool continuous, bool interim_results) { + std::string language, bool continuous, bool interim_results) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); JNIEnv* env = AttachCurrentThread(); j_recognition_.Reset(Java_SpeechRecognition_createSpeechRecognition(env, GetApplicationContext(), reinterpret_cast<jint>(this))); - Java_SpeechRecognition_startRecognition(env, j_recognition_.obj(), continuous, + Java_SpeechRecognition_startRecognition(env, j_recognition_.obj(), + ConvertUTF8ToJavaString(env, language).obj(), continuous, interim_results); } diff --git a/content/browser/speech/speech_recognizer_impl_android.h b/content/browser/speech/speech_recognizer_impl_android.h index a9629a8..e6e7f09 100644 --- a/content/browser/speech/speech_recognizer_impl_android.h +++ b/content/browser/speech/speech_recognizer_impl_android.h @@ -49,7 +49,8 @@ class CONTENT_EXPORT SpeechRecognizerImplAndroid : public SpeechRecognizer { STATE_AWAITING_FINAL_RESULT }; - void StartRecognitionOnUIThread(bool continuous, bool interim_results); + void StartRecognitionOnUIThread( + std::string language, bool continuous, bool interim_results); void OnRecognitionResultsOnIOThread(SpeechRecognitionResults const &results); virtual ~SpeechRecognizerImplAndroid(); |