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/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/port/common/input_event_ack_state.h"
14 #include "content/public/common/common_param_traits.h"
15 #include "ipc/ipc_message_macros.h"
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
17 #include "ui/base/latency_info.h"
18 #include "ui/gfx/point.h"
19 #include "ui/gfx/rect.h"
21 #undef IPC_MESSAGE_EXPORT
22 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
24 #ifdef IPC_MESSAGE_START
25 #error IPC_MESSAGE_START
28 #define IPC_MESSAGE_START InputMsgStart
30 IPC_ENUM_TRAITS(content::InputEventAckState
)
32 IPC_STRUCT_TRAITS_BEGIN(content::EditCommand
)
33 IPC_STRUCT_TRAITS_MEMBER(name
)
34 IPC_STRUCT_TRAITS_MEMBER(value
)
35 IPC_STRUCT_TRAITS_END()
37 // Sends an input event to the render widget.
38 IPC_MESSAGE_ROUTED3(InputMsg_HandleInputEvent
,
39 IPC::WebInputEventPointer
/* event */,
40 ui::LatencyInfo
/* latency_info */,
41 bool /* is_keyboard_shortcut */)
43 // Sends the cursor visibility state to the render widget.
44 IPC_MESSAGE_ROUTED1(InputMsg_CursorVisibilityChange
,
45 bool /* is_visible */)
47 // This message notifies the renderer that the next key event is bound to one
48 // or more pre-defined edit commands. If the next key event is not handled
49 // by webkit, the specified edit commands shall be executed against current
52 // * edit_commands (see chrome/common/edit_command_types.h)
53 // Contains one or more edit commands.
54 // See third_party/WebKit/Source/WebCore/editing/EditorCommand.cpp for detailed
55 // definition of webkit edit commands.
57 // This message must be sent just before sending a key event.
58 IPC_MESSAGE_ROUTED1(InputMsg_SetEditCommandsForNextKeyEvent
,
59 std::vector
<content::EditCommand
> /* edit_commands */)
61 // Message payload is the name/value of a WebCore edit command to execute.
62 IPC_MESSAGE_ROUTED2(InputMsg_ExecuteEditCommand
,
63 std::string
, /* name */
64 std::string
/* value */)
66 IPC_MESSAGE_ROUTED0(InputMsg_MouseCaptureLost
)
68 // TODO(darin): figure out how this meshes with RestoreFocus
69 IPC_MESSAGE_ROUTED1(InputMsg_SetFocus
,
72 // Tells the renderer to focus the first (last if reverse is true) focusable
74 IPC_MESSAGE_ROUTED1(InputMsg_SetInitialFocus
,
77 // Tells the renderer to scroll the currently focused node into rect only if
78 // the currently focused node is a Text node (textfield, text area or content
80 IPC_MESSAGE_ROUTED1(InputMsg_ScrollFocusedEditableNodeIntoRect
, gfx::Rect
)
82 // These messages are typically generated from context menus and request the
83 // renderer to apply the specified operation to the current selection.
84 IPC_MESSAGE_ROUTED0(InputMsg_Undo
)
85 IPC_MESSAGE_ROUTED0(InputMsg_Redo
)
86 IPC_MESSAGE_ROUTED0(InputMsg_Cut
)
87 IPC_MESSAGE_ROUTED0(InputMsg_Copy
)
88 #if defined(OS_MACOSX)
89 IPC_MESSAGE_ROUTED0(InputMsg_CopyToFindPboard
)
91 IPC_MESSAGE_ROUTED0(InputMsg_Paste
)
92 IPC_MESSAGE_ROUTED0(InputMsg_PasteAndMatchStyle
)
93 // Replaces the selected region or a word around the cursor with the
95 IPC_MESSAGE_ROUTED1(InputMsg_Replace
,
97 // Replaces the misspelling in the selected region with the specified string.
98 IPC_MESSAGE_ROUTED1(InputMsg_ReplaceMisspelling
,
100 IPC_MESSAGE_ROUTED0(InputMsg_Delete
)
101 IPC_MESSAGE_ROUTED0(InputMsg_SelectAll
)
103 IPC_MESSAGE_ROUTED0(InputMsg_Unselect
)
105 // Requests the renderer to select the region between two points.
106 // Expects a SelectRange_ACK message when finished.
107 IPC_MESSAGE_ROUTED2(InputMsg_SelectRange
,
108 gfx::Point
/* start */,
109 gfx::Point
/* end */)
111 // Requests the renderer to move the caret selection toward the point.
112 // Expects a MoveCaret_ACK message when finished.
113 IPC_MESSAGE_ROUTED1(InputMsg_MoveCaret
,
114 gfx::Point
/* location */)
116 #if defined(OS_ANDROID)
117 // Sent when the user clicks on the find result bar to activate a find result.
118 // The point (x,y) is in fractions of the content document's width and height.
119 IPC_MESSAGE_ROUTED3(InputMsg_ActivateNearestFindResult
,
120 int /* request_id */,
125 // -----------------------------------------------------------------------------
126 // Messages sent from the renderer to the browser.
128 // Acknowledges receipt of a InputMsg_HandleInputEvent message.
129 IPC_MESSAGE_ROUTED2(InputHostMsg_HandleInputEvent_ACK
,
130 WebKit::WebInputEvent::Type
,
131 content::InputEventAckState
/* ack_result */)
134 // Adding a new message? Stick to the sort order above: first platform
135 // independent InputMsg, then ifdefs for platform specific InputMsg, then
136 // platform independent InputHostMsg, then ifdefs for platform specific