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

Unified Diff: content/public/browser/speech_recognition_event_listener.h

Issue 9688012: Refactoring of chrome speech recognition architecture (CL1.2) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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/public/browser/speech_recognition_event_listener.h
diff --git a/content/public/browser/speech_recognition_event_listener.h b/content/public/browser/speech_recognition_event_listener.h
new file mode 100644
index 0000000000000000000000000000000000000000..3306ca85797cf25a4956a0bc64ecb26b4c8b46a5
--- /dev/null
+++ b/content/public/browser/speech_recognition_event_listener.h
@@ -0,0 +1,68 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_PUBLIC_BROWSER_SPEECH_RECOGNITION_EVENT_LISTENER_H_
+#define CONTENT_PUBLIC_BROWSER_SPEECH_RECOGNITION_EVENT_LISTENER_H_
+
+#include "base/basictypes.h"
+#include "content/common/content_export.h"
+#include "content/public/common/speech_recognition_result.h"
+
+namespace content {
Satish 2012/03/13 15:30:15 add newline after
Primiano Tucci (use gerrit) 2012/03/14 09:40:35 Done.
+// The interface to be implemented by consumers interested in receiving
+// speech recognition events.
+class CONTENT_EXPORT SpeechRecognitionEventListener {
+ public:
+ // Invoked when the StartRequest is received and the recognition process is
+ // started.
+ virtual void OnRecognitionStart(int session_id) = 0;
+
+ // Invoked when the first audio capture is initiated
hans 2012/03/13 14:32:46 nit: period.
Primiano Tucci (use gerrit) 2012/03/14 09:40:35 Done.
+ virtual void OnAudioStart(int session_id) = 0;
+
+ // At the start of recognition, a short amount of audio is recorded to
+ // estimate the environment/background noise and this callback is issued
+ // after that is complete. Typically the delegate brings up any speech
+ // recognition UI once this callback is received.
+ virtual void OnEnvironmentEstimationComplete(int session_id) = 0;
+
+ // Informs that the end pointer has started detecting sound (possibly speech).
+ virtual void OnSoundStart(int session_id) = 0;
+
+ // Informs that the end pointer has stopped detecting sound (a long silence).
+ virtual void OnSoundEnd(int session_id) = 0;
+
+ // Invoked when audio capture stops, either due to the end pointer detecting
+ // silence, an internal error, or an explicit stop was issued.
+ virtual void OnAudioEnd(int session_id) = 0;
+
+ // Invoked when a result is retrieved.
+ virtual void OnRecognitionResult(int session_id,
+ const SpeechRecognitionResult& result) = 0;
+
+ // Invoked if there was an error while capturing or recognizing audio.
+ // The recognition has already been cancelled when this call is made and
+ // no more events will be raised.
+ virtual void OnRecognitionError(int session_id,
+ const SpeechRecognitionErrorCode& error) = 0;
+
+ // Informs of a change in the captured audio level, useful if displaying
+ // a microphone volume indicator while recording.
+ // The value of |volume| and |noise_volume| is in the [0.0, 1.0] range.
+ virtual void OnAudioLevelsChanged(int session_id, float volume,
Satish 2012/03/13 15:30:15 this should be OnAudioLevelsChange to match others
Primiano Tucci (use gerrit) 2012/03/14 09:40:35 Right.
+ float noise_volume) = 0;
+
+ // This is guaranteed to be the last event raised in the recognition
+ // process and the |SpeechRecognizer| object can be freed if necessary.
+ // |success| indicates weather the recognition concluded with at least a
Satish 2012/03/13 15:30:15 Since there are separate OnRecognitionResult and O
Primiano Tucci (use gerrit) 2012/03/14 09:40:35 Right, it was just left from an aborted CL, I did'
+ // result or was aborted (either for an endogenous or exogenous cause).
+ virtual void OnRecognitionEnd(int session_id, bool success) = 0;
+
+protected:
+ virtual ~SpeechRecognitionEventListener() { }
+};
+
+} // namespace content
hans 2012/03/13 14:32:46 nit: two spaces between } and //
Satish 2012/03/13 15:30:15 2 spaces before //
Primiano Tucci (use gerrit) 2012/03/14 09:40:35 Done.
Primiano Tucci (use gerrit) 2012/03/14 09:40:35 Done.
+
+#endif // CONTENT_PUBLIC_BROWSER_SPEECH_RECOGNITION_EVENT_LISTENER_H_
hans 2012/03/13 14:32:46 nit: two spaces
Satish 2012/03/13 15:30:15 ditto
Primiano Tucci (use gerrit) 2012/03/14 09:40:35 Done.
Primiano Tucci (use gerrit) 2012/03/14 09:40:35 Done.

Powered by Google App Engine
This is Rietveld 408576698