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/web/WebCompositionUnderline.h"
22 #include "third_party/WebKit/public/web/WebDragOperation.h"
23 #include "third_party/WebKit/public/web/WebDragStatus.h"
24 #include "third_party/skia/include/core/SkBitmap.h"
25 #include "ui/gfx/ipc/gfx_param_traits.h"
26 #include "ui/gfx/point.h"
27 #include "ui/gfx/rect.h"
28 #include "ui/gfx/size.h"
31 #undef IPC_MESSAGE_EXPORT
32 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
34 #define IPC_MESSAGE_START BrowserPluginMsgStart
37 IPC_ENUM_TRAITS_MAX_VALUE(blink::WebDragStatus
, blink::WebDragStatusLast
)
39 IPC_STRUCT_BEGIN(BrowserPluginHostMsg_ResizeGuest_Params
)
40 // The new size of guest view.
41 IPC_STRUCT_MEMBER(gfx::Size
, view_size
)
42 // Indicates the scale factor of the embedder WebView.
43 IPC_STRUCT_MEMBER(float, scale_factor
)
44 // Indicates a request for a full repaint of the page.
45 // This is required for switching from compositing to the software
47 IPC_STRUCT_MEMBER(bool, repaint
)
50 IPC_STRUCT_BEGIN(BrowserPluginHostMsg_Attach_Params
)
51 IPC_STRUCT_MEMBER(bool, focused
)
52 IPC_STRUCT_MEMBER(bool, visible
)
53 IPC_STRUCT_MEMBER(BrowserPluginHostMsg_ResizeGuest_Params
,
55 IPC_STRUCT_MEMBER(gfx::Point
, origin
)
56 // Whether the browser plugin is a full page plugin document.
57 IPC_STRUCT_MEMBER(bool, is_full_page_plugin
)
60 // Browser plugin messages
62 // -----------------------------------------------------------------------------
63 // These messages are from the embedder to the browser process.
65 // This message is sent from BrowserPlugin to BrowserPluginGuest to issue an
67 IPC_MESSAGE_ROUTED2(BrowserPluginHostMsg_ExecuteEditCommand
,
68 int /* browser_plugin_instance_id */,
69 std::string
/* command */)
71 // This message must be sent just before sending a key event.
72 IPC_MESSAGE_ROUTED2(BrowserPluginHostMsg_SetEditCommandsForNextKeyEvent
,
73 int /* browser_plugin_instance_id */,
74 std::vector
<content::EditCommand
> /* edit_commands */)
76 // This message is sent from BrowserPlugin to BrowserPluginGuest whenever IME
77 // composition state is updated.
79 BrowserPluginHostMsg_ImeSetComposition
,
80 int /* browser_plugin_instance_id */,
81 std::string
/* text */,
82 std::vector
<blink::WebCompositionUnderline
> /* underlines */,
83 int /* selectiont_start */,
84 int /* selection_end */)
86 // This message is sent from BrowserPlugin to BrowserPluginGuest to notify that
87 // confirming the current composition is requested.
88 IPC_MESSAGE_ROUTED3(BrowserPluginHostMsg_ImeConfirmComposition
,
89 int /* browser_plugin_instance_id */,
90 std::string
/* text */,
91 bool /* keep selection */)
93 // Deletes the current selection plus the specified number of characters before
94 // and after the selection or caret.
95 IPC_MESSAGE_ROUTED3(BrowserPluginHostMsg_ExtendSelectionAndDelete
,
96 int /* browser_plugin_instance_id */,
100 // This message is sent to the browser process to indicate that a BrowserPlugin
101 // has taken ownership of the lifetime of the guest of the given
102 // |browser_plugin_instance_id|. |params| is the state of the BrowserPlugin
103 // taking ownership of the guest.
104 IPC_MESSAGE_ROUTED2(BrowserPluginHostMsg_Attach
,
105 int /* browser_plugin_instance_id */,
106 BrowserPluginHostMsg_Attach_Params
/* params */)
108 // Tells the guest to focus or defocus itself.
109 IPC_MESSAGE_ROUTED2(BrowserPluginHostMsg_SetFocus
,
110 int /* browser_plugin_instance_id */,
113 // Sends an input event to the guest.
114 IPC_MESSAGE_ROUTED3(BrowserPluginHostMsg_HandleInputEvent
,
115 int /* browser_plugin_instance_id */,
116 gfx::Rect
/* guest_window_rect */,
117 IPC::WebInputEventPointer
/* event */)
119 // Notify the guest renderer that some resources given to the embededer
120 // are not used any more.
121 IPC_MESSAGE_ROUTED2(BrowserPluginHostMsg_ReclaimCompositorResources
,
122 int /* browser_plugin_instance_id */,
123 FrameHostMsg_ReclaimCompositorResources_Params
/* params */)
125 // Tells the guest it has been shown or hidden.
126 IPC_MESSAGE_ROUTED2(BrowserPluginHostMsg_SetVisibility
,
127 int /* browser_plugin_instance_id */,
130 // Tells the guest that a drag event happened on the plugin.
131 IPC_MESSAGE_ROUTED5(BrowserPluginHostMsg_DragStatusUpdate
,
132 int /* browser_plugin_instance_id */,
133 blink::WebDragStatus
/* drag_status */,
134 content::DropData
/* drop_data */,
135 blink::WebDragOperationsMask
/* operation_mask */,
136 gfx::Point
/* plugin_location */)
138 // Sends a PointerLock Lock ACK to the BrowserPluginGuest.
139 IPC_MESSAGE_ROUTED2(BrowserPluginHostMsg_LockMouse_ACK
,
140 int /* browser_plugin_instance_id */,
141 bool /* succeeded */)
143 // Sends a PointerLock Unlock ACK to the BrowserPluginGuest.
144 IPC_MESSAGE_ROUTED1(BrowserPluginHostMsg_UnlockMouse_ACK
,
145 int /* browser_plugin_instance_id */)
147 // Sent when plugin's position has changed.
148 IPC_MESSAGE_ROUTED2(BrowserPluginHostMsg_UpdateGeometry
,
149 int /* browser_plugin_instance_id */,
150 gfx::Rect
/* view_rect */)
152 // -----------------------------------------------------------------------------
153 // These messages are from the guest renderer to the browser process
155 // A embedder sends this message to the browser when it wants
156 // to resize a guest plugin container so that the guest is relaid out
157 // according to the new size.
158 IPC_MESSAGE_ROUTED2(BrowserPluginHostMsg_ResizeGuest
,
159 int /* browser_plugin_instance_id*/,
160 BrowserPluginHostMsg_ResizeGuest_Params
)
162 // -----------------------------------------------------------------------------
163 // These messages are from the browser process to the embedder.
165 // This message is sent in response to a completed attachment of a guest
166 // to a BrowserPlugin.
167 IPC_MESSAGE_CONTROL1(BrowserPluginMsg_Attach_ACK
,
168 int /* browser_plugin_instance_id */)
170 // When the guest crashes, the browser process informs the embedder through this
172 IPC_MESSAGE_CONTROL1(BrowserPluginMsg_GuestGone
,
173 int /* browser_plugin_instance_id */)
175 // When the user tabs to the end of the tab stops of a guest, the browser
176 // process informs the embedder to tab out of the browser plugin.
177 IPC_MESSAGE_CONTROL2(BrowserPluginMsg_AdvanceFocus
,
178 int /* browser_plugin_instance_id */,
181 // When the guest starts/stops listening to touch events, it needs to notify the
182 // plugin in the embedder about it.
183 IPC_MESSAGE_CONTROL2(BrowserPluginMsg_ShouldAcceptTouchEvents
,
184 int /* browser_plugin_instance_id */,
187 // Tells the guest to change its background opacity.
188 IPC_MESSAGE_CONTROL2(BrowserPluginMsg_SetContentsOpaque
,
189 int /* browser_plugin_instance_id */,
192 // Inform the embedder of the cursor the guest wishes to display.
193 IPC_MESSAGE_CONTROL2(BrowserPluginMsg_SetCursor
,
194 int /* browser_plugin_instance_id */,
195 content::WebCursor
/* cursor */)
197 IPC_MESSAGE_CONTROL2(BrowserPluginMsg_CompositorFrameSwapped
,
198 int /* browser_plugin_instance_id */,
199 FrameMsg_CompositorFrameSwapped_Params
/* params */)
201 // Forwards a PointerLock Unlock request to the BrowserPlugin.
202 IPC_MESSAGE_CONTROL2(BrowserPluginMsg_SetMouseLock
,
203 int /* browser_plugin_instance_id */,
206 // Sends text to be displayed in tooltip.
207 IPC_MESSAGE_CONTROL2(BrowserPluginMsg_SetTooltipText
,
208 int /* browser_plugin_instance_id */,
209 base::string16
/* tooltip_text */)
211 // Acknowledge that we presented an ubercomp frame.
212 IPC_MESSAGE_ROUTED2(BrowserPluginHostMsg_CompositorFrameSwappedACK
,
213 int /* browser_plugin_instance_id */,
214 FrameHostMsg_CompositorFrameSwappedACK_Params
/* params */)