[email protected] | c084330e0 | 2013-04-27 01:08:15 | [diff] [blame] | 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. |
| 4 | |
| 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. |
| 8 | |
[email protected] | 30fe1f9 | 2013-06-12 16:34:34 | [diff] [blame] | 9 | #include "base/strings/string16.h" |
[email protected] | c084330e0 | 2013-04-27 01:08:15 | [diff] [blame] | 10 | #include "content/common/content_export.h" |
| 11 | #include "content/common/content_param_traits.h" |
| 12 | #include "content/common/edit_command.h" |
[email protected] | 6e463eb | 2013-09-07 07:07:52 | [diff] [blame] | 13 | #include "content/common/input/input_event.h" |
[email protected] | 6e463eb | 2013-09-07 07:07:52 | [diff] [blame] | 14 | #include "content/common/input/input_param_traits.h" |
[email protected] | 9017d785 | 2013-11-21 17:47:35 | [diff] [blame] | 15 | #include "content/common/input/synthetic_gesture_packet.h" |
[email protected] | eafe58fd | 2013-10-11 19:09:01 | [diff] [blame] | 16 | #include "content/common/input/synthetic_gesture_params.h" |
[email protected] | 1735b68 | 2013-11-17 16:04:20 | [diff] [blame] | 17 | #include "content/common/input/synthetic_pinch_gesture_params.h" |
[email protected] | eafe58fd | 2013-10-11 19:09:01 | [diff] [blame] | 18 | #include "content/common/input/synthetic_smooth_scroll_gesture_params.h" |
[email protected] | 26fae6396 | 2013-12-11 12:57:56 | [diff] [blame] | 19 | #include "content/common/input/synthetic_tap_gesture_params.h" |
[email protected] | c084330e0 | 2013-04-27 01:08:15 | [diff] [blame] | 20 | #include "content/port/common/input_event_ack_state.h" |
| 21 | #include "content/public/common/common_param_traits.h" |
[email protected] | 5d0bbdfa9 | 2013-12-10 00:35:51 | [diff] [blame] | 22 | #include "content/common/input/touch_action.h" |
[email protected] | c084330e0 | 2013-04-27 01:08:15 | [diff] [blame] | 23 | #include "ipc/ipc_message_macros.h" |
[email protected] | 2255a933 | 2013-06-17 05:12:31 | [diff] [blame] | 24 | #include "third_party/WebKit/public/web/WebInputEvent.h" |
[email protected] | f40d3a0 | 2013-09-23 19:39:41 | [diff] [blame] | 25 | #include "ui/events/latency_info.h" |
[email protected] | c084330e0 | 2013-04-27 01:08:15 | [diff] [blame] | 26 | #include "ui/gfx/point.h" |
| 27 | #include "ui/gfx/rect.h" |
| 28 | |
| 29 | #undef IPC_MESSAGE_EXPORT |
| 30 | #define IPC_MESSAGE_EXPORT CONTENT_EXPORT |
| 31 | |
| 32 | #ifdef IPC_MESSAGE_START |
| 33 | #error IPC_MESSAGE_START |
| 34 | #endif |
| 35 | |
| 36 | #define IPC_MESSAGE_START InputMsgStart |
| 37 | |
[email protected] | 6e463eb | 2013-09-07 07:07:52 | [diff] [blame] | 38 | IPC_ENUM_TRAITS_MAX_VALUE(content::InputEventAckState, |
| 39 | content::INPUT_EVENT_ACK_STATE_MAX) |
[email protected] | eafe58fd | 2013-10-11 19:09:01 | [diff] [blame] | 40 | IPC_ENUM_TRAITS_MAX_VALUE( |
| 41 | content::SyntheticGestureParams::GestureSourceType, |
| 42 | content::SyntheticGestureParams::GESTURE_SOURCE_TYPE_MAX) |
| 43 | IPC_ENUM_TRAITS_MAX_VALUE( |
| 44 | content::SyntheticGestureParams::GestureType, |
| 45 | content::SyntheticGestureParams::SYNTHETIC_GESTURE_TYPE_MAX) |
[email protected] | 5d0bbdfa9 | 2013-12-10 00:35:51 | [diff] [blame] | 46 | IPC_ENUM_TRAITS_MAX_VALUE(content::TouchAction, |
| 47 | content::TOUCH_ACTION_MAX) |
[email protected] | c084330e0 | 2013-04-27 01:08:15 | [diff] [blame] | 48 | |
| 49 | IPC_STRUCT_TRAITS_BEGIN(content::EditCommand) |
| 50 | IPC_STRUCT_TRAITS_MEMBER(name) |
| 51 | IPC_STRUCT_TRAITS_MEMBER(value) |
| 52 | IPC_STRUCT_TRAITS_END() |
| 53 | |
[email protected] | 42d937a | 2013-10-08 21:18:55 | [diff] [blame] | 54 | IPC_STRUCT_TRAITS_BEGIN(content::InputEvent) |
| 55 | IPC_STRUCT_TRAITS_MEMBER(web_event) |
| 56 | IPC_STRUCT_TRAITS_MEMBER(latency_info) |
| 57 | IPC_STRUCT_TRAITS_MEMBER(is_keyboard_shortcut) |
[email protected] | 6e463eb | 2013-09-07 07:07:52 | [diff] [blame] | 58 | IPC_STRUCT_TRAITS_END() |
| 59 | |
[email protected] | eafe58fd | 2013-10-11 19:09:01 | [diff] [blame] | 60 | IPC_STRUCT_TRAITS_BEGIN(content::SyntheticGestureParams) |
| 61 | IPC_STRUCT_TRAITS_MEMBER(gesture_source_type) |
| 62 | IPC_STRUCT_TRAITS_END() |
| 63 | |
| 64 | IPC_STRUCT_TRAITS_BEGIN(content::SyntheticSmoothScrollGestureParams) |
| 65 | IPC_STRUCT_TRAITS_PARENT(content::SyntheticGestureParams) |
| 66 | IPC_STRUCT_TRAITS_MEMBER(distance) |
[email protected] | 1735b68 | 2013-11-17 16:04:20 | [diff] [blame] | 67 | IPC_STRUCT_TRAITS_MEMBER(anchor) |
[email protected] | 4cfa5ad | 2013-12-06 11:56:08 | [diff] [blame] | 68 | IPC_STRUCT_TRAITS_MEMBER(prevent_fling) |
[email protected] | 1735b68 | 2013-11-17 16:04:20 | [diff] [blame] | 69 | IPC_STRUCT_TRAITS_MEMBER(speed_in_pixels_s) |
| 70 | IPC_STRUCT_TRAITS_END() |
| 71 | |
| 72 | IPC_STRUCT_TRAITS_BEGIN(content::SyntheticPinchGestureParams) |
| 73 | IPC_STRUCT_TRAITS_PARENT(content::SyntheticGestureParams) |
| 74 | IPC_STRUCT_TRAITS_MEMBER(zoom_in) |
| 75 | IPC_STRUCT_TRAITS_MEMBER(total_num_pixels_covered) |
| 76 | IPC_STRUCT_TRAITS_MEMBER(anchor) |
| 77 | IPC_STRUCT_TRAITS_MEMBER(relative_pointer_speed_in_pixels_s) |
[email protected] | eafe58fd | 2013-10-11 19:09:01 | [diff] [blame] | 78 | IPC_STRUCT_TRAITS_END() |
| 79 | |
[email protected] | 26fae6396 | 2013-12-11 12:57:56 | [diff] [blame] | 80 | IPC_STRUCT_TRAITS_BEGIN(content::SyntheticTapGestureParams) |
| 81 | IPC_STRUCT_TRAITS_PARENT(content::SyntheticGestureParams) |
| 82 | IPC_STRUCT_TRAITS_MEMBER(position) |
| 83 | IPC_STRUCT_TRAITS_MEMBER(duration_ms) |
| 84 | IPC_STRUCT_TRAITS_END() |
| 85 | |
[email protected] | c084330e0 | 2013-04-27 01:08:15 | [diff] [blame] | 86 | // Sends an input event to the render widget. |
[email protected] | c2eaa8f | 2013-05-10 02:41:55 | [diff] [blame] | 87 | IPC_MESSAGE_ROUTED3(InputMsg_HandleInputEvent, |
[email protected] | c084330e0 | 2013-04-27 01:08:15 | [diff] [blame] | 88 | IPC::WebInputEventPointer /* event */, |
[email protected] | 4b15766 | 2013-05-29 04:05:05 | [diff] [blame] | 89 | ui::LatencyInfo /* latency_info */, |
[email protected] | c084330e0 | 2013-04-27 01:08:15 | [diff] [blame] | 90 | bool /* is_keyboard_shortcut */) |
| 91 | |
[email protected] | 34202de | 2013-05-06 23:36:22 | [diff] [blame] | 92 | // Sends the cursor visibility state to the render widget. |
| 93 | IPC_MESSAGE_ROUTED1(InputMsg_CursorVisibilityChange, |
| 94 | bool /* is_visible */) |
| 95 | |
[email protected] | c084330e0 | 2013-04-27 01:08:15 | [diff] [blame] | 96 | // This message notifies the renderer that the next key event is bound to one |
| 97 | // or more pre-defined edit commands. If the next key event is not handled |
| 98 | // by webkit, the specified edit commands shall be executed against current |
| 99 | // focused frame. |
| 100 | // Parameters |
| 101 | // * edit_commands (see chrome/common/edit_command_types.h) |
| 102 | // Contains one or more edit commands. |
| 103 | // See third_party/WebKit/Source/WebCore/editing/EditorCommand.cpp for detailed |
| 104 | // definition of webkit edit commands. |
| 105 | // |
| 106 | // This message must be sent just before sending a key event. |
| 107 | IPC_MESSAGE_ROUTED1(InputMsg_SetEditCommandsForNextKeyEvent, |
| 108 | std::vector<content::EditCommand> /* edit_commands */) |
| 109 | |
| 110 | // Message payload is the name/value of a WebCore edit command to execute. |
| 111 | IPC_MESSAGE_ROUTED2(InputMsg_ExecuteEditCommand, |
| 112 | std::string, /* name */ |
| 113 | std::string /* value */) |
| 114 | |
| 115 | IPC_MESSAGE_ROUTED0(InputMsg_MouseCaptureLost) |
| 116 | |
| 117 | // TODO(darin): figure out how this meshes with RestoreFocus |
| 118 | IPC_MESSAGE_ROUTED1(InputMsg_SetFocus, |
| 119 | bool /* enable */) |
| 120 | |
| 121 | // Tells the renderer to focus the first (last if reverse is true) focusable |
| 122 | // node. |
| 123 | IPC_MESSAGE_ROUTED1(InputMsg_SetInitialFocus, |
| 124 | bool /* reverse */) |
| 125 | |
| 126 | // Tells the renderer to scroll the currently focused node into rect only if |
| 127 | // the currently focused node is a Text node (textfield, text area or content |
| 128 | // editable divs). |
| 129 | IPC_MESSAGE_ROUTED1(InputMsg_ScrollFocusedEditableNodeIntoRect, gfx::Rect) |
| 130 | |
| 131 | // These messages are typically generated from context menus and request the |
| 132 | // renderer to apply the specified operation to the current selection. |
| 133 | IPC_MESSAGE_ROUTED0(InputMsg_Undo) |
| 134 | IPC_MESSAGE_ROUTED0(InputMsg_Redo) |
| 135 | IPC_MESSAGE_ROUTED0(InputMsg_Cut) |
| 136 | IPC_MESSAGE_ROUTED0(InputMsg_Copy) |
| 137 | #if defined(OS_MACOSX) |
| 138 | IPC_MESSAGE_ROUTED0(InputMsg_CopyToFindPboard) |
| 139 | #endif |
| 140 | IPC_MESSAGE_ROUTED0(InputMsg_Paste) |
| 141 | IPC_MESSAGE_ROUTED0(InputMsg_PasteAndMatchStyle) |
| 142 | // Replaces the selected region or a word around the cursor with the |
| 143 | // specified string. |
| 144 | IPC_MESSAGE_ROUTED1(InputMsg_Replace, |
[email protected] | fcf75d4 | 2013-12-03 20:11:26 | [diff] [blame] | 145 | base::string16) |
[email protected] | c084330e0 | 2013-04-27 01:08:15 | [diff] [blame] | 146 | // Replaces the misspelling in the selected region with the specified string. |
| 147 | IPC_MESSAGE_ROUTED1(InputMsg_ReplaceMisspelling, |
[email protected] | fcf75d4 | 2013-12-03 20:11:26 | [diff] [blame] | 148 | base::string16) |
[email protected] | c084330e0 | 2013-04-27 01:08:15 | [diff] [blame] | 149 | IPC_MESSAGE_ROUTED0(InputMsg_Delete) |
| 150 | IPC_MESSAGE_ROUTED0(InputMsg_SelectAll) |
| 151 | |
| 152 | IPC_MESSAGE_ROUTED0(InputMsg_Unselect) |
| 153 | |
| 154 | // Requests the renderer to select the region between two points. |
| 155 | // Expects a SelectRange_ACK message when finished. |
| 156 | IPC_MESSAGE_ROUTED2(InputMsg_SelectRange, |
| 157 | gfx::Point /* start */, |
| 158 | gfx::Point /* end */) |
| 159 | |
| 160 | // Requests the renderer to move the caret selection toward the point. |
| 161 | // Expects a MoveCaret_ACK message when finished. |
| 162 | IPC_MESSAGE_ROUTED1(InputMsg_MoveCaret, |
| 163 | gfx::Point /* location */) |
| 164 | |
| 165 | #if defined(OS_ANDROID) |
| 166 | // Sent when the user clicks on the find result bar to activate a find result. |
| 167 | // The point (x,y) is in fractions of the content document's width and height. |
| 168 | IPC_MESSAGE_ROUTED3(InputMsg_ActivateNearestFindResult, |
| 169 | int /* request_id */, |
| 170 | float /* x */, |
| 171 | float /* y */) |
| 172 | #endif |
| 173 | |
[email protected] | 9017d785 | 2013-11-21 17:47:35 | [diff] [blame] | 174 | IPC_MESSAGE_ROUTED0(InputMsg_SyntheticGestureCompleted); |
| 175 | |
[email protected] | c084330e0 | 2013-04-27 01:08:15 | [diff] [blame] | 176 | // ----------------------------------------------------------------------------- |
| 177 | // Messages sent from the renderer to the browser. |
| 178 | |
| 179 | // Acknowledges receipt of a InputMsg_HandleInputEvent message. |
[email protected] | f6df0edf | 2013-08-07 00:27:02 | [diff] [blame] | 180 | IPC_MESSAGE_ROUTED3(InputHostMsg_HandleInputEvent_ACK, |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 181 | blink::WebInputEvent::Type, |
[email protected] | f6df0edf | 2013-08-07 00:27:02 | [diff] [blame] | 182 | content::InputEventAckState /* ack_result */, |
| 183 | ui::LatencyInfo /* latency_info */) |
[email protected] | c084330e0 | 2013-04-27 01:08:15 | [diff] [blame] | 184 | |
[email protected] | 9017d785 | 2013-11-21 17:47:35 | [diff] [blame] | 185 | IPC_MESSAGE_ROUTED1(InputHostMsg_QueueSyntheticGesture, |
| 186 | content::SyntheticGesturePacket) |
| 187 | |
[email protected] | 5d0bbdfa9 | 2013-12-10 00:35:51 | [diff] [blame] | 188 | // Notifies the allowed touch actions for a new touch point. |
| 189 | IPC_MESSAGE_ROUTED1(InputHostMsg_SetTouchAction, |
| 190 | content::TouchAction /* touch_action */) |
[email protected] | c084330e0 | 2013-04-27 01:08:15 | [diff] [blame] | 191 | |
| 192 | // Adding a new message? Stick to the sort order above: first platform |
| 193 | // independent InputMsg, then ifdefs for platform specific InputMsg, then |
| 194 | // platform independent InputHostMsg, then ifdefs for platform specific |
| 195 | // InputHostMsg. |