blob: a9739fab00319ae8b0bdc7729e79273323f33c70 [file] [log] [blame]
Torne (Richard Coles)c2e0dbd2013-05-09 18:35:53 +01001// 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
9#include "base/string16.h"
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +010010#include "cc/debug/latency_info.h"
Torne (Richard Coles)c2e0dbd2013-05-09 18:35:53 +010011#include "content/common/content_export.h"
12#include "content/common/content_param_traits.h"
13#include "content/common/edit_command.h"
14#include "content/port/common/input_event_ack_state.h"
15#include "content/public/common/common_param_traits.h"
16#include "ipc/ipc_message_macros.h"
17#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
18#include "ui/gfx/point.h"
19#include "ui/gfx/rect.h"
20
21#undef IPC_MESSAGE_EXPORT
22#define IPC_MESSAGE_EXPORT CONTENT_EXPORT
23
24#ifdef IPC_MESSAGE_START
25#error IPC_MESSAGE_START
26#endif
27
28#define IPC_MESSAGE_START InputMsgStart
29
30IPC_ENUM_TRAITS(content::InputEventAckState)
31
32IPC_STRUCT_TRAITS_BEGIN(content::EditCommand)
33 IPC_STRUCT_TRAITS_MEMBER(name)
34 IPC_STRUCT_TRAITS_MEMBER(value)
35IPC_STRUCT_TRAITS_END()
36
37// Sends an input event to the render widget.
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +010038IPC_MESSAGE_ROUTED3(InputMsg_HandleInputEvent,
Torne (Richard Coles)c2e0dbd2013-05-09 18:35:53 +010039 IPC::WebInputEventPointer /* event */,
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +010040 cc::LatencyInfo /* latency_info */,
Torne (Richard Coles)c2e0dbd2013-05-09 18:35:53 +010041 bool /* is_keyboard_shortcut */)
42
43// Sends the cursor visibility state to the render widget.
44IPC_MESSAGE_ROUTED1(InputMsg_CursorVisibilityChange,
45 bool /* is_visible */)
46
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
50// focused frame.
51// Parameters
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.
56//
57// This message must be sent just before sending a key event.
58IPC_MESSAGE_ROUTED1(InputMsg_SetEditCommandsForNextKeyEvent,
59 std::vector<content::EditCommand> /* edit_commands */)
60
61// Message payload is the name/value of a WebCore edit command to execute.
62IPC_MESSAGE_ROUTED2(InputMsg_ExecuteEditCommand,
63 std::string, /* name */
64 std::string /* value */)
65
66IPC_MESSAGE_ROUTED0(InputMsg_MouseCaptureLost)
67
68// TODO(darin): figure out how this meshes with RestoreFocus
69IPC_MESSAGE_ROUTED1(InputMsg_SetFocus,
70 bool /* enable */)
71
72// Tells the renderer to focus the first (last if reverse is true) focusable
73// node.
74IPC_MESSAGE_ROUTED1(InputMsg_SetInitialFocus,
75 bool /* reverse */)
76
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
79// editable divs).
80IPC_MESSAGE_ROUTED1(InputMsg_ScrollFocusedEditableNodeIntoRect, gfx::Rect)
81
82// These messages are typically generated from context menus and request the
83// renderer to apply the specified operation to the current selection.
84IPC_MESSAGE_ROUTED0(InputMsg_Undo)
85IPC_MESSAGE_ROUTED0(InputMsg_Redo)
86IPC_MESSAGE_ROUTED0(InputMsg_Cut)
87IPC_MESSAGE_ROUTED0(InputMsg_Copy)
88#if defined(OS_MACOSX)
89IPC_MESSAGE_ROUTED0(InputMsg_CopyToFindPboard)
90#endif
91IPC_MESSAGE_ROUTED0(InputMsg_Paste)
92IPC_MESSAGE_ROUTED0(InputMsg_PasteAndMatchStyle)
93// Replaces the selected region or a word around the cursor with the
94// specified string.
95IPC_MESSAGE_ROUTED1(InputMsg_Replace,
96 string16)
97// Replaces the misspelling in the selected region with the specified string.
98IPC_MESSAGE_ROUTED1(InputMsg_ReplaceMisspelling,
99 string16)
100IPC_MESSAGE_ROUTED0(InputMsg_Delete)
101IPC_MESSAGE_ROUTED0(InputMsg_SelectAll)
102
103IPC_MESSAGE_ROUTED0(InputMsg_Unselect)
104
105// Requests the renderer to select the region between two points.
106// Expects a SelectRange_ACK message when finished.
107IPC_MESSAGE_ROUTED2(InputMsg_SelectRange,
108 gfx::Point /* start */,
109 gfx::Point /* end */)
110
111// Requests the renderer to move the caret selection toward the point.
112// Expects a MoveCaret_ACK message when finished.
113IPC_MESSAGE_ROUTED1(InputMsg_MoveCaret,
114 gfx::Point /* location */)
115
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.
119IPC_MESSAGE_ROUTED3(InputMsg_ActivateNearestFindResult,
120 int /* request_id */,
121 float /* x */,
122 float /* y */)
123#endif
124
125// -----------------------------------------------------------------------------
126// Messages sent from the renderer to the browser.
127
128// Acknowledges receipt of a InputMsg_HandleInputEvent message.
129IPC_MESSAGE_ROUTED2(InputHostMsg_HandleInputEvent_ACK,
130 WebKit::WebInputEvent::Type,
131 content::InputEventAckState /* ack_result */)
132
133
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
137// InputHostMsg.