diff options
author | primiano@chromium.org <primiano@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-14 20:29:51 +0000 |
---|---|---|
committer | primiano@chromium.org <primiano@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-14 20:29:51 +0000 |
commit | d1a4c7973734f2c2f7fb7e3fa2dd2e47bc3cfcaf (patch) | |
tree | 833d5a190c0513919c270382d3ef9bd39956b223 /content/browser/speech/speech_recognizer_impl.h | |
parent | c70c94f9fd39ed98f94abf8962903874bff093f0 (diff) | |
download | chromium_src-d1a4c7973734f2c2f7fb7e3fa2dd2e47bc3cfcaf.zip chromium_src-d1a4c7973734f2c2f7fb7e3fa2dd2e47bc3cfcaf.tar.gz chromium_src-d1a4c7973734f2c2f7fb7e3fa2dd2e47bc3cfcaf.tar.bz2 |
Removed the SpeechRecognizerDelegate interface and replaced with SpeechRecognitionEventListener. By now it might seem just a rename of the former interface, however this interface will gradually incorporate, in the next CLs, the other delegates and become the reference interface used by all clients to interact with SpeechRecognition inside Chrome.
BUG=116954
TEST=none
Review URL: http://codereview.chromium.org/9688012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@126721 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/speech/speech_recognizer_impl.h')
-rw-r--r-- | content/browser/speech/speech_recognizer_impl.h | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/content/browser/speech/speech_recognizer_impl.h b/content/browser/speech/speech_recognizer_impl.h index eaec3e3..1b93fcd 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_; |