Index: content/common/speech_recognition_messages.h |
diff --git a/content/common/speech_recognition_messages.h b/content/common/speech_recognition_messages.h |
index dc3ceb38e4011fa8705ec5047c664e80e9a5c9b8..ed3803f18b97c95b427e3b9a0574ad560afbbcdf 100644 |
--- a/content/common/speech_recognition_messages.h |
+++ b/content/common/speech_recognition_messages.h |
@@ -7,6 +7,7 @@ |
#include <string> |
#include "content/public/common/speech_recognition_error.h" |
+#include "content/public/common/speech_recognition_grammar.h" |
#include "content/public/common/speech_recognition_result.h" |
#include "ipc/ipc_message_macros.h" |
#include "ipc/ipc_param_traits.h" |
@@ -14,17 +15,29 @@ |
#define IPC_MESSAGE_START SpeechRecognitionMsgStart |
+IPC_ENUM_TRAITS(content::SpeechAudioErrorDetails) |
IPC_ENUM_TRAITS(content::SpeechRecognitionErrorCode) |
+IPC_STRUCT_TRAITS_BEGIN(content::SpeechRecognitionError) |
+ IPC_STRUCT_TRAITS_MEMBER(code) |
+ IPC_STRUCT_TRAITS_MEMBER(details) |
+IPC_STRUCT_TRAITS_END() |
+ |
IPC_STRUCT_TRAITS_BEGIN(content::SpeechRecognitionHypothesis) |
IPC_STRUCT_TRAITS_MEMBER(utterance) |
IPC_STRUCT_TRAITS_MEMBER(confidence) |
IPC_STRUCT_TRAITS_END() |
IPC_STRUCT_TRAITS_BEGIN(content::SpeechRecognitionResult) |
+ IPC_STRUCT_TRAITS_MEMBER(provisional) |
IPC_STRUCT_TRAITS_MEMBER(hypotheses) |
IPC_STRUCT_TRAITS_END() |
+IPC_STRUCT_TRAITS_BEGIN(content::SpeechRecognitionGrammar) |
+ IPC_STRUCT_TRAITS_MEMBER(url) |
+ IPC_STRUCT_TRAITS_MEMBER(weight) |
+IPC_STRUCT_TRAITS_END() |
+ |
// Used to start a speech recognition session. |
IPC_STRUCT_BEGIN(InputTagSpeechHostMsg_StartRecognition_Params) |
// The render view requesting speech recognition. |
@@ -41,7 +54,7 @@ IPC_STRUCT_BEGIN(InputTagSpeechHostMsg_StartRecognition_Params) |
IPC_STRUCT_MEMBER(std::string, origin_url) |
IPC_STRUCT_END() |
-// Speech recognition messages sent from the renderer to the browser. |
+// Renderer -> Browser messages. |
// Requests the speech recognition service to start speech recognition on behalf |
// of the given |render_view_id|. |
@@ -63,7 +76,7 @@ IPC_MESSAGE_CONTROL2(InputTagSpeechHostMsg_StopRecording, |
int /* render_view_id */, |
int /* request_id */) |
-// Speech recognition messages sent from the browser to the renderer. |
+// Browser -> Renderer messages. |
// Relay a speech recognition result, either partial or final. |
IPC_MESSAGE_ROUTED2(InputTagSpeechMsg_SetRecognitionResult, |
@@ -84,3 +97,61 @@ IPC_MESSAGE_ROUTED1(InputTagSpeechMsg_RecognitionComplete, |
// current focused element. Has no effect if the current element doesn't |
// support speech recognition. |
IPC_MESSAGE_ROUTED0(InputTagSpeechMsg_ToggleSpeechInput) |
+ |
+ |
+// ------- Messages for Speech JS APIs (SpeechRecognitionDispatcher) ---------- |
+ |
+// Used to start a speech recognition session. |
+IPC_STRUCT_BEGIN(SpeechRecognitionHostMsg_StartRequest_Params) |
+ // The render view requesting speech recognition. |
+ IPC_STRUCT_MEMBER(int, render_view_id) |
+ // Unique ID associated to the JS object making the calls. |
+ IPC_STRUCT_MEMBER(int, js_handle_id) |
+ // Language to use for speech recognition. |
+ IPC_STRUCT_MEMBER(std::string, language) |
+ // Speech grammar to use. |
hans
2012/04/26 16:23:25
nit: s/grammar/grammars/
Primiano Tucci (use gerrit)
2012/04/27 09:27:13
Done.
|
+ IPC_STRUCT_MEMBER(content::SpeechRecognitionGrammarArray, grammars) |
+ // URL of the page (or iframe if applicable). |
+ IPC_STRUCT_MEMBER(std::string, origin_url) |
+ // Continuous recognition mode. |
+ IPC_STRUCT_MEMBER(bool, continuous) |
+IPC_STRUCT_END() |
+ |
+// Render -> Browser messages. |
+ |
+// Requests the speech recognition service to start speech recognition on behalf |
+// of the given |render_view_id|. |
+IPC_MESSAGE_CONTROL1(SpeechRecognitionHostMsg_StartRequest, |
+ SpeechRecognitionHostMsg_StartRequest_Params) |
+ |
+// Requests the speech recognition service to abort speech recognition on |
+// behalf of the given |render_view_id|. If speech recognition is not happening |
+// or is happening on behalf of some other render view, this call does nothing. |
+IPC_MESSAGE_CONTROL2(SpeechRecognitionHostMsg_AbortRequest, |
+ int /* render_view_id */, |
+ int /* js_handle_id */) |
+ |
+// Requests the speech recognition service to stop audio capture on behalf of |
+// the given |render_view_id|. Any audio recorded so far will be fed to the |
+// speech recognizer. If speech recognition is not happening nor or is |
+// happening on behalf of some other render view, this call does nothing. |
+IPC_MESSAGE_CONTROL2(SpeechRecognitionHostMsg_StopCaptureRequest, |
+ int /* render_view_id */, |
+ int /* js_handle_id */) |
+ |
+// Browser -> Render messages. |
+ |
+IPC_MESSAGE_ROUTED2(SpeechRecognitionMsg_ResultRetrieved, |
hans
2012/04/26 16:23:25
we should probably have comments for this, and the
|
+ int /* js_handle_id */, |
+ content::SpeechRecognitionResult /* result */) |
+ |
+IPC_MESSAGE_ROUTED2(SpeechRecognitionMsg_ErrorOccurred, |
+ int /* js_handle_id */, |
+ content::SpeechRecognitionError /* error */) |
+ |
+IPC_MESSAGE_ROUTED1(SpeechRecognitionMsg_Started, int /* js_handle_id */) |
+IPC_MESSAGE_ROUTED1(SpeechRecognitionMsg_AudioStarted, int /* js_handle_id */) |
+IPC_MESSAGE_ROUTED1(SpeechRecognitionMsg_SoundStarted, int /* js_handle_id */) |
+IPC_MESSAGE_ROUTED1(SpeechRecognitionMsg_SoundEnded, int /* js_handle_id */) |
+IPC_MESSAGE_ROUTED1(SpeechRecognitionMsg_AudioEnded, int /* js_handle_id */) |
+IPC_MESSAGE_ROUTED1(SpeechRecognitionMsg_Ended, int /* js_handle_id */) |