Update V8 to version 4.7.42.
[chromium-blink-merge.git] / content / common / input_messages.h
blob85796f715f08de65a205c2730db9efd30cf85600
1 // Copyright (c) 2013 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 // IPC messages for input events and other messages that require processing in
6 // order relative to input events.
7 // Multiply-included message file, hence no include guard.
9 #include "base/strings/string16.h"
10 #include "content/common/content_export.h"
11 #include "content/common/content_param_traits.h"
12 #include "content/common/edit_command.h"
13 #include "content/common/input/did_overscroll_params.h"
14 #include "content/common/input/input_event.h"
15 #include "content/common/input/input_event_ack.h"
16 #include "content/common/input/input_event_ack_state.h"
17 #include "content/common/input/input_param_traits.h"
18 #include "content/common/input/synthetic_gesture_packet.h"
19 #include "content/common/input/synthetic_gesture_params.h"
20 #include "content/common/input/synthetic_pinch_gesture_params.h"
21 #include "content/common/input/synthetic_smooth_drag_gesture_params.h"
22 #include "content/common/input/synthetic_smooth_scroll_gesture_params.h"
23 #include "content/common/input/synthetic_tap_gesture_params.h"
24 #include "content/common/input/touch_action.h"
25 #include "content/public/common/common_param_traits.h"
26 #include "ipc/ipc_message_macros.h"
27 #include "third_party/WebKit/public/web/WebInputEvent.h"
28 #include "ui/events/ipc/latency_info_param_traits.h"
29 #include "ui/gfx/geometry/point.h"
30 #include "ui/gfx/geometry/rect.h"
31 #include "ui/gfx/geometry/vector2d_f.h"
32 #include "ui/gfx/ipc/gfx_param_traits.h"
33 #include "ui/gfx/range/range.h"
35 #undef IPC_MESSAGE_EXPORT
36 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
38 #ifdef IPC_MESSAGE_START
39 #error IPC_MESSAGE_START
40 #endif
42 #define IPC_MESSAGE_START InputMsgStart
44 IPC_ENUM_TRAITS_MAX_VALUE(content::InputEventAckState,
45 content::INPUT_EVENT_ACK_STATE_MAX)
46 IPC_ENUM_TRAITS_MAX_VALUE(
47 content::SyntheticGestureParams::GestureSourceType,
48 content::SyntheticGestureParams::GESTURE_SOURCE_TYPE_MAX)
49 IPC_ENUM_TRAITS_MAX_VALUE(
50 content::SyntheticGestureParams::GestureType,
51 content::SyntheticGestureParams::SYNTHETIC_GESTURE_TYPE_MAX)
52 IPC_ENUM_TRAITS_VALIDATE(content::TouchAction, (
53 value >= 0 &&
54 value <= content::TOUCH_ACTION_MAX &&
55 (!(value & content::TOUCH_ACTION_NONE) ||
56 (value == content::TOUCH_ACTION_NONE)) &&
57 (!(value & content::TOUCH_ACTION_PINCH_ZOOM) ||
58 (value == content::TOUCH_ACTION_MANIPULATION))))
60 IPC_STRUCT_TRAITS_BEGIN(content::DidOverscrollParams)
61 IPC_STRUCT_TRAITS_MEMBER(accumulated_overscroll)
62 IPC_STRUCT_TRAITS_MEMBER(latest_overscroll_delta)
63 IPC_STRUCT_TRAITS_MEMBER(current_fling_velocity)
64 IPC_STRUCT_TRAITS_MEMBER(causal_event_viewport_point)
65 IPC_STRUCT_TRAITS_END()
67 IPC_STRUCT_TRAITS_BEGIN(content::EditCommand)
68 IPC_STRUCT_TRAITS_MEMBER(name)
69 IPC_STRUCT_TRAITS_MEMBER(value)
70 IPC_STRUCT_TRAITS_END()
72 IPC_STRUCT_TRAITS_BEGIN(content::InputEvent)
73 IPC_STRUCT_TRAITS_MEMBER(web_event)
74 IPC_STRUCT_TRAITS_MEMBER(latency_info)
75 IPC_STRUCT_TRAITS_MEMBER(is_keyboard_shortcut)
76 IPC_STRUCT_TRAITS_END()
78 IPC_STRUCT_TRAITS_BEGIN(content::SyntheticGestureParams)
79 IPC_STRUCT_TRAITS_MEMBER(gesture_source_type)
80 IPC_STRUCT_TRAITS_END()
82 IPC_STRUCT_TRAITS_BEGIN(content::SyntheticSmoothDragGestureParams)
83 IPC_STRUCT_TRAITS_PARENT(content::SyntheticGestureParams)
84 IPC_STRUCT_TRAITS_MEMBER(start_point)
85 IPC_STRUCT_TRAITS_MEMBER(distances)
86 IPC_STRUCT_TRAITS_MEMBER(speed_in_pixels_s)
87 IPC_STRUCT_TRAITS_END()
89 IPC_STRUCT_TRAITS_BEGIN(content::SyntheticSmoothScrollGestureParams)
90 IPC_STRUCT_TRAITS_PARENT(content::SyntheticGestureParams)
91 IPC_STRUCT_TRAITS_MEMBER(anchor)
92 IPC_STRUCT_TRAITS_MEMBER(distances)
93 IPC_STRUCT_TRAITS_MEMBER(prevent_fling)
94 IPC_STRUCT_TRAITS_MEMBER(speed_in_pixels_s)
95 IPC_STRUCT_TRAITS_END()
97 IPC_STRUCT_TRAITS_BEGIN(content::SyntheticPinchGestureParams)
98 IPC_STRUCT_TRAITS_PARENT(content::SyntheticGestureParams)
99 IPC_STRUCT_TRAITS_MEMBER(scale_factor)
100 IPC_STRUCT_TRAITS_MEMBER(anchor)
101 IPC_STRUCT_TRAITS_MEMBER(relative_pointer_speed_in_pixels_s)
102 IPC_STRUCT_TRAITS_END()
104 IPC_STRUCT_TRAITS_BEGIN(content::SyntheticTapGestureParams)
105 IPC_STRUCT_TRAITS_PARENT(content::SyntheticGestureParams)
106 IPC_STRUCT_TRAITS_MEMBER(position)
107 IPC_STRUCT_TRAITS_MEMBER(duration_ms)
108 IPC_STRUCT_TRAITS_END()
110 IPC_STRUCT_TRAITS_BEGIN(content::InputEventAck)
111 IPC_STRUCT_TRAITS_MEMBER(type)
112 IPC_STRUCT_TRAITS_MEMBER(state)
113 IPC_STRUCT_TRAITS_MEMBER(latency)
114 IPC_STRUCT_TRAITS_MEMBER(overscroll)
115 IPC_STRUCT_TRAITS_MEMBER(unique_touch_event_id)
116 IPC_STRUCT_TRAITS_END()
118 // Sends an input event to the render widget.
119 IPC_MESSAGE_ROUTED3(InputMsg_HandleInputEvent,
120 IPC::WebInputEventPointer /* event */,
121 ui::LatencyInfo /* latency_info */,
122 bool /* is_keyboard_shortcut */)
124 // Sends the cursor visibility state to the render widget.
125 IPC_MESSAGE_ROUTED1(InputMsg_CursorVisibilityChange,
126 bool /* is_visible */)
128 // Sets the text composition to be between the given start and end offsets in
129 // the currently focused editable field.
130 IPC_MESSAGE_ROUTED3(InputMsg_SetCompositionFromExistingText,
131 int /* start */,
132 int /* end */,
133 std::vector<blink::WebCompositionUnderline> /* underlines */)
135 // Deletes the current selection plus the specified number of characters before
136 // and after the selection or caret.
137 IPC_MESSAGE_ROUTED2(InputMsg_ExtendSelectionAndDelete,
138 int /* before */,
139 int /* after */)
141 // This message sends a string being composed with an input method.
142 IPC_MESSAGE_ROUTED4(
143 InputMsg_ImeSetComposition,
144 base::string16, /* text */
145 std::vector<blink::WebCompositionUnderline>, /* underlines */
146 int, /* selectiont_start */
147 int /* selection_end */)
149 // This message confirms an ongoing composition.
150 IPC_MESSAGE_ROUTED3(InputMsg_ImeConfirmComposition,
151 base::string16 /* text */,
152 gfx::Range /* replacement_range */,
153 bool /* keep_selection */)
155 // This message notifies the renderer that the next key event is bound to one
156 // or more pre-defined edit commands. If the next key event is not handled
157 // by webkit, the specified edit commands shall be executed against current
158 // focused frame.
159 // Parameters
160 // * edit_commands (see chrome/common/edit_command_types.h)
161 // Contains one or more edit commands.
162 // See third_party/WebKit/Source/WebCore/editing/EditorCommand.cpp for detailed
163 // definition of webkit edit commands.
165 // This message must be sent just before sending a key event.
166 IPC_MESSAGE_ROUTED1(InputMsg_SetEditCommandsForNextKeyEvent,
167 std::vector<content::EditCommand> /* edit_commands */)
169 // Message payload is the name/value of a WebCore edit command to execute.
170 IPC_MESSAGE_ROUTED2(InputMsg_ExecuteEditCommand,
171 std::string, /* name */
172 std::string /* value */)
174 // Message payload is the name of a WebCore edit command to execute.
175 IPC_MESSAGE_ROUTED1(InputMsg_ExecuteNoValueEditCommand, std::string /* name */)
177 IPC_MESSAGE_ROUTED0(InputMsg_MouseCaptureLost)
179 // TODO(darin): figure out how this meshes with RestoreFocus
180 IPC_MESSAGE_ROUTED1(InputMsg_SetFocus,
181 bool /* enable */)
183 // Tells the renderer to scroll the currently focused node into rect only if
184 // the currently focused node is a Text node (textfield, text area or content
185 // editable divs).
186 IPC_MESSAGE_ROUTED1(InputMsg_ScrollFocusedEditableNodeIntoRect, gfx::Rect)
188 // These messages are typically generated from context menus and request the
189 // renderer to apply the specified operation to the current selection.
190 IPC_MESSAGE_ROUTED0(InputMsg_Undo)
191 IPC_MESSAGE_ROUTED0(InputMsg_Redo)
192 IPC_MESSAGE_ROUTED0(InputMsg_Cut)
193 IPC_MESSAGE_ROUTED0(InputMsg_Copy)
194 #if defined(OS_MACOSX)
195 IPC_MESSAGE_ROUTED0(InputMsg_CopyToFindPboard)
196 #endif
197 IPC_MESSAGE_ROUTED0(InputMsg_Paste)
198 IPC_MESSAGE_ROUTED0(InputMsg_PasteAndMatchStyle)
199 // Replaces the selected region or a word around the cursor with the
200 // specified string.
201 IPC_MESSAGE_ROUTED1(InputMsg_Replace,
202 base::string16)
203 // Replaces the misspelling in the selected region with the specified string.
204 IPC_MESSAGE_ROUTED1(InputMsg_ReplaceMisspelling,
205 base::string16)
206 IPC_MESSAGE_ROUTED0(InputMsg_Delete)
207 IPC_MESSAGE_ROUTED0(InputMsg_SelectAll)
209 IPC_MESSAGE_ROUTED0(InputMsg_Unselect)
211 // Requests the renderer to select the region between two points.
212 // Expects a SelectRange_ACK message when finished.
213 IPC_MESSAGE_ROUTED2(InputMsg_SelectRange,
214 gfx::Point /* base */,
215 gfx::Point /* extent */)
217 // Sent by the browser to ask the renderer to adjust the selection start and
218 // end points by the given amounts. A negative amount moves the selection
219 // towards the beginning of the document, a positive amount moves the selection
220 // towards the end of the document.
221 IPC_MESSAGE_ROUTED2(InputMsg_AdjustSelectionByCharacterOffset,
222 int /* start_adjust*/,
223 int /* end_adjust */)
225 // Requests the renderer to move the selection extent point to a new position.
226 // Expects a MoveRangeSelectionExtent_ACK message when finished.
227 IPC_MESSAGE_ROUTED1(InputMsg_MoveRangeSelectionExtent,
228 gfx::Point /* extent */)
230 // Requests the renderer to move the caret selection toward the point.
231 // Expects a MoveCaret_ACK message when finished.
232 IPC_MESSAGE_ROUTED1(InputMsg_MoveCaret,
233 gfx::Point /* location */)
235 #if defined(OS_ANDROID)
236 // Sent when the user clicks on the find result bar to activate a find result.
237 // The point (x,y) is in fractions of the content document's width and height.
238 IPC_MESSAGE_ROUTED3(InputMsg_ActivateNearestFindResult,
239 int /* request_id */,
240 float /* x */,
241 float /* y */)
243 // Sent by the browser as ACK to ViewHostMsg_TextInputState when necessary.
244 // NOTE: ImeEventAck and other Ime* messages should be of the same type,
245 // otherwise a race condition can happen.
246 IPC_MESSAGE_ROUTED0(InputMsg_ImeEventAck)
248 #endif
250 IPC_MESSAGE_ROUTED0(InputMsg_SyntheticGestureCompleted)
252 // -----------------------------------------------------------------------------
253 // Messages sent from the renderer to the browser.
255 // Acknowledges receipt of a InputMsg_HandleInputEvent message.
256 IPC_MESSAGE_ROUTED1(InputHostMsg_HandleInputEvent_ACK,
257 content::InputEventAck /* ack */)
259 IPC_MESSAGE_ROUTED1(InputHostMsg_QueueSyntheticGesture,
260 content::SyntheticGesturePacket)
262 // Notifies the allowed touch actions for a new touch point.
263 IPC_MESSAGE_ROUTED1(InputHostMsg_SetTouchAction,
264 content::TouchAction /* touch_action */)
266 // Sent by the compositor when input scroll events are dropped due to bounds
267 // restrictions on the root scroll offset.
268 IPC_MESSAGE_ROUTED1(InputHostMsg_DidOverscroll,
269 content::DidOverscrollParams /* params */)
271 // Sent by the compositor when a fling animation is stopped.
272 IPC_MESSAGE_ROUTED0(InputHostMsg_DidStopFlinging)
274 // Acknowledges receipt of a InputMsg_MoveCaret message.
275 IPC_MESSAGE_ROUTED0(InputHostMsg_MoveCaret_ACK)
277 // Acknowledges receipt of a InputMsg_MoveRangeSelectionExtent message.
278 IPC_MESSAGE_ROUTED0(InputHostMsg_MoveRangeSelectionExtent_ACK)
280 // Acknowledges receipt of a InputMsg_SelectRange message.
281 IPC_MESSAGE_ROUTED0(InputHostMsg_SelectRange_ACK)
283 // Required for cancelling an ongoing input method composition.
284 IPC_MESSAGE_ROUTED0(InputHostMsg_ImeCancelComposition)
286 // This IPC message sends the character bounds after every composition change
287 // to always have correct bound info.
288 IPC_MESSAGE_ROUTED2(InputHostMsg_ImeCompositionRangeChanged,
289 gfx::Range /* composition range */,
290 std::vector<gfx::Rect> /* character bounds */)
292 // Adding a new message? Stick to the sort order above: first platform
293 // independent InputMsg, then ifdefs for platform specific InputMsg, then
294 // platform independent InputHostMsg, then ifdefs for platform specific
295 // InputHostMsg.