| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Multiply-included message file, hence no include guard. | 5 // Multiply-included message file, hence no include guard. |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "content/public/common/speech_input_result.h" | 9 #include "content/public/common/speech_recognition_result.h" |
| 10 #include "ipc/ipc_message_macros.h" | 10 #include "ipc/ipc_message_macros.h" |
| 11 #include "ipc/ipc_param_traits.h" | 11 #include "ipc/ipc_param_traits.h" |
| 12 #include "ui/gfx/rect.h" | 12 #include "ui/gfx/rect.h" |
| 13 | 13 |
| 14 #define IPC_MESSAGE_START SpeechInputMsgStart | 14 #define IPC_MESSAGE_START SpeechRecognitionMsgStart |
| 15 | 15 |
| 16 IPC_ENUM_TRAITS(content::SpeechInputError) | 16 IPC_ENUM_TRAITS(content::SpeechRecognitionErrorCode) |
| 17 | 17 |
| 18 IPC_STRUCT_TRAITS_BEGIN(content::SpeechInputHypothesis) | 18 IPC_STRUCT_TRAITS_BEGIN(content::SpeechRecognitionHypothesis) |
| 19 IPC_STRUCT_TRAITS_MEMBER(utterance) | 19 IPC_STRUCT_TRAITS_MEMBER(utterance) |
| 20 IPC_STRUCT_TRAITS_MEMBER(confidence) | 20 IPC_STRUCT_TRAITS_MEMBER(confidence) |
| 21 IPC_STRUCT_TRAITS_END() | 21 IPC_STRUCT_TRAITS_END() |
| 22 | 22 |
| 23 IPC_STRUCT_TRAITS_BEGIN(content::SpeechInputResult) | 23 IPC_STRUCT_TRAITS_BEGIN(content::SpeechRecognitionResult) |
| 24 IPC_STRUCT_TRAITS_MEMBER(error) | 24 IPC_STRUCT_TRAITS_MEMBER(error) |
| 25 IPC_STRUCT_TRAITS_MEMBER(hypotheses) | 25 IPC_STRUCT_TRAITS_MEMBER(hypotheses) |
| 26 IPC_STRUCT_TRAITS_END() | 26 IPC_STRUCT_TRAITS_END() |
| 27 | 27 |
| 28 // Used to start a speech recognition session. | 28 // Used to start a speech recognition session. |
| 29 IPC_STRUCT_BEGIN(SpeechInputHostMsg_StartRecognition_Params) | 29 IPC_STRUCT_BEGIN(InputTagSpeechHostMsg_StartRecognition_Params) |
| 30 // The render view requesting speech recognition. | 30 // The render view requesting speech recognition. |
| 31 IPC_STRUCT_MEMBER(int, render_view_id) | 31 IPC_STRUCT_MEMBER(int, render_view_id) |
| 32 // Request ID used within the render view. | 32 // Request ID used within the render view. |
| 33 IPC_STRUCT_MEMBER(int, request_id) | 33 IPC_STRUCT_MEMBER(int, request_id) |
| 34 // Position of the UI element in page coordinates. | 34 // Position of the UI element in page coordinates. |
| 35 IPC_STRUCT_MEMBER(gfx::Rect, element_rect) | 35 IPC_STRUCT_MEMBER(gfx::Rect, element_rect) |
| 36 // Language to use for speech recognition. | 36 // Language to use for speech recognition. |
| 37 IPC_STRUCT_MEMBER(std::string, language) | 37 IPC_STRUCT_MEMBER(std::string, language) |
| 38 // Speech grammar given by the speech input element. | 38 // Speech grammar given by the speech recognition element. |
| 39 IPC_STRUCT_MEMBER(std::string, grammar) | 39 IPC_STRUCT_MEMBER(std::string, grammar) |
| 40 // URL of the page (or iframe if applicable). | 40 // URL of the page (or iframe if applicable). |
| 41 IPC_STRUCT_MEMBER(std::string, origin_url) | 41 IPC_STRUCT_MEMBER(std::string, origin_url) |
| 42 IPC_STRUCT_END() | 42 IPC_STRUCT_END() |
| 43 | 43 |
| 44 // Speech input messages sent from the renderer to the browser. | 44 // Speech recognition messages sent from the renderer to the browser. |
| 45 | 45 |
| 46 // Requests the speech input service to start speech recognition on behalf of | 46 // Requests the speech recognition service to start speech recognition on behalf |
| 47 // the given |render_view_id|. | 47 // of the given |render_view_id|. |
| 48 IPC_MESSAGE_CONTROL1(SpeechInputHostMsg_StartRecognition, | 48 IPC_MESSAGE_CONTROL1(InputTagSpeechHostMsg_StartRecognition, |
| 49 SpeechInputHostMsg_StartRecognition_Params) | 49 InputTagSpeechHostMsg_StartRecognition_Params) |
| 50 | 50 |
| 51 // Requests the speech input service to cancel speech recognition on behalf of | 51 // Requests the speech recognition service to cancel speech recognition on |
| 52 // the given |render_view_id|. If speech recognition is not happening or | 52 // behalf of the given |render_view_id|. If speech recognition is not happening |
| 53 // is happening on behalf of some other render view, this call does nothing. | 53 // or is happening on behalf of some other render view, this call does nothing. |
| 54 IPC_MESSAGE_CONTROL2(SpeechInputHostMsg_CancelRecognition, | 54 IPC_MESSAGE_CONTROL2(InputTagSpeechHostMsg_CancelRecognition, |
| 55 int /* render_view_id */, | 55 int /* render_view_id */, |
| 56 int /* request_id */) | 56 int /* request_id */) |
| 57 | 57 |
| 58 // Requests the speech input service to stop audio recording on behalf of | 58 // Requests the speech recognition service to stop audio recording on behalf of |
| 59 // the given |render_view_id|. Any audio recorded so far will be fed to the | 59 // the given |render_view_id|. Any audio recorded so far will be fed to the |
| 60 // speech recognizer. If speech recognition is not happening nor or is | 60 // speech recognizer. If speech recognition is not happening nor or is |
| 61 // happening on behalf of some other render view, this call does nothing. | 61 // happening on behalf of some other render view, this call does nothing. |
| 62 IPC_MESSAGE_CONTROL2(SpeechInputHostMsg_StopRecording, | 62 IPC_MESSAGE_CONTROL2(InputTagSpeechHostMsg_StopRecording, |
| 63 int /* render_view_id */, | 63 int /* render_view_id */, |
| 64 int /* request_id */) | 64 int /* request_id */) |
| 65 | 65 |
| 66 // Speech input messages sent from the browser to the renderer. | 66 // Speech recognition messages sent from the browser to the renderer. |
| 67 | 67 |
| 68 // Relay a speech recognition result, either partial or final. | 68 // Relay a speech recognition result, either partial or final. |
| 69 IPC_MESSAGE_ROUTED2(SpeechInputMsg_SetRecognitionResult, | 69 IPC_MESSAGE_ROUTED2(InputTagSpeechMsg_SetRecognitionResult, |
| 70 int /* request_id */, | 70 int /* request_id */, |
| 71 content::SpeechInputResult /* result */) | 71 content::SpeechRecognitionResult /* result */) |
| 72 | 72 |
| 73 // Indicate that speech recognizer has stopped recording and started | 73 // Indicate that speech recognizer has stopped recording and started |
| 74 // recognition. | 74 // recognition. |
| 75 IPC_MESSAGE_ROUTED1(SpeechInputMsg_RecordingComplete, | 75 IPC_MESSAGE_ROUTED1(InputTagSpeechMsg_RecordingComplete, |
| 76 int /* request_id */) | 76 int /* request_id */) |
| 77 | 77 |
| 78 // Indicate that speech recognizer has completed recognition. This will be | 78 // Indicate that speech recognizer has completed recognition. This will be the |
| 79 // the last message sent in response to a | 79 // last message sent in response to a InputTagSpeechHostMsg_StartRecognition. |
| 80 // ViewHostMsg_SpeechInput_StartRecognition. | 80 IPC_MESSAGE_ROUTED1(InputTagSpeechMsg_RecognitionComplete, |
| 81 IPC_MESSAGE_ROUTED1(SpeechInputMsg_RecognitionComplete, | |
| 82 int /* request_id */) | 81 int /* request_id */) |
| 83 | 82 |
| 84 // Toggle speech input on or off on the speech input control for the | 83 // Toggle speech recognition on or off on the speech input control for the |
| 85 // current focused element. Has no effect if the current element doesn't | 84 // current focused element. Has no effect if the current element doesn't |
| 86 // support speech input. | 85 // support speech recognition. |
| 87 IPC_MESSAGE_ROUTED0(SpeechInputMsg_ToggleSpeechInput) | 86 IPC_MESSAGE_ROUTED0(InputTagSpeechMsg_ToggleSpeechInput) |
| OLD | NEW |