GPU workaround to simulate Out of Memory errors with large textures
[chromium-blink-merge.git] / content / common / input_messages.h
blob80d30430dedaccc5c8970172e8588afeb17b8dd7
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_state.h"
16 #include "content/common/input/input_param_traits.h"
17 #include "content/common/input/synthetic_gesture_packet.h"
18 #include "content/common/input/synthetic_gesture_params.h"
19 #include "content/common/input/synthetic_pinch_gesture_params.h"
20 #include "content/common/input/synthetic_smooth_drag_gesture_params.h"
21 #include "content/common/input/synthetic_smooth_scroll_gesture_params.h"
22 #include "content/common/input/synthetic_tap_gesture_params.h"
23 #include "content/common/input/touch_action.h"
24 #include "content/public/common/common_param_traits.h"
25 #include "ipc/ipc_message_macros.h"
26 #include "third_party/WebKit/public/web/WebInputEvent.h"
27 #include "ui/events/ipc/latency_info_param_traits.h"
28 #include "ui/gfx/geometry/point.h"
29 #include "ui/gfx/geometry/rect.h"
30 #include "ui/gfx/geometry/vector2d_f.h"
31 #include "ui/gfx/ipc/gfx_param_traits.h"
32 #include "ui/gfx/range/range.h"
34 #undef IPC_MESSAGE_EXPORT
35 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
37 #ifdef IPC_MESSAGE_START
38 #error IPC_MESSAGE_START
39 #endif
41 #define IPC_MESSAGE_START InputMsgStart
43 IPC_ENUM_TRAITS_MAX_VALUE(content::InputEventAckState,
44 content::INPUT_EVENT_ACK_STATE_MAX)
45 IPC_ENUM_TRAITS_MAX_VALUE(
46 content::SyntheticGestureParams::GestureSourceType,
47 content::SyntheticGestureParams::GESTURE_SOURCE_TYPE_MAX)
48 IPC_ENUM_TRAITS_MAX_VALUE(
49 content::SyntheticGestureParams::GestureType,
50 content::SyntheticGestureParams::SYNTHETIC_GESTURE_TYPE_MAX)
51 IPC_ENUM_TRAITS_VALIDATE(content::TouchAction, (
52 value >= 0 &&
53 value <= content::TOUCH_ACTION_MAX &&
54 (!(value & content::TOUCH_ACTION_NONE) ||
55 (value == content::TOUCH_ACTION_NONE)) &&
56 (!(value & content::TOUCH_ACTION_PINCH_ZOOM) ||
57 (value == content::TOUCH_ACTION_MANIPULATION))))
59 IPC_STRUCT_TRAITS_BEGIN(content::DidOverscrollParams)
60 IPC_STRUCT_TRAITS_MEMBER(accumulated_overscroll)
61 IPC_STRUCT_TRAITS_MEMBER(latest_overscroll_delta)
62 IPC_STRUCT_TRAITS_MEMBER(current_fling_velocity)
63 IPC_STRUCT_TRAITS_MEMBER(causal_event_viewport_point)
64 IPC_STRUCT_TRAITS_END()
66 IPC_STRUCT_TRAITS_BEGIN(content::EditCommand)
67 IPC_STRUCT_TRAITS_MEMBER(name)
68 IPC_STRUCT_TRAITS_MEMBER(value)
69 IPC_STRUCT_TRAITS_END()
71 IPC_STRUCT_TRAITS_BEGIN(content::InputEvent)
72 IPC_STRUCT_TRAITS_MEMBER(web_event)
73 IPC_STRUCT_TRAITS_MEMBER(latency_info)
74 IPC_STRUCT_TRAITS_MEMBER(is_keyboard_shortcut)
75 IPC_STRUCT_TRAITS_END()
77 IPC_STRUCT_TRAITS_BEGIN(content::SyntheticGestureParams)
78 IPC_STRUCT_TRAITS_MEMBER(gesture_source_type)
79 IPC_STRUCT_TRAITS_END()
81 IPC_STRUCT_TRAITS_BEGIN(content::SyntheticSmoothDragGestureParams)
82 IPC_STRUCT_TRAITS_PARENT(content::SyntheticGestureParams)
83 IPC_STRUCT_TRAITS_MEMBER(start_point)
84 IPC_STRUCT_TRAITS_MEMBER(distances)
85 IPC_STRUCT_TRAITS_MEMBER(speed_in_pixels_s)
86 IPC_STRUCT_TRAITS_END()
88 IPC_STRUCT_TRAITS_BEGIN(content::SyntheticSmoothScrollGestureParams)
89 IPC_STRUCT_TRAITS_PARENT(content::SyntheticGestureParams)
90 IPC_STRUCT_TRAITS_MEMBER(anchor)
91 IPC_STRUCT_TRAITS_MEMBER(distances)
92 IPC_STRUCT_TRAITS_MEMBER(prevent_fling)
93 IPC_STRUCT_TRAITS_MEMBER(speed_in_pixels_s)
94 IPC_STRUCT_TRAITS_END()
96 IPC_STRUCT_TRAITS_BEGIN(content::SyntheticPinchGestureParams)
97 IPC_STRUCT_TRAITS_PARENT(content::SyntheticGestureParams)
98 IPC_STRUCT_TRAITS_MEMBER(scale_factor)
99 IPC_STRUCT_TRAITS_MEMBER(anchor)
100 IPC_STRUCT_TRAITS_MEMBER(relative_pointer_speed_in_pixels_s)
101 IPC_STRUCT_TRAITS_END()
103 IPC_STRUCT_TRAITS_BEGIN(content::SyntheticTapGestureParams)
104 IPC_STRUCT_TRAITS_PARENT(content::SyntheticGestureParams)
105 IPC_STRUCT_TRAITS_MEMBER(position)
106 IPC_STRUCT_TRAITS_MEMBER(duration_ms)
107 IPC_STRUCT_TRAITS_END()
109 IPC_STRUCT_BEGIN(InputHostMsg_HandleInputEvent_ACK_Params)
110 IPC_STRUCT_MEMBER(blink::WebInputEvent::Type, type)
111 IPC_STRUCT_MEMBER(content::InputEventAckState, state)
112 IPC_STRUCT_MEMBER(ui::LatencyInfo, latency)
113 // TODO(jdduke): Use Optional<T> type to avoid heap alloc, crbug.com/375002.
114 IPC_STRUCT_MEMBER(scoped_ptr<content::DidOverscrollParams>, overscroll)
115 IPC_STRUCT_END()
117 // Sends an input event to the render widget.
118 IPC_MESSAGE_ROUTED3(InputMsg_HandleInputEvent,
119 IPC::WebInputEventPointer /* event */,
120 ui::LatencyInfo /* latency_info */,
121 bool /* is_keyboard_shortcut */)
123 // Sends the cursor visibility state to the render widget.
124 IPC_MESSAGE_ROUTED1(InputMsg_CursorVisibilityChange,
125 bool /* is_visible */)
127 // Sets the text composition to be between the given start and end offsets in
128 // the currently focused editable field.
129 IPC_MESSAGE_ROUTED3(InputMsg_SetCompositionFromExistingText,
130 int /* start */,
131 int /* end */,
132 std::vector<blink::WebCompositionUnderline> /* underlines */)
134 // Deletes the current selection plus the specified number of characters before
135 // and after the selection or caret.
136 IPC_MESSAGE_ROUTED2(InputMsg_ExtendSelectionAndDelete,
137 int /* before */,
138 int /* after */)
140 // This message sends a string being composed with an input method.
141 IPC_MESSAGE_ROUTED4(
142 InputMsg_ImeSetComposition,
143 base::string16, /* text */
144 std::vector<blink::WebCompositionUnderline>, /* underlines */
145 int, /* selectiont_start */
146 int /* selection_end */)
148 // This message confirms an ongoing composition.
149 IPC_MESSAGE_ROUTED3(InputMsg_ImeConfirmComposition,
150 base::string16 /* text */,
151 gfx::Range /* replacement_range */,
152 bool /* keep_selection */)
154 // This message notifies the renderer that the next key event is bound to one
155 // or more pre-defined edit commands. If the next key event is not handled
156 // by webkit, the specified edit commands shall be executed against current
157 // focused frame.
158 // Parameters
159 // * edit_commands (see chrome/common/edit_command_types.h)
160 // Contains one or more edit commands.
161 // See third_party/WebKit/Source/WebCore/editing/EditorCommand.cpp for detailed
162 // definition of webkit edit commands.
164 // This message must be sent just before sending a key event.
165 IPC_MESSAGE_ROUTED1(InputMsg_SetEditCommandsForNextKeyEvent,
166 std::vector<content::EditCommand> /* edit_commands */)
168 // Message payload is the name/value of a WebCore edit command to execute.
169 IPC_MESSAGE_ROUTED2(InputMsg_ExecuteEditCommand,
170 std::string, /* name */
171 std::string /* value */)
173 // Message payload is the name of a WebCore edit command to execute.
174 IPC_MESSAGE_ROUTED1(InputMsg_ExecuteNoValueEditCommand, std::string /* name */)
176 IPC_MESSAGE_ROUTED0(InputMsg_MouseCaptureLost)
178 // TODO(darin): figure out how this meshes with RestoreFocus
179 IPC_MESSAGE_ROUTED1(InputMsg_SetFocus,
180 bool /* enable */)
182 // Tells the renderer to scroll the currently focused node into rect only if
183 // the currently focused node is a Text node (textfield, text area or content
184 // editable divs).
185 IPC_MESSAGE_ROUTED1(InputMsg_ScrollFocusedEditableNodeIntoRect, gfx::Rect)
187 // These messages are typically generated from context menus and request the
188 // renderer to apply the specified operation to the current selection.
189 IPC_MESSAGE_ROUTED0(InputMsg_Undo)
190 IPC_MESSAGE_ROUTED0(InputMsg_Redo)
191 IPC_MESSAGE_ROUTED0(InputMsg_Cut)
192 IPC_MESSAGE_ROUTED0(InputMsg_Copy)
193 #if defined(OS_MACOSX)
194 IPC_MESSAGE_ROUTED0(InputMsg_CopyToFindPboard)
195 #endif
196 IPC_MESSAGE_ROUTED0(InputMsg_Paste)
197 IPC_MESSAGE_ROUTED0(InputMsg_PasteAndMatchStyle)
198 // Replaces the selected region or a word around the cursor with the
199 // specified string.
200 IPC_MESSAGE_ROUTED1(InputMsg_Replace,
201 base::string16)
202 // Replaces the misspelling in the selected region with the specified string.
203 IPC_MESSAGE_ROUTED1(InputMsg_ReplaceMisspelling,
204 base::string16)
205 IPC_MESSAGE_ROUTED0(InputMsg_Delete)
206 IPC_MESSAGE_ROUTED0(InputMsg_SelectAll)
208 IPC_MESSAGE_ROUTED0(InputMsg_Unselect)
210 // Requests the renderer to select the region between two points.
211 // Expects a SelectRange_ACK message when finished.
212 IPC_MESSAGE_ROUTED2(InputMsg_SelectRange,
213 gfx::Point /* base */,
214 gfx::Point /* extent */)
216 // Requests the renderer to move the selection extent point to a new position.
217 // Expects a MoveRangeSelectionExtent_ACK message when finished.
218 IPC_MESSAGE_ROUTED1(InputMsg_MoveRangeSelectionExtent,
219 gfx::Point /* extent */)
221 // Requests the renderer to move the caret selection toward the point.
222 // Expects a MoveCaret_ACK message when finished.
223 IPC_MESSAGE_ROUTED1(InputMsg_MoveCaret,
224 gfx::Point /* location */)
226 #if defined(OS_ANDROID)
227 // Sent when the user clicks on the find result bar to activate a find result.
228 // The point (x,y) is in fractions of the content document's width and height.
229 IPC_MESSAGE_ROUTED3(InputMsg_ActivateNearestFindResult,
230 int /* request_id */,
231 float /* x */,
232 float /* y */)
233 #endif
235 IPC_MESSAGE_ROUTED0(InputMsg_SyntheticGestureCompleted)
237 // -----------------------------------------------------------------------------
238 // Messages sent from the renderer to the browser.
240 // Acknowledges receipt of a InputMsg_HandleInputEvent message.
241 IPC_MESSAGE_ROUTED1(InputHostMsg_HandleInputEvent_ACK,
242 InputHostMsg_HandleInputEvent_ACK_Params)
244 IPC_MESSAGE_ROUTED1(InputHostMsg_QueueSyntheticGesture,
245 content::SyntheticGesturePacket)
247 // Notifies the allowed touch actions for a new touch point.
248 IPC_MESSAGE_ROUTED1(InputHostMsg_SetTouchAction,
249 content::TouchAction /* touch_action */)
251 // Sent by the compositor when input scroll events are dropped due to bounds
252 // restrictions on the root scroll offset.
253 IPC_MESSAGE_ROUTED1(InputHostMsg_DidOverscroll,
254 content::DidOverscrollParams /* params */)
256 // Sent by the compositor when a fling animation is stopped.
257 IPC_MESSAGE_ROUTED0(InputHostMsg_DidStopFlinging)
259 // Acknowledges receipt of a InputMsg_MoveCaret message.
260 IPC_MESSAGE_ROUTED0(InputHostMsg_MoveCaret_ACK)
262 // Acknowledges receipt of a InputMsg_MoveRangeSelectionExtent message.
263 IPC_MESSAGE_ROUTED0(InputHostMsg_MoveRangeSelectionExtent_ACK)
265 // Acknowledges receipt of a InputMsg_SelectRange message.
266 IPC_MESSAGE_ROUTED0(InputHostMsg_SelectRange_ACK)
268 // Required for cancelling an ongoing input method composition.
269 IPC_MESSAGE_ROUTED0(InputHostMsg_ImeCancelComposition)
271 // This IPC message sends the character bounds after every composition change
272 // to always have correct bound info.
273 IPC_MESSAGE_ROUTED2(InputHostMsg_ImeCompositionRangeChanged,
274 gfx::Range /* composition range */,
275 std::vector<gfx::Rect> /* character bounds */)
277 // Adding a new message? Stick to the sort order above: first platform
278 // independent InputMsg, then ifdefs for platform specific InputMsg, then
279 // platform independent InputHostMsg, then ifdefs for platform specific
280 // InputHostMsg.