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

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

Issue 884103004: Update {virtual,override,final} to follow C++11 style. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 #ifndef CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_IMPL_ANDROID_H_ 5 #ifndef CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_IMPL_ANDROID_H_
6 #define CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_IMPL_ANDROID_H_ 6 #define CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_IMPL_ANDROID_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 9
10 #include "base/android/scoped_java_ref.h" 10 #include "base/android/scoped_java_ref.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "content/browser/speech/speech_recognizer.h" 13 #include "content/browser/speech/speech_recognizer.h"
14 #include "content/public/common/speech_recognition_error.h" 14 #include "content/public/common/speech_recognition_error.h"
15 #include "content/public/common/speech_recognition_result.h" 15 #include "content/public/common/speech_recognition_result.h"
16 16
17 namespace content { 17 namespace content {
18 18
19 class SpeechRecognitionEventListener; 19 class SpeechRecognitionEventListener;
20 20
21 class CONTENT_EXPORT SpeechRecognizerImplAndroid : public SpeechRecognizer { 21 class CONTENT_EXPORT SpeechRecognizerImplAndroid : public SpeechRecognizer {
22 public: 22 public:
23 SpeechRecognizerImplAndroid(SpeechRecognitionEventListener* listener, 23 SpeechRecognizerImplAndroid(SpeechRecognitionEventListener* listener,
24 int session_id); 24 int session_id);
25 25
26 // SpeechRecognizer methods. 26 // SpeechRecognizer methods.
27 virtual void StartRecognition(const std::string& device_id) override; 27 void StartRecognition(const std::string& device_id) override;
28 virtual void AbortRecognition() override; 28 void AbortRecognition() override;
29 virtual void StopAudioCapture() override; 29 void StopAudioCapture() override;
30 virtual bool IsActive() const override; 30 bool IsActive() const override;
31 virtual bool IsCapturingAudio() const override; 31 bool IsCapturingAudio() const override;
32 32
33 // Called from Java methods via JNI. 33 // Called from Java methods via JNI.
34 void OnAudioStart(JNIEnv* env, jobject obj); 34 void OnAudioStart(JNIEnv* env, jobject obj);
35 void OnSoundStart(JNIEnv* env, jobject obj); 35 void OnSoundStart(JNIEnv* env, jobject obj);
36 void OnSoundEnd(JNIEnv* env, jobject obj); 36 void OnSoundEnd(JNIEnv* env, jobject obj);
37 void OnAudioEnd(JNIEnv* env, jobject obj); 37 void OnAudioEnd(JNIEnv* env, jobject obj);
38 void OnRecognitionResults(JNIEnv* env, jobject obj, jobjectArray strings, 38 void OnRecognitionResults(JNIEnv* env, jobject obj, jobjectArray strings,
39 jfloatArray floats, jboolean interim); 39 jfloatArray floats, jboolean interim);
40 void OnRecognitionError(JNIEnv* env, jobject obj, jint error); 40 void OnRecognitionError(JNIEnv* env, jobject obj, jint error);
41 void OnRecognitionEnd(JNIEnv* env, jobject obj); 41 void OnRecognitionEnd(JNIEnv* env, jobject obj);
42 42
43 static bool RegisterSpeechRecognizer(JNIEnv* env); 43 static bool RegisterSpeechRecognizer(JNIEnv* env);
44 44
45 private: 45 private:
46 enum State { 46 enum State {
47 STATE_IDLE = 0, 47 STATE_IDLE = 0,
48 STATE_CAPTURING_AUDIO, 48 STATE_CAPTURING_AUDIO,
49 STATE_AWAITING_FINAL_RESULT 49 STATE_AWAITING_FINAL_RESULT
50 }; 50 };
51 51
52 void StartRecognitionOnUIThread( 52 void StartRecognitionOnUIThread(
53 std::string language, bool continuous, bool interim_results); 53 std::string language, bool continuous, bool interim_results);
54 void OnRecognitionResultsOnIOThread(SpeechRecognitionResults const &results); 54 void OnRecognitionResultsOnIOThread(SpeechRecognitionResults const &results);
55 55
56 virtual ~SpeechRecognizerImplAndroid(); 56 ~SpeechRecognizerImplAndroid() override;
57 57
58 base::android::ScopedJavaGlobalRef<jobject> j_recognition_; 58 base::android::ScopedJavaGlobalRef<jobject> j_recognition_;
59 State state_; 59 State state_;
60 60
61 DISALLOW_COPY_AND_ASSIGN(SpeechRecognizerImplAndroid); 61 DISALLOW_COPY_AND_ASSIGN(SpeechRecognizerImplAndroid);
62 }; 62 };
63 63
64 } // namespace content 64 } // namespace content
65 65
66 #endif // CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_IMPL_ANDROID_H_ 66 #endif // CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_IMPL_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698