During App Launcher install, install V2 App if instructed to do so via environment...
[chromium-blink-merge.git] / content / common / speech_recognition_messages.h
blobf68a48d2c0e78a1ee3e33ebd19f6303e0e096b9c
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // Multiply-included message file, hence no include guard.
7 #include <string>
9 #include "content/public/common/speech_recognition_error.h"
10 #include "content/public/common/speech_recognition_grammar.h"
11 #include "content/public/common/speech_recognition_result.h"
12 #include "ipc/ipc_message_macros.h"
13 #include "ipc/ipc_param_traits.h"
14 #include "ui/gfx/rect.h"
16 #define IPC_MESSAGE_START SpeechRecognitionMsgStart
18 IPC_ENUM_TRAITS(content::SpeechAudioErrorDetails)
19 IPC_ENUM_TRAITS(content::SpeechRecognitionErrorCode)
21 IPC_STRUCT_TRAITS_BEGIN(content::SpeechRecognitionError)
22 IPC_STRUCT_TRAITS_MEMBER(code)
23 IPC_STRUCT_TRAITS_MEMBER(details)
24 IPC_STRUCT_TRAITS_END()
26 IPC_STRUCT_TRAITS_BEGIN(content::SpeechRecognitionHypothesis)
27 IPC_STRUCT_TRAITS_MEMBER(utterance)
28 IPC_STRUCT_TRAITS_MEMBER(confidence)
29 IPC_STRUCT_TRAITS_END()
31 IPC_STRUCT_TRAITS_BEGIN(content::SpeechRecognitionResult)
32 IPC_STRUCT_TRAITS_MEMBER(is_provisional)
33 IPC_STRUCT_TRAITS_MEMBER(hypotheses)
34 IPC_STRUCT_TRAITS_END()
36 IPC_STRUCT_TRAITS_BEGIN(content::SpeechRecognitionGrammar)
37 IPC_STRUCT_TRAITS_MEMBER(url)
38 IPC_STRUCT_TRAITS_MEMBER(weight)
39 IPC_STRUCT_TRAITS_END()
41 // Used to start a speech recognition session.
42 IPC_STRUCT_BEGIN(InputTagSpeechHostMsg_StartRecognition_Params)
43 // The render view requesting speech recognition.
44 IPC_STRUCT_MEMBER(int, render_view_id)
45 // Request ID used within the render view.
46 IPC_STRUCT_MEMBER(int, request_id)
47 // Position of the UI element in page coordinates.
48 IPC_STRUCT_MEMBER(gfx::Rect, element_rect)
49 // Language to use for speech recognition.
50 IPC_STRUCT_MEMBER(std::string, language)
51 // Speech grammar given by the speech recognition element.
52 IPC_STRUCT_MEMBER(std::string, grammar)
53 // URL of the page (or iframe if applicable).
54 IPC_STRUCT_MEMBER(std::string, origin_url)
55 IPC_STRUCT_END()
57 // Renderer -> Browser messages.
59 // Requests the speech recognition service to start speech recognition on behalf
60 // of the given |render_view_id|.
61 IPC_MESSAGE_CONTROL1(InputTagSpeechHostMsg_StartRecognition,
62 InputTagSpeechHostMsg_StartRecognition_Params)
64 // Requests the speech recognition service to cancel speech recognition on
65 // behalf of the given |render_view_id|. If speech recognition is not happening
66 // or is happening on behalf of some other render view, this call does nothing.
67 IPC_MESSAGE_CONTROL2(InputTagSpeechHostMsg_CancelRecognition,
68 int /* render_view_id */,
69 int /* request_id */)
71 // Requests the speech recognition service to stop audio recording on behalf of
72 // the given |render_view_id|. Any audio recorded so far will be fed to the
73 // speech recognizer. If speech recognition is not happening nor or is
74 // happening on behalf of some other render view, this call does nothing.
75 IPC_MESSAGE_CONTROL2(InputTagSpeechHostMsg_StopRecording,
76 int /* render_view_id */,
77 int /* request_id */)
79 // Browser -> Renderer messages.
81 // Relays a speech recognition result, either partial or final.
82 IPC_MESSAGE_ROUTED2(InputTagSpeechMsg_SetRecognitionResults,
83 int /* request_id */,
84 content::SpeechRecognitionResults /* results */)
86 // Indicates that speech recognizer has stopped recording and started
87 // recognition.
88 IPC_MESSAGE_ROUTED1(InputTagSpeechMsg_RecordingComplete,
89 int /* request_id */)
91 // Indicates that speech recognizer has completed recognition. This will be the
92 // last message sent in response to a InputTagSpeechHostMsg_StartRecognition.
93 IPC_MESSAGE_ROUTED1(InputTagSpeechMsg_RecognitionComplete,
94 int /* request_id */)
96 // Toggles speech recognition on or off on the speech input control for the
97 // current focused element. Has no effect if the current element doesn't
98 // support speech recognition.
99 IPC_MESSAGE_ROUTED0(InputTagSpeechMsg_ToggleSpeechInput)
102 // ------- Messages for Speech JS APIs (SpeechRecognitionDispatcher) ----------
104 // Renderer -> Browser messages.
106 // Used to start a speech recognition session.
107 IPC_STRUCT_BEGIN(SpeechRecognitionHostMsg_StartRequest_Params)
108 // The render view requesting speech recognition.
109 IPC_STRUCT_MEMBER(int, render_view_id)
110 // Unique ID associated with the JS object making the calls.
111 IPC_STRUCT_MEMBER(int, request_id)
112 // Language to use for speech recognition.
113 IPC_STRUCT_MEMBER(std::string, language)
114 // Speech grammars to use.
115 IPC_STRUCT_MEMBER(content::SpeechRecognitionGrammarArray, grammars)
116 // URL of the page (or iframe if applicable).
117 IPC_STRUCT_MEMBER(std::string, origin_url)
118 // Maximum number of hypotheses allowed for each results.
119 IPC_STRUCT_MEMBER(uint32, max_hypotheses)
120 // Whether the user requested continuous recognition or not.
121 IPC_STRUCT_MEMBER(bool, continuous)
122 // Whether the user requested interim results or not.
123 IPC_STRUCT_MEMBER(bool, interim_results)
124 IPC_STRUCT_END()
127 // Requests the speech recognition service to start speech recognition.
128 IPC_MESSAGE_CONTROL1(SpeechRecognitionHostMsg_StartRequest,
129 SpeechRecognitionHostMsg_StartRequest_Params)
131 // Requests the speech recognition service to abort speech recognition on
132 // behalf of the given |render_view_id|. If speech recognition is not happening
133 // or is happening on behalf of some other render view, this call does nothing.
134 IPC_MESSAGE_CONTROL2(SpeechRecognitionHostMsg_AbortRequest,
135 int /* render_view_id */,
136 int /* request_id */)
138 // Requests the speech recognition service to stop audio capture on behalf of
139 // the given |render_view_id|. Any audio recorded so far will be fed to the
140 // speech recognizer. If speech recognition is not happening nor or is
141 // happening on behalf of some other render view, this call does nothing.
142 IPC_MESSAGE_CONTROL2(SpeechRecognitionHostMsg_StopCaptureRequest,
143 int /* render_view_id */,
144 int /* request_id */)
146 // Browser -> Renderer messages.
148 // The messages below follow exactly the same semantic of the corresponding
149 // events defined in content/public/browser/speech_recognition_event_listener.h.
150 IPC_MESSAGE_ROUTED2(SpeechRecognitionMsg_ResultRetrieved,
151 int /* request_id */,
152 content::SpeechRecognitionResults /* results */)
154 IPC_MESSAGE_ROUTED2(SpeechRecognitionMsg_ErrorOccurred,
155 int /* request_id */,
156 content::SpeechRecognitionError /* error */)
158 IPC_MESSAGE_ROUTED1(SpeechRecognitionMsg_Started, int /* request_id */)
160 IPC_MESSAGE_ROUTED1(SpeechRecognitionMsg_AudioStarted, int /* request_id */)
162 IPC_MESSAGE_ROUTED1(SpeechRecognitionMsg_SoundStarted, int /* request_id */)
164 IPC_MESSAGE_ROUTED1(SpeechRecognitionMsg_SoundEnded, int /* request_id */)
166 IPC_MESSAGE_ROUTED1(SpeechRecognitionMsg_AudioEnded, int /* request_id */)
168 IPC_MESSAGE_ROUTED1(SpeechRecognitionMsg_Ended, int /* request_id */)