Add an extension override bubble and warning box for proxy extensions. (2nd attempt...
[chromium-blink-merge.git] / content / common / input_messages.h
blob6b36bec4d1517915b9d89e00d3789aa3295c3bca
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/public/common/common_param_traits.h"
23 #include "content/common/input/touch_action.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/point.h"
28 #include "ui/gfx/rect.h"
29 #include "ui/gfx/vector2d_f.h"
31 #undef IPC_MESSAGE_EXPORT
32 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
34 #ifdef IPC_MESSAGE_START
35 #error IPC_MESSAGE_START
36 #endif
38 #define IPC_MESSAGE_START InputMsgStart
40 IPC_ENUM_TRAITS_MAX_VALUE(content::InputEventAckState,
41 content::INPUT_EVENT_ACK_STATE_MAX)
42 IPC_ENUM_TRAITS_MAX_VALUE(
43 content::SyntheticGestureParams::GestureSourceType,
44 content::SyntheticGestureParams::GESTURE_SOURCE_TYPE_MAX)
45 IPC_ENUM_TRAITS_MAX_VALUE(
46 content::SyntheticGestureParams::GestureType,
47 content::SyntheticGestureParams::SYNTHETIC_GESTURE_TYPE_MAX)
48 IPC_ENUM_TRAITS_VALIDATE(content::TouchAction, (
49 value >= 0 &&
50 value <= content::TOUCH_ACTION_MAX &&
51 (!(value & content::TOUCH_ACTION_NONE) ||
52 (value == content::TOUCH_ACTION_NONE)) &&
53 (!(value & content::TOUCH_ACTION_PINCH_ZOOM) ||
54 (value == content::TOUCH_ACTION_MANIPULATION))))
56 IPC_STRUCT_TRAITS_BEGIN(content::DidOverscrollParams)
57 IPC_STRUCT_TRAITS_MEMBER(accumulated_overscroll)
58 IPC_STRUCT_TRAITS_MEMBER(latest_overscroll_delta)
59 IPC_STRUCT_TRAITS_MEMBER(current_fling_velocity)
60 IPC_STRUCT_TRAITS_END()
62 IPC_STRUCT_TRAITS_BEGIN(content::EditCommand)
63 IPC_STRUCT_TRAITS_MEMBER(name)
64 IPC_STRUCT_TRAITS_MEMBER(value)
65 IPC_STRUCT_TRAITS_END()
67 IPC_STRUCT_TRAITS_BEGIN(content::InputEvent)
68 IPC_STRUCT_TRAITS_MEMBER(web_event)
69 IPC_STRUCT_TRAITS_MEMBER(latency_info)
70 IPC_STRUCT_TRAITS_MEMBER(is_keyboard_shortcut)
71 IPC_STRUCT_TRAITS_END()
73 IPC_STRUCT_TRAITS_BEGIN(content::SyntheticGestureParams)
74 IPC_STRUCT_TRAITS_MEMBER(gesture_source_type)
75 IPC_STRUCT_TRAITS_END()
77 IPC_STRUCT_TRAITS_BEGIN(content::SyntheticSmoothScrollGestureParams)
78 IPC_STRUCT_TRAITS_PARENT(content::SyntheticGestureParams)
79 IPC_STRUCT_TRAITS_MEMBER(anchor)
80 IPC_STRUCT_TRAITS_MEMBER(distances)
81 IPC_STRUCT_TRAITS_MEMBER(prevent_fling)
82 IPC_STRUCT_TRAITS_MEMBER(speed_in_pixels_s)
83 IPC_STRUCT_TRAITS_END()
85 IPC_STRUCT_TRAITS_BEGIN(content::SyntheticPinchGestureParams)
86 IPC_STRUCT_TRAITS_PARENT(content::SyntheticGestureParams)
87 IPC_STRUCT_TRAITS_MEMBER(scale_factor)
88 IPC_STRUCT_TRAITS_MEMBER(anchor)
89 IPC_STRUCT_TRAITS_MEMBER(relative_pointer_speed_in_pixels_s)
90 IPC_STRUCT_TRAITS_END()
92 IPC_STRUCT_TRAITS_BEGIN(content::SyntheticTapGestureParams)
93 IPC_STRUCT_TRAITS_PARENT(content::SyntheticGestureParams)
94 IPC_STRUCT_TRAITS_MEMBER(position)
95 IPC_STRUCT_TRAITS_MEMBER(duration_ms)
96 IPC_STRUCT_TRAITS_END()
98 IPC_STRUCT_BEGIN(InputHostMsg_HandleInputEvent_ACK_Params)
99 IPC_STRUCT_MEMBER(blink::WebInputEvent::Type, type)
100 IPC_STRUCT_MEMBER(content::InputEventAckState, state)
101 IPC_STRUCT_MEMBER(ui::LatencyInfo, latency)
102 // TODO(jdduke): Use Optional<T> type to avoid heap alloc, crbug.com/375002.
103 IPC_STRUCT_MEMBER(scoped_ptr<content::DidOverscrollParams>, overscroll)
104 IPC_STRUCT_END()
106 // Sends an input event to the render widget.
107 IPC_MESSAGE_ROUTED3(InputMsg_HandleInputEvent,
108 IPC::WebInputEventPointer /* event */,
109 ui::LatencyInfo /* latency_info */,
110 bool /* is_keyboard_shortcut */)
112 // Sends the cursor visibility state to the render widget.
113 IPC_MESSAGE_ROUTED1(InputMsg_CursorVisibilityChange,
114 bool /* is_visible */)
116 // This message notifies the renderer that the next key event is bound to one
117 // or more pre-defined edit commands. If the next key event is not handled
118 // by webkit, the specified edit commands shall be executed against current
119 // focused frame.
120 // Parameters
121 // * edit_commands (see chrome/common/edit_command_types.h)
122 // Contains one or more edit commands.
123 // See third_party/WebKit/Source/WebCore/editing/EditorCommand.cpp for detailed
124 // definition of webkit edit commands.
126 // This message must be sent just before sending a key event.
127 IPC_MESSAGE_ROUTED1(InputMsg_SetEditCommandsForNextKeyEvent,
128 std::vector<content::EditCommand> /* edit_commands */)
130 // Message payload is the name/value of a WebCore edit command to execute.
131 IPC_MESSAGE_ROUTED2(InputMsg_ExecuteEditCommand,
132 std::string, /* name */
133 std::string /* value */)
135 IPC_MESSAGE_ROUTED0(InputMsg_MouseCaptureLost)
137 // TODO(darin): figure out how this meshes with RestoreFocus
138 IPC_MESSAGE_ROUTED1(InputMsg_SetFocus,
139 bool /* enable */)
141 // Tells the renderer to scroll the currently focused node into rect only if
142 // the currently focused node is a Text node (textfield, text area or content
143 // editable divs).
144 IPC_MESSAGE_ROUTED1(InputMsg_ScrollFocusedEditableNodeIntoRect, gfx::Rect)
146 // These messages are typically generated from context menus and request the
147 // renderer to apply the specified operation to the current selection.
148 IPC_MESSAGE_ROUTED0(InputMsg_Undo)
149 IPC_MESSAGE_ROUTED0(InputMsg_Redo)
150 IPC_MESSAGE_ROUTED0(InputMsg_Cut)
151 IPC_MESSAGE_ROUTED0(InputMsg_Copy)
152 #if defined(OS_MACOSX)
153 IPC_MESSAGE_ROUTED0(InputMsg_CopyToFindPboard)
154 #endif
155 IPC_MESSAGE_ROUTED0(InputMsg_Paste)
156 IPC_MESSAGE_ROUTED0(InputMsg_PasteAndMatchStyle)
157 // Replaces the selected region or a word around the cursor with the
158 // specified string.
159 IPC_MESSAGE_ROUTED1(InputMsg_Replace,
160 base::string16)
161 // Replaces the misspelling in the selected region with the specified string.
162 IPC_MESSAGE_ROUTED1(InputMsg_ReplaceMisspelling,
163 base::string16)
164 IPC_MESSAGE_ROUTED0(InputMsg_Delete)
165 IPC_MESSAGE_ROUTED0(InputMsg_SelectAll)
167 IPC_MESSAGE_ROUTED0(InputMsg_Unselect)
169 // Requests the renderer to select the region between two points.
170 // Expects a SelectRange_ACK message when finished.
171 IPC_MESSAGE_ROUTED2(InputMsg_SelectRange,
172 gfx::Point /* start */,
173 gfx::Point /* end */)
175 // Requests the renderer to move the caret selection toward the point.
176 // Expects a MoveCaret_ACK message when finished.
177 IPC_MESSAGE_ROUTED1(InputMsg_MoveCaret,
178 gfx::Point /* location */)
180 #if defined(OS_ANDROID)
181 // Sent when the user clicks on the find result bar to activate a find result.
182 // The point (x,y) is in fractions of the content document's width and height.
183 IPC_MESSAGE_ROUTED3(InputMsg_ActivateNearestFindResult,
184 int /* request_id */,
185 float /* x */,
186 float /* y */)
187 #endif
189 IPC_MESSAGE_ROUTED0(InputMsg_SyntheticGestureCompleted);
191 // -----------------------------------------------------------------------------
192 // Messages sent from the renderer to the browser.
194 // Acknowledges receipt of a InputMsg_HandleInputEvent message.
195 IPC_MESSAGE_ROUTED1(InputHostMsg_HandleInputEvent_ACK,
196 InputHostMsg_HandleInputEvent_ACK_Params)
198 IPC_MESSAGE_ROUTED1(InputHostMsg_QueueSyntheticGesture,
199 content::SyntheticGesturePacket)
201 // Notifies the allowed touch actions for a new touch point.
202 IPC_MESSAGE_ROUTED1(InputHostMsg_SetTouchAction,
203 content::TouchAction /* touch_action */)
205 // Sent by the compositor when input scroll events are dropped due to bounds
206 // restrictions on the root scroll offset.
207 IPC_MESSAGE_ROUTED1(InputHostMsg_DidOverscroll,
208 content::DidOverscrollParams /* params */)
210 // Adding a new message? Stick to the sort order above: first platform
211 // independent InputMsg, then ifdefs for platform specific InputMsg, then
212 // platform independent InputHostMsg, then ifdefs for platform specific
213 // InputHostMsg.