OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2011 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. | |
4 | |
5 #ifndef CHROME_COMMON_SPEECH_INPUT_MESSAGES_H_ | |
6 #define CHROME_COMMON_SPEECH_INPUT_MESSAGES_H_ | |
7 #pragma once | |
8 | |
9 #include "chrome/common/speech_input_result.h" | |
10 #include "gfx/rect.h" | |
11 #include "ipc/ipc_message_macros.h" | |
12 #include "ipc/ipc_param_traits.h" | |
13 | |
14 #define IPC_MESSAGE_START SpeechInputMsgStart | |
15 | |
16 namespace speech_input { | |
17 struct SpeechInputResultItem; | |
18 } | |
19 | |
20 // Used to start a speech recognition session. | |
21 struct SpeechInputHostMsg_StartRecognition_Params { | |
22 SpeechInputHostMsg_StartRecognition_Params(); | |
23 ~SpeechInputHostMsg_StartRecognition_Params(); | |
24 | |
25 int render_view_id; // The render view requesting speech recognition. | |
26 int request_id; // Request ID used within the render view. | |
27 gfx::Rect element_rect; // Position of the UI element in page coordinates. | |
28 std::string language; // Language to use for speech recognition. | |
29 std::string grammar; // Speech grammar given by the speech input element. | |
30 std::string origin_url; // URL of the page (or iframe if applicable). | |
31 }; | |
32 | |
33 namespace IPC { | |
34 | |
35 template <> | |
36 struct ParamTraits<speech_input::SpeechInputResultItem> { | |
37 typedef speech_input::SpeechInputResultItem param_type; | |
38 static void Write(Message* m, const param_type& p); | |
39 static bool Read(const Message* m, void** iter, param_type* p); | |
40 static void Log(const param_type& p, std::string* l); | |
41 }; | |
42 | |
43 template <> | |
44 struct ParamTraits<SpeechInputHostMsg_StartRecognition_Params> { | |
45 typedef SpeechInputHostMsg_StartRecognition_Params param_type; | |
46 static void Write(Message* m, const param_type& p); | |
47 static bool Read(const Message* m, void** iter, param_type* p); | |
48 static void Log(const param_type& p, std::string* l); | |
49 }; | |
50 | |
51 } // namespace IPC | |
52 | |
53 // Speech input messages sent from the renderer to the browser. | |
54 | |
55 // Requests the speech input service to start speech recognition on behalf of | |
56 // the given |render_view_id|. | |
57 IPC_MESSAGE_CONTROL1(SpeechInputHostMsg_StartRecognition, | |
58 SpeechInputHostMsg_StartRecognition_Params) | |
59 | |
60 // Requests the speech input service to cancel speech recognition on behalf of | |
61 // the given |render_view_id|. If speech recognition is not happening nor or | |
62 // is happening on behalf of some other render view, this call does nothing. | |
63 IPC_MESSAGE_CONTROL2(SpeechInputHostMsg_CancelRecognition, | |
64 int /* render_view_id */, | |
65 int /* request id */) | |
jam
2011/01/19 20:29:23
nit: the usual style for parameter names inside th
Satish
2011/01/20 11:04:12
Changed to 'request_id' in all these declarations
| |
66 | |
67 // Requests the speech input service to stop audio recording on behalf of | |
68 // the given |render_view_id|. Any audio recorded so far will be fed to the | |
69 // speech recognizer. If speech recognition is not happening nor or is | |
hans
2011/01/20 09:29:29
"nor or" ?
Satish
2011/01/20 11:04:12
Removed 'nor'
| |
70 // happening on behalf of some other render view, this call does nothing. | |
71 IPC_MESSAGE_CONTROL2(SpeechInputHostMsg_StopRecording, | |
72 int /* render_view_id */, | |
73 int /* request id */) | |
74 | |
75 // Speech input messages sent from the browser to the renderer. | |
76 | |
77 // Relay a speech recognition result, either partial or final. | |
78 IPC_MESSAGE_ROUTED2(SpeechInputMsg_SetRecognitionResult, | |
79 int /* request id */, | |
80 speech_input::SpeechInputResultArray /* result */) | |
81 | |
82 // Indicate that speech recognizer has stopped recording and started | |
83 // recognition. | |
84 IPC_MESSAGE_ROUTED1(SpeechInputMsg_RecordingComplete, | |
85 int /* request id */) | |
86 | |
87 // Indicate that speech recognizer has completed recognition. This will be | |
88 // the last message sent in response to a | |
89 // ViewHostMsg_SpeechInput_StartRecognition. | |
90 IPC_MESSAGE_ROUTED1(SpeechInputMsg_RecognitionComplete, | |
91 int /* request id */) | |
92 | |
93 #endif // CHROME_COMMON_SPEECH_INPUT_MESSAGES_H_ | |
OLD | NEW |