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

Unified Diff: content/browser/speech/speech_recognizer_impl.h

Issue 9688012: Refactoring of chrome speech recognition architecture (CL1.2) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Minor fix in recognizer unit test due to "others" CL in the middle (9692038) Created 8 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/speech/speech_recognizer_impl.h
diff --git a/content/browser/speech/speech_recognizer_impl.h b/content/browser/speech/speech_recognizer_impl.h
index eaec3e3b86a84c614044f6741aa0ee6599d50f4e..1b93fcd01b337763c184e5e118806ab9b42c22cd 100644
--- a/content/browser/speech/speech_recognizer_impl.h
+++ b/content/browser/speech/speech_recognizer_impl.h
@@ -19,6 +19,10 @@
class AudioManager;
+namespace content {
+class SpeechRecognitionEventListener;
+}
+
namespace speech {
// Records audio, sends recorded audio to server and translates server response
@@ -28,7 +32,14 @@ class CONTENT_EXPORT SpeechRecognizerImpl
public media::AudioInputController::EventHandler,
public SpeechRecognitionRequestDelegate {
public:
- SpeechRecognizerImpl(content::SpeechRecognizerDelegate* delegate,
+ static const int kAudioSampleRate;
+ static const int kAudioPacketIntervalMs; // Duration of each audio packet.
+ static const ChannelLayout kChannelLayout;
+ static const int kNumBitsPerAudioSample;
+ static const int kNoSpeechTimeoutSec;
+ static const int kEndpointerEstimationTimeMs;
+
+ SpeechRecognizerImpl(content::SpeechRecognitionEventListener* listener,
int caller_id,
const std::string& language,
const std::string& grammar,
@@ -39,12 +50,12 @@ class CONTENT_EXPORT SpeechRecognizerImpl
virtual ~SpeechRecognizerImpl();
- // SpeechRecognizer implementation:
- virtual bool StartRecording() OVERRIDE;
- virtual void CancelRecognition() OVERRIDE;
-
- // Stops recording audio and starts recognition.
- void StopRecording();
+ // content::SpeechRecognizer methods.
+ virtual bool StartRecognition() OVERRIDE;
+ virtual void AbortRecognition() OVERRIDE;
+ virtual void StopAudioCapture() OVERRIDE;
+ virtual bool IsActive() const OVERRIDE;
+ virtual bool IsCapturingAudio() const OVERRIDE;
// AudioInputController::EventHandler methods.
virtual void OnCreated(media::AudioInputController* controller) OVERRIDE {}
@@ -59,17 +70,10 @@ class CONTENT_EXPORT SpeechRecognizerImpl
virtual void SetRecognitionResult(
const content::SpeechRecognitionResult& result) OVERRIDE;
- static const int kAudioSampleRate;
- static const int kAudioPacketIntervalMs; // Duration of each audio packet.
- static const ChannelLayout kChannelLayout;
- static const int kNumBitsPerAudioSample;
- static const int kNoSpeechTimeoutSec;
- static const int kEndpointerEstimationTimeMs;
-
private:
- friend class SpeechRecognizerTest;
+ friend class SpeechRecognizerImplTest;
- void InformErrorAndCancelRecognition(
+ void InformErrorAndAbortRecognition(
content::SpeechRecognitionErrorCode error);
void SendRecordedAudioToServer();
@@ -83,7 +87,7 @@ class CONTENT_EXPORT SpeechRecognizerImpl
void SetAudioManagerForTesting(AudioManager* audio_manager);
- content::SpeechRecognizerDelegate* delegate_;
+ content::SpeechRecognitionEventListener* listener_;
int caller_id_;
std::string language_;
std::string grammar_;
« no previous file with comments | « content/browser/speech/speech_recognition_manager_impl.cc ('k') | content/browser/speech/speech_recognizer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698