1 // Copyright (c) 2012 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 // Multiply-included message header, no traditional include guard.
9 #include "base/basictypes.h"
10 #include "base/process/process.h"
11 #include "content/common/content_export.h"
12 #include "content/common/content_param_traits.h"
13 #include "content/common/cursors/webcursor.h"
14 #include "content/common/edit_command.h"
15 #include "content/common/frame_param_macros.h"
16 #include "content/public/common/common_param_traits.h"
17 #include "content/public/common/drop_data.h"
18 #include "ipc/ipc_channel_handle.h"
19 #include "ipc/ipc_message_macros.h"
20 #include "ipc/ipc_message_utils.h"
21 #include "third_party/WebKit/public/platform/WebFocusType.h"
22 #include "third_party/WebKit/public/web/WebCompositionUnderline.h"
23 #include "third_party/WebKit/public/web/WebDragOperation.h"
24 #include "third_party/WebKit/public/web/WebDragStatus.h"
25 #include "third_party/skia/include/core/SkBitmap.h"
26 #include "ui/gfx/geometry/point.h"
27 #include "ui/gfx/geometry/rect.h"
28 #include "ui/gfx/geometry/size.h"
29 #include "ui/gfx/ipc/gfx_param_traits.h"
32 #undef IPC_MESSAGE_EXPORT
33 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
35 #define IPC_MESSAGE_START BrowserPluginMsgStart
38 IPC_ENUM_TRAITS_MAX_VALUE(blink::WebDragStatus
, blink::WebDragStatusLast
)
39 IPC_ENUM_TRAITS_MAX_VALUE(blink::WebFocusType
, blink::WebFocusTypeLast
)
41 IPC_STRUCT_BEGIN(BrowserPluginHostMsg_Attach_Params
)
42 IPC_STRUCT_MEMBER(bool, focused
)
43 IPC_STRUCT_MEMBER(bool, visible
)
44 // The new size of the guest view.
45 IPC_STRUCT_MEMBER(gfx::Rect
, view_rect
)
46 // Whether the browser plugin is a full page plugin document.
47 IPC_STRUCT_MEMBER(bool, is_full_page_plugin
)
50 // Browser plugin messages
52 // -----------------------------------------------------------------------------
53 // These messages are from the embedder to the browser process.
54 // Most messages from the embedder to the browser process are CONTROL because
55 // they are routed to the appropriate BrowserPluginGuest based on the
56 // browser_plugin_instance_id which is unique per embedder process.
58 // This message is sent from BrowserPlugin to BrowserPluginGuest to issue an
60 IPC_MESSAGE_CONTROL2(BrowserPluginHostMsg_ExecuteEditCommand
,
61 int /* browser_plugin_instance_id */,
62 std::string
/* command */)
64 // This message must be sent just before sending a key event.
65 IPC_MESSAGE_CONTROL2(BrowserPluginHostMsg_SetEditCommandsForNextKeyEvent
,
66 int /* browser_plugin_instance_id */,
67 std::vector
<content::EditCommand
> /* edit_commands */)
69 // This message is sent from BrowserPlugin to BrowserPluginGuest whenever IME
70 // composition state is updated.
72 BrowserPluginHostMsg_ImeSetComposition
,
73 int /* browser_plugin_instance_id */,
74 std::string
/* text */,
75 std::vector
<blink::WebCompositionUnderline
> /* underlines */,
76 int /* selectiont_start */,
77 int /* selection_end */)
79 // This message is sent from BrowserPlugin to BrowserPluginGuest to notify that
80 // confirming the current composition is requested.
81 IPC_MESSAGE_CONTROL3(BrowserPluginHostMsg_ImeConfirmComposition
,
82 int /* browser_plugin_instance_id */,
83 std::string
/* text */,
84 bool /* keep selection */)
86 // Deletes the current selection plus the specified number of characters before
87 // and after the selection or caret.
88 IPC_MESSAGE_CONTROL3(BrowserPluginHostMsg_ExtendSelectionAndDelete
,
89 int /* browser_plugin_instance_id */,
93 // This message is sent to the browser process to indicate that the
94 // BrowserPlugin identified by |browser_plugin_instance_id| is ready to serve
95 // as container for a guest. |params| is the state of the BrowserPlugin.
96 // This message is routed because we create a BrowserPluginEmbedder object
97 // the first time we see this message arrive to a WebContents. We need a routing
98 // ID to get this message to a particular WebContents.
99 IPC_MESSAGE_ROUTED2(BrowserPluginHostMsg_Attach
,
100 int /* browser_plugin_instance_id */,
101 BrowserPluginHostMsg_Attach_Params
/* params */)
103 // This message is sent to the browser process to indicate that the
104 // BrowserPlugin identified by |browser_plugin_instance_id| will no longer serve
105 // as a container for a guest.
106 IPC_MESSAGE_CONTROL1(BrowserPluginHostMsg_Detach
,
107 int /* browser_plugin_instance_id */)
109 // Tells the guest to focus or defocus itself.
110 IPC_MESSAGE_CONTROL3(BrowserPluginHostMsg_SetFocus
,
111 int /* browser_plugin_instance_id */,
113 blink::WebFocusType
/* focus_type */)
115 // Sends an input event to the guest.
116 IPC_MESSAGE_CONTROL3(BrowserPluginHostMsg_HandleInputEvent
,
117 int /* browser_plugin_instance_id */,
118 gfx::Rect
/* guest_window_rect */,
119 IPC::WebInputEventPointer
/* event */)
121 // Notify the guest renderer that some resources given to the embededer
122 // are not used any more.
123 IPC_MESSAGE_CONTROL2(
124 BrowserPluginHostMsg_ReclaimCompositorResources
,
125 int /* browser_plugin_instance_id */,
126 FrameHostMsg_ReclaimCompositorResources_Params
/* params */)
128 // Tells the guest it has been shown or hidden.
129 IPC_MESSAGE_CONTROL2(BrowserPluginHostMsg_SetVisibility
,
130 int /* browser_plugin_instance_id */,
133 // Tells the guest that a drag event happened on the plugin.
134 IPC_MESSAGE_CONTROL5(BrowserPluginHostMsg_DragStatusUpdate
,
135 int /* browser_plugin_instance_id */,
136 blink::WebDragStatus
/* drag_status */,
137 content::DropData
/* drop_data */,
138 blink::WebDragOperationsMask
/* operation_mask */,
139 gfx::Point
/* plugin_location */)
141 // Sends a PointerLock Lock ACK to the BrowserPluginGuest.
142 IPC_MESSAGE_CONTROL2(BrowserPluginHostMsg_LockMouse_ACK
,
143 int /* browser_plugin_instance_id */,
144 bool /* succeeded */)
146 // Sends a PointerLock Unlock ACK to the BrowserPluginGuest.
147 IPC_MESSAGE_CONTROL1(BrowserPluginHostMsg_UnlockMouse_ACK
,
148 int /* browser_plugin_instance_id */)
150 // Sent when plugin's position has changed.
151 IPC_MESSAGE_CONTROL2(BrowserPluginHostMsg_UpdateGeometry
,
152 int /* browser_plugin_instance_id */,
153 gfx::Rect
/* view_rect */)
155 // -----------------------------------------------------------------------------
156 // These messages are from the browser process to the embedder.
158 // When the guest crashes, the browser process informs the embedder through this
160 IPC_MESSAGE_CONTROL1(BrowserPluginMsg_GuestGone
,
161 int /* browser_plugin_instance_id */)
163 // When the user tabs to the end of the tab stops of a guest, the browser
164 // process informs the embedder to tab out of the browser plugin.
165 IPC_MESSAGE_CONTROL2(BrowserPluginMsg_AdvanceFocus
,
166 int /* browser_plugin_instance_id */,
169 // When the guest starts/stops listening to touch events, it needs to notify the
170 // plugin in the embedder about it.
171 IPC_MESSAGE_CONTROL2(BrowserPluginMsg_ShouldAcceptTouchEvents
,
172 int /* browser_plugin_instance_id */,
175 // Tells the guest to change its background opacity.
176 IPC_MESSAGE_CONTROL2(BrowserPluginMsg_SetContentsOpaque
,
177 int /* browser_plugin_instance_id */,
180 // Inform the embedder of the cursor the guest wishes to display.
181 IPC_MESSAGE_CONTROL2(BrowserPluginMsg_SetCursor
,
182 int /* browser_plugin_instance_id */,
183 content::WebCursor
/* cursor */)
185 IPC_MESSAGE_CONTROL2(BrowserPluginMsg_CompositorFrameSwapped
,
186 int /* browser_plugin_instance_id */,
187 FrameMsg_CompositorFrameSwapped_Params
/* params */)
189 // Forwards a PointerLock Unlock request to the BrowserPlugin.
190 IPC_MESSAGE_CONTROL2(BrowserPluginMsg_SetMouseLock
,
191 int /* browser_plugin_instance_id */,
194 // Sends text to be displayed in tooltip.
195 IPC_MESSAGE_CONTROL2(BrowserPluginMsg_SetTooltipText
,
196 int /* browser_plugin_instance_id */,
197 base::string16
/* tooltip_text */)
199 // Acknowledge that we presented an ubercomp frame.
200 IPC_MESSAGE_CONTROL2(BrowserPluginHostMsg_CompositorFrameSwappedACK
,
201 int /* browser_plugin_instance_id */,
202 FrameHostMsg_CompositorFrameSwappedACK_Params
/* params */)