[SyncFS] Build indexes from FileTracker entries on disk.
[chromium-blink-merge.git] / content / common / input_messages.h
blobd00d45d93f2c73e889051110c64ef684f5a1d802
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_scroll_gesture_params.h"
21 #include "content/common/input/synthetic_tap_gesture_params.h"
22 #include "content/common/input/touch_action.h"
23 #include "content/public/common/common_param_traits.h"
24 #include "ipc/ipc_message_macros.h"
25 #include "third_party/WebKit/public/web/WebInputEvent.h"
26 #include "ui/events/ipc/latency_info_param_traits.h"
27 #include "ui/gfx/ipc/gfx_param_traits.h"
28 #include "ui/gfx/point.h"
29 #include "ui/gfx/range/range.h"
30 #include "ui/gfx/rect.h"
31 #include "ui/gfx/vector2d_f.h"
33 #undef IPC_MESSAGE_EXPORT
34 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
36 #ifdef IPC_MESSAGE_START
37 #error IPC_MESSAGE_START
38 #endif
40 #define IPC_MESSAGE_START InputMsgStart
42 IPC_ENUM_TRAITS_MAX_VALUE(content::InputEventAckState,
43 content::INPUT_EVENT_ACK_STATE_MAX)
44 IPC_ENUM_TRAITS_MAX_VALUE(
45 content::SyntheticGestureParams::GestureSourceType,
46 content::SyntheticGestureParams::GESTURE_SOURCE_TYPE_MAX)
47 IPC_ENUM_TRAITS_MAX_VALUE(
48 content::SyntheticGestureParams::GestureType,
49 content::SyntheticGestureParams::SYNTHETIC_GESTURE_TYPE_MAX)
50 IPC_ENUM_TRAITS_VALIDATE(content::TouchAction, (
51 value >= 0 &&
52 value <= content::TOUCH_ACTION_MAX &&
53 (!(value & content::TOUCH_ACTION_NONE) ||
54 (value == content::TOUCH_ACTION_NONE)) &&
55 (!(value & content::TOUCH_ACTION_PINCH_ZOOM) ||
56 (value == content::TOUCH_ACTION_MANIPULATION))))
58 IPC_STRUCT_TRAITS_BEGIN(content::DidOverscrollParams)
59 IPC_STRUCT_TRAITS_MEMBER(accumulated_overscroll)
60 IPC_STRUCT_TRAITS_MEMBER(latest_overscroll_delta)
61 IPC_STRUCT_TRAITS_MEMBER(current_fling_velocity)
62 IPC_STRUCT_TRAITS_END()
64 IPC_STRUCT_TRAITS_BEGIN(content::EditCommand)
65 IPC_STRUCT_TRAITS_MEMBER(name)
66 IPC_STRUCT_TRAITS_MEMBER(value)
67 IPC_STRUCT_TRAITS_END()
69 IPC_STRUCT_TRAITS_BEGIN(content::InputEvent)
70 IPC_STRUCT_TRAITS_MEMBER(web_event)
71 IPC_STRUCT_TRAITS_MEMBER(latency_info)
72 IPC_STRUCT_TRAITS_MEMBER(is_keyboard_shortcut)
73 IPC_STRUCT_TRAITS_END()
75 IPC_STRUCT_TRAITS_BEGIN(content::SyntheticGestureParams)
76 IPC_STRUCT_TRAITS_MEMBER(gesture_source_type)
77 IPC_STRUCT_TRAITS_END()
79 IPC_STRUCT_TRAITS_BEGIN(content::SyntheticSmoothScrollGestureParams)
80 IPC_STRUCT_TRAITS_PARENT(content::SyntheticGestureParams)
81 IPC_STRUCT_TRAITS_MEMBER(anchor)
82 IPC_STRUCT_TRAITS_MEMBER(distances)
83 IPC_STRUCT_TRAITS_MEMBER(prevent_fling)
84 IPC_STRUCT_TRAITS_MEMBER(speed_in_pixels_s)
85 IPC_STRUCT_TRAITS_END()
87 IPC_STRUCT_TRAITS_BEGIN(content::SyntheticPinchGestureParams)
88 IPC_STRUCT_TRAITS_PARENT(content::SyntheticGestureParams)
89 IPC_STRUCT_TRAITS_MEMBER(scale_factor)
90 IPC_STRUCT_TRAITS_MEMBER(anchor)
91 IPC_STRUCT_TRAITS_MEMBER(relative_pointer_speed_in_pixels_s)
92 IPC_STRUCT_TRAITS_END()
94 IPC_STRUCT_TRAITS_BEGIN(content::SyntheticTapGestureParams)
95 IPC_STRUCT_TRAITS_PARENT(content::SyntheticGestureParams)
96 IPC_STRUCT_TRAITS_MEMBER(position)
97 IPC_STRUCT_TRAITS_MEMBER(duration_ms)
98 IPC_STRUCT_TRAITS_END()
100 IPC_STRUCT_BEGIN(InputHostMsg_HandleInputEvent_ACK_Params)
101 IPC_STRUCT_MEMBER(blink::WebInputEvent::Type, type)
102 IPC_STRUCT_MEMBER(content::InputEventAckState, state)
103 IPC_STRUCT_MEMBER(ui::LatencyInfo, latency)
104 // TODO(jdduke): Use Optional<T> type to avoid heap alloc, crbug.com/375002.
105 IPC_STRUCT_MEMBER(scoped_ptr<content::DidOverscrollParams>, overscroll)
106 IPC_STRUCT_END()
108 // Sends an input event to the render widget.
109 IPC_MESSAGE_ROUTED3(InputMsg_HandleInputEvent,
110 IPC::WebInputEventPointer /* event */,
111 ui::LatencyInfo /* latency_info */,
112 bool /* is_keyboard_shortcut */)
114 // Sends the cursor visibility state to the render widget.
115 IPC_MESSAGE_ROUTED1(InputMsg_CursorVisibilityChange,
116 bool /* is_visible */)
118 // Sets the text composition to be between the given start and end offsets in
119 // the currently focused editable field.
120 IPC_MESSAGE_ROUTED3(InputMsg_SetCompositionFromExistingText,
121 int /* start */,
122 int /* end */,
123 std::vector<blink::WebCompositionUnderline> /* underlines */)
125 // Deletes the current selection plus the specified number of characters before
126 // and after the selection or caret.
127 IPC_MESSAGE_ROUTED2(InputMsg_ExtendSelectionAndDelete,
128 int /* before */,
129 int /* after */)
131 // This message sends a string being composed with an input method.
132 IPC_MESSAGE_ROUTED4(
133 InputMsg_ImeSetComposition,
134 base::string16, /* text */
135 std::vector<blink::WebCompositionUnderline>, /* underlines */
136 int, /* selectiont_start */
137 int /* selection_end */)
139 // This message confirms an ongoing composition.
140 IPC_MESSAGE_ROUTED3(InputMsg_ImeConfirmComposition,
141 base::string16 /* text */,
142 gfx::Range /* replacement_range */,
143 bool /* keep_selection */)
145 // This message notifies the renderer that the next key event is bound to one
146 // or more pre-defined edit commands. If the next key event is not handled
147 // by webkit, the specified edit commands shall be executed against current
148 // focused frame.
149 // Parameters
150 // * edit_commands (see chrome/common/edit_command_types.h)
151 // Contains one or more edit commands.
152 // See third_party/WebKit/Source/WebCore/editing/EditorCommand.cpp for detailed
153 // definition of webkit edit commands.
155 // This message must be sent just before sending a key event.
156 IPC_MESSAGE_ROUTED1(InputMsg_SetEditCommandsForNextKeyEvent,
157 std::vector<content::EditCommand> /* edit_commands */)
159 // Message payload is the name/value of a WebCore edit command to execute.
160 IPC_MESSAGE_ROUTED2(InputMsg_ExecuteEditCommand,
161 std::string, /* name */
162 std::string /* value */)
164 IPC_MESSAGE_ROUTED0(InputMsg_MouseCaptureLost)
166 // TODO(darin): figure out how this meshes with RestoreFocus
167 IPC_MESSAGE_ROUTED1(InputMsg_SetFocus,
168 bool /* enable */)
170 // Tells the renderer to scroll the currently focused node into rect only if
171 // the currently focused node is a Text node (textfield, text area or content
172 // editable divs).
173 IPC_MESSAGE_ROUTED1(InputMsg_ScrollFocusedEditableNodeIntoRect, gfx::Rect)
175 // These messages are typically generated from context menus and request the
176 // renderer to apply the specified operation to the current selection.
177 IPC_MESSAGE_ROUTED0(InputMsg_Undo)
178 IPC_MESSAGE_ROUTED0(InputMsg_Redo)
179 IPC_MESSAGE_ROUTED0(InputMsg_Cut)
180 IPC_MESSAGE_ROUTED0(InputMsg_Copy)
181 #if defined(OS_MACOSX)
182 IPC_MESSAGE_ROUTED0(InputMsg_CopyToFindPboard)
183 #endif
184 IPC_MESSAGE_ROUTED0(InputMsg_Paste)
185 IPC_MESSAGE_ROUTED0(InputMsg_PasteAndMatchStyle)
186 // Replaces the selected region or a word around the cursor with the
187 // specified string.
188 IPC_MESSAGE_ROUTED1(InputMsg_Replace,
189 base::string16)
190 // Replaces the misspelling in the selected region with the specified string.
191 IPC_MESSAGE_ROUTED1(InputMsg_ReplaceMisspelling,
192 base::string16)
193 IPC_MESSAGE_ROUTED0(InputMsg_Delete)
194 IPC_MESSAGE_ROUTED0(InputMsg_SelectAll)
196 IPC_MESSAGE_ROUTED0(InputMsg_Unselect)
198 // Requests the renderer to select the region between two points.
199 // Expects a SelectRange_ACK message when finished.
200 IPC_MESSAGE_ROUTED2(InputMsg_SelectRange,
201 gfx::Point /* start */,
202 gfx::Point /* end */)
204 // Requests the renderer to move the caret selection toward the point.
205 // Expects a MoveCaret_ACK message when finished.
206 IPC_MESSAGE_ROUTED1(InputMsg_MoveCaret,
207 gfx::Point /* location */)
209 #if defined(OS_ANDROID)
210 // Sent when the user clicks on the find result bar to activate a find result.
211 // The point (x,y) is in fractions of the content document's width and height.
212 IPC_MESSAGE_ROUTED3(InputMsg_ActivateNearestFindResult,
213 int /* request_id */,
214 float /* x */,
215 float /* y */)
216 #endif
218 IPC_MESSAGE_ROUTED0(InputMsg_SyntheticGestureCompleted)
220 // -----------------------------------------------------------------------------
221 // Messages sent from the renderer to the browser.
223 // Acknowledges receipt of a InputMsg_HandleInputEvent message.
224 IPC_MESSAGE_ROUTED1(InputHostMsg_HandleInputEvent_ACK,
225 InputHostMsg_HandleInputEvent_ACK_Params)
227 IPC_MESSAGE_ROUTED1(InputHostMsg_QueueSyntheticGesture,
228 content::SyntheticGesturePacket)
230 // Notifies the allowed touch actions for a new touch point.
231 IPC_MESSAGE_ROUTED1(InputHostMsg_SetTouchAction,
232 content::TouchAction /* touch_action */)
234 // Sent by the compositor when input scroll events are dropped due to bounds
235 // restrictions on the root scroll offset.
236 IPC_MESSAGE_ROUTED1(InputHostMsg_DidOverscroll,
237 content::DidOverscrollParams /* params */)
239 // Required for cancelling an ongoing input method composition.
240 IPC_MESSAGE_ROUTED0(InputHostMsg_ImeCancelComposition)
242 #if defined(OS_MACOSX) || defined(USE_AURA)
243 // On Mac and Aura IME can request composition character bounds
244 // synchronously (see crbug.com/120597). This IPC message sends the character
245 // bounds after every composition change to always have correct bound info.
246 IPC_MESSAGE_ROUTED2(InputHostMsg_ImeCompositionRangeChanged,
247 gfx::Range /* composition range */,
248 std::vector<gfx::Rect> /* character bounds */)
249 #endif
251 // Adding a new message? Stick to the sort order above: first platform
252 // independent InputMsg, then ifdefs for platform specific InputMsg, then
253 // platform independent InputHostMsg, then ifdefs for platform specific
254 // InputHostMsg.