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

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

Issue 8137005: Applying changes to the existing speech input code to support the extension API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review and unit test fixes. Created 9 years, 2 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.h
diff --git a/content/browser/speech/speech_recognizer.h b/content/browser/speech/speech_recognizer.h
index bd1c8e4112038c073c55ebfe6da42d92b8d2acfb..246c97b5fe8f3a672f5a232673721f2ba190cd3f 100644
--- a/content/browser/speech/speech_recognizer.h
+++ b/content/browser/speech/speech_recognizer.h
@@ -30,21 +30,13 @@ class CONTENT_EXPORT SpeechRecognizer
public media::AudioInputController::EventHandler,
public SpeechRecognitionRequestDelegate {
public:
- enum ErrorCode {
- RECOGNIZER_NO_ERROR,
- RECOGNIZER_ERROR_CAPTURE,
- RECOGNIZER_ERROR_NO_SPEECH,
- RECOGNIZER_ERROR_NO_RESULTS,
- RECOGNIZER_ERROR_NETWORK,
- };
-
// Implemented by the caller to receive recognition events.
class CONTENT_EXPORT Delegate {
public:
virtual void SetRecognitionResult(
int caller_id,
bool error,
- const SpeechInputResultArray& result) = 0;
+ const SpeechInputResult& result) = 0;
// Invoked when the first audio packet was received from the audio capture
// device.
@@ -60,12 +52,18 @@ class CONTENT_EXPORT SpeechRecognizer
// sequence and the |SpeechRecognizer| object can be freed up if necessary.
virtual void DidCompleteRecognition(int caller_id) = 0;
+ // Informs that the end pointer has started detecting input speech.
Satish 2011/10/06 09:09:06 "input speech" -> "speech"
Leandro Graciá Gil 2011/10/06 18:26:25 Done.
+ virtual void DidStartReceivingSpeech(int caller_id) = 0;
+
+ // Informs that the end pointer has stopped detecting input speech.
Satish 2011/10/06 09:09:06 ditto
Leandro Graciá Gil 2011/10/06 18:26:25 Done.
+ virtual void DidStopReceivingSpeech(int caller_id) = 0;
+
// Invoked if there was an error while recording or recognizing audio. The
// session has already been cancelled when this call is made and the DidXxxx
// callbacks will not be issued. It is safe to destroy/release the
// |SpeechRecognizer| object while processing this call.
virtual void OnRecognizerError(int caller_id,
- SpeechRecognizer::ErrorCode error) = 0;
+ SpeechInputError error) = 0;
// At the start of recognition, a short amount of audio is recorded to
// estimate the environment/background noise and this callback is issued
@@ -91,6 +89,7 @@ class CONTENT_EXPORT SpeechRecognizer
bool censor_results,
const std::string& hardware_info,
const std::string& origin_url);
+
virtual ~SpeechRecognizer();
// Starts audio recording and does recognition after recording ends. The same
@@ -116,7 +115,7 @@ class CONTENT_EXPORT SpeechRecognizer
// SpeechRecognitionRequest::Delegate methods.
virtual void SetRecognitionResult(bool error,
- const SpeechInputResultArray& result);
+ const SpeechInputResult& result);
Satish 2011/10/06 09:09:06 could align with the previous param?
Leandro Graciá Gil 2011/10/06 18:26:25 Done.
static const int kAudioSampleRate;
static const int kAudioPacketIntervalMs; // Duration of each audio packet.
@@ -126,7 +125,7 @@ class CONTENT_EXPORT SpeechRecognizer
static const int kEndpointerEstimationTimeMs;
private:
- void InformErrorAndCancelRecognition(ErrorCode error);
+ void InformErrorAndCancelRecognition(SpeechInputError error);
void SendRecordedAudioToServer();
void HandleOnError(int error_code); // Handles OnError in the IO thread.

Powered by Google App Engine
This is Rietveld 408576698