| OLD | NEW |
| 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 package org.chromium.content.browser; | 5 package org.chromium.content.browser; |
| 6 | 6 |
| 7 import android.content.ComponentName; | 7 import android.content.ComponentName; |
| 8 import android.content.Context; | 8 import android.content.Context; |
| 9 import android.content.Intent; | 9 import android.content.Intent; |
| 10 import android.content.pm.PackageManager; | 10 import android.content.pm.PackageManager; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 } | 88 } |
| 89 } | 89 } |
| 90 | 90 |
| 91 @Override | 91 @Override |
| 92 public void onError(int error) { | 92 public void onError(int error) { |
| 93 int code = SpeechRecognitionErrorCode.NONE; | 93 int code = SpeechRecognitionErrorCode.NONE; |
| 94 | 94 |
| 95 // Translate Android SpeechRecognizer errors to Web Speech API error
s. | 95 // Translate Android SpeechRecognizer errors to Web Speech API error
s. |
| 96 switch(error) { | 96 switch(error) { |
| 97 case SpeechRecognizer.ERROR_AUDIO: | 97 case SpeechRecognizer.ERROR_AUDIO: |
| 98 code = SpeechRecognitionErrorCode.AUDIO; | 98 code = SpeechRecognitionErrorCode.AUDIO_CAPTURE; |
| 99 break; | 99 break; |
| 100 case SpeechRecognizer.ERROR_CLIENT: | 100 case SpeechRecognizer.ERROR_CLIENT: |
| 101 code = SpeechRecognitionErrorCode.ABORTED; | 101 code = SpeechRecognitionErrorCode.ABORTED; |
| 102 break; | 102 break; |
| 103 case SpeechRecognizer.ERROR_RECOGNIZER_BUSY: | 103 case SpeechRecognizer.ERROR_RECOGNIZER_BUSY: |
| 104 case SpeechRecognizer.ERROR_INSUFFICIENT_PERMISSIONS: | 104 case SpeechRecognizer.ERROR_INSUFFICIENT_PERMISSIONS: |
| 105 code = SpeechRecognitionErrorCode.NOT_ALLOWED; | 105 code = SpeechRecognitionErrorCode.NOT_ALLOWED; |
| 106 break; | 106 break; |
| 107 case SpeechRecognizer.ERROR_NETWORK_TIMEOUT: | 107 case SpeechRecognizer.ERROR_NETWORK_TIMEOUT: |
| 108 case SpeechRecognizer.ERROR_NETWORK: | 108 case SpeechRecognizer.ERROR_NETWORK: |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 private native void nativeOnSoundStart(long nativeSpeechRecognizerImplAndroi
d); | 277 private native void nativeOnSoundStart(long nativeSpeechRecognizerImplAndroi
d); |
| 278 private native void nativeOnSoundEnd(long nativeSpeechRecognizerImplAndroid)
; | 278 private native void nativeOnSoundEnd(long nativeSpeechRecognizerImplAndroid)
; |
| 279 private native void nativeOnAudioEnd(long nativeSpeechRecognizerImplAndroid)
; | 279 private native void nativeOnAudioEnd(long nativeSpeechRecognizerImplAndroid)
; |
| 280 private native void nativeOnRecognitionResults(long nativeSpeechRecognizerIm
plAndroid, | 280 private native void nativeOnRecognitionResults(long nativeSpeechRecognizerIm
plAndroid, |
| 281 String[] results, | 281 String[] results, |
| 282 float[] scores, | 282 float[] scores, |
| 283 boolean provisional); | 283 boolean provisional); |
| 284 private native void nativeOnRecognitionError(long nativeSpeechRecognizerImpl
Android, int error); | 284 private native void nativeOnRecognitionError(long nativeSpeechRecognizerImpl
Android, int error); |
| 285 private native void nativeOnRecognitionEnd(long nativeSpeechRecognizerImplAn
droid); | 285 private native void nativeOnRecognitionEnd(long nativeSpeechRecognizerImplAn
droid); |
| 286 } | 286 } |
| OLD | NEW |