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

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

Issue 15907012: Implement SpeechRecognizerImplAndroid (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_IMPL_ANDROID_H_
6 #define CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_IMPL_ANDROID_H_
7
8 #include <jni.h>
9
10 #include "base/android/scoped_java_ref.h"
11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h"
13
Primiano Tucci (use gerrit) 2013/06/03 16:24:11 Nit: Is this newline needed here? I can't find any
janx 2013/06/05 13:51:00 I think new lines are needed when include order ma
14 #include "content/browser/speech/speech_recognizer.h"
15 #include "content/public/browser/speech_recognition_session_config.h"
16 #include "content/public/common/speech_recognition_error.h"
17 #include "content/public/common/speech_recognition_result.h"
18
19 namespace content {
20
21 class SpeechRecognitionEventListener;
22
23 class CONTENT_EXPORT SpeechRecognizerImplAndroid : public SpeechRecognizer {
24 public:
25 static void Init(JNIEnv* env);
26
27 virtual ~SpeechRecognizerImplAndroid();
Primiano Tucci (use gerrit) 2013/06/03 16:24:11 Since SpeechRecognizer (the base class) is refcoun
janx 2013/06/05 13:51:00 I'll make it private, thanks for spotting this!
28
29 SpeechRecognizerImplAndroid(SpeechRecognitionEventListener* listener,
30 const SpeechRecognitionSessionConfig& config,
31 int session_id);
32
33 void StartRecognition();
Primiano Tucci (use gerrit) 2013/06/03 16:24:11 Shouldn't this be virtual void StartRecognition()
janx 2013/06/05 13:51:00 Indeed, that's a leftover from before SpeechRecogn
34 void AbortRecognition();
35 void StopAudioCapture();
36 bool IsActive() const;
37 bool IsCapturingAudio() const;
38
39 void StartRecognitionJNI(bool continuous, bool partial_results);
Primiano Tucci (use gerrit) 2013/06/03 16:24:11 Shouldn't these three methods be private? Also, ca
janx 2013/06/05 13:51:00 Will do.
40 void CancelRecognitionJNI();
41 void StopRecognitionJNI();
42
Primiano Tucci (use gerrit) 2013/06/03 16:24:11 Add a comment: // Called from Java via JNI.
janx 2013/06/05 13:51:00 Done.
43 void OnAudioStartJNI(JNIEnv* env, jobject obj);
44 void OnSoundStartJNI(JNIEnv* env, jobject obj);
45 void OnSoundEndJNI(JNIEnv* env, jobject obj);
46 void OnRecognitionResultsJNI(JNIEnv* env, jobject obj, jobjectArray strings,
47 jfloatArray floats, jboolean partial);
48 void OnRecognitionErrorJNI(JNIEnv* env, jobject obj, jint error);
49 void OnAudioLevelsChangeJNI(JNIEnv* env, jobject obj, jfloat rms);
Primiano Tucci (use gerrit) 2013/06/03 16:24:11 Looks like here you need an OnRecognitionEndJNI ev
janx 2013/06/05 13:51:00 I'll implement an OnRecognitionEndJNI(e,o) method
50
51 void OnAudioStart();
Primiano Tucci (use gerrit) 2013/06/03 16:24:11 Similar to previous comments: I guess these 6 meth
janx 2013/06/05 13:51:00 Moving to private.
52 void OnSoundStart();
53 void OnSoundEnd();
54 void OnRecognitionResults(std::vector<string16> options,
55 std::vector<float> scores, bool partial);
56 void OnRecognitionError(SpeechRecognitionError error);
57 void OnAudioLevelsChange(float rms);
58
59 private:
60 base::android::ScopedJavaGlobalRef<jobject> j_recognition_;
61
Primiano Tucci (use gerrit) 2013/06/03 16:24:11 Nit: remove blank line.
62 SpeechRecognitionSessionConfig config_;
Primiano Tucci (use gerrit) 2013/06/03 16:24:11 See my previous comment: since it seems you're usi
janx 2013/06/05 13:51:00 Great suggestion, I'll use SpeechRecognitionManage
63
64 DISALLOW_COPY_AND_ASSIGN(SpeechRecognizerImplAndroid);
65 };
66
67 } // namespace content
68
69 #endif // CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_IMPL_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698