[content shell] hook up testRunner.dumpEditingCallbacks
[chromium-blink-merge.git] / content / common / browser_plugin_messages.h
blob07f1d8872d09fe20bd25a84b9fd32ce294e7de91
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.
7 #include <string>
9 #include "base/basictypes.h"
10 #include "base/process.h"
11 #include "content/common/content_export.h"
12 #include "content/common/content_param_traits.h"
13 #include "content/public/common/common_param_traits.h"
14 #include "ipc/ipc_channel_handle.h"
15 #include "ipc/ipc_message_macros.h"
16 #include "ipc/ipc_message_utils.h"
17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragStatus.h"
18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragOperation.h"
19 #include "ui/gfx/point.h"
20 #include "ui/gfx/rect.h"
21 #include "ui/gfx/size.h"
22 #include "webkit/glue/webcursor.h"
23 #include "webkit/glue/webdropdata.h"
25 #undef IPC_MESSAGE_EXPORT
26 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
28 #define IPC_MESSAGE_START BrowserPluginMsgStart
30 IPC_ENUM_TRAITS(WebKit::WebDragStatus)
32 IPC_STRUCT_BEGIN(BrowserPluginHostMsg_AutoSize_Params)
33 IPC_STRUCT_MEMBER(bool, enable)
34 IPC_STRUCT_MEMBER(gfx::Size, max_size)
35 IPC_STRUCT_MEMBER(gfx::Size, min_size)
36 IPC_STRUCT_END()
38 IPC_STRUCT_BEGIN(BrowserPluginHostMsg_ResizeGuest_Params)
39 // An identifier to the new buffer to use to transport damage to the embedder
40 // renderer process.
41 IPC_STRUCT_MEMBER(TransportDIB::Id, damage_buffer_id)
42 #if defined(OS_MACOSX)
43 // On OSX, a handle to the new buffer is used to map the transport dib since
44 // we don't let browser manage the dib.
45 IPC_STRUCT_MEMBER(TransportDIB::Handle, damage_buffer_handle)
46 #endif
47 #if defined(OS_WIN)
48 // The size of the damage buffer because this information is not available
49 // on Windows.
50 IPC_STRUCT_MEMBER(int, damage_buffer_size)
51 #endif
52 // The new size of the guest view area.
53 IPC_STRUCT_MEMBER(gfx::Size, view_size)
54 // Indicates the scale factor of the embedder WebView.
55 IPC_STRUCT_MEMBER(float, scale_factor)
56 IPC_STRUCT_END()
58 IPC_STRUCT_BEGIN(BrowserPluginHostMsg_CreateGuest_Params)
59 IPC_STRUCT_MEMBER(std::string, storage_partition_id)
60 IPC_STRUCT_MEMBER(bool, persist_storage)
61 IPC_STRUCT_MEMBER(bool, focused)
62 IPC_STRUCT_MEMBER(bool, visible)
63 IPC_STRUCT_MEMBER(BrowserPluginHostMsg_AutoSize_Params, auto_size_params)
64 IPC_STRUCT_MEMBER(BrowserPluginHostMsg_ResizeGuest_Params,
65 resize_guest_params)
66 IPC_STRUCT_END()
68 IPC_STRUCT_BEGIN(BrowserPluginMsg_LoadCommit_Params)
69 // The current URL of the guest.
70 IPC_STRUCT_MEMBER(GURL, url)
71 // Indicates whether the navigation was on the top-level frame.
72 IPC_STRUCT_MEMBER(bool, is_top_level)
73 // Chrome's process ID for the guest.
74 IPC_STRUCT_MEMBER(int, process_id)
75 // The index of the current navigation entry after this navigation was
76 // committed.
77 IPC_STRUCT_MEMBER(int, current_entry_index)
78 // The number of navigation entries after this navigation was committed.
79 IPC_STRUCT_MEMBER(int, entry_count)
80 IPC_STRUCT_END()
82 IPC_STRUCT_BEGIN(BrowserPluginMsg_UpdateRect_Params)
83 // The bitmap to be painted into the view at the locations specified by
84 // update_rects.
85 #if defined(OS_MACOSX)
86 IPC_STRUCT_MEMBER(TransportDIB::Id, damage_buffer_identifier)
87 #else
88 IPC_STRUCT_MEMBER(TransportDIB::Handle, damage_buffer_identifier)
89 #endif
91 // The position and size of the bitmap.
92 IPC_STRUCT_MEMBER(gfx::Rect, bitmap_rect)
94 // The scroll delta. Only one of the delta components can be non-zero, and if
95 // they are both zero, then it means there is no scrolling and the scroll_rect
96 // is ignored.
97 IPC_STRUCT_MEMBER(gfx::Vector2d, scroll_delta)
99 // The rectangular region to scroll.
100 IPC_STRUCT_MEMBER(gfx::Rect, scroll_rect)
102 // The scroll offset of the render view.
103 IPC_STRUCT_MEMBER(gfx::Point, scroll_offset)
105 // The regions of the bitmap (in view coords) that contain updated pixels.
106 // In the case of scrolling, this includes the scroll damage rect.
107 IPC_STRUCT_MEMBER(std::vector<gfx::Rect>, copy_rects)
109 // The size of the RenderView when this message was generated. This is
110 // included so the host knows how large the view is from the perspective of
111 // the renderer process. This is necessary in case a resize operation is in
112 // progress. If auto-resize is enabled, this should update the corresponding
113 // view size.
114 IPC_STRUCT_MEMBER(gfx::Size, view_size)
116 // All the above coordinates are in DIP. This is the scale factor needed
117 // to convert them to pixels.
118 IPC_STRUCT_MEMBER(float, scale_factor)
120 // Is this UpdateRect an ACK to a resize request?
121 IPC_STRUCT_MEMBER(bool, is_resize_ack)
122 IPC_STRUCT_END()
124 // Browser plugin messages
126 // -----------------------------------------------------------------------------
127 // These messages are from the embedder to the browser process.
129 // This message is sent to the browser process to enable or disable autosize
130 // mode.
131 IPC_MESSAGE_ROUTED3(
132 BrowserPluginHostMsg_SetAutoSize,
133 int /* instance_id */,
134 BrowserPluginHostMsg_AutoSize_Params /* auto_size_params */,
135 BrowserPluginHostMsg_ResizeGuest_Params /* resize_guest_params */)
138 // This message is sent to the browser process to create the browser plugin
139 // embedder and helper. It is sent once prior to sending the first
140 // BrowserPluginHostMsg_NavigateGuest message.
141 IPC_MESSAGE_ROUTED2(BrowserPluginHostMsg_CreateGuest,
142 int /* instance_id */,
143 BrowserPluginHostMsg_CreateGuest_Params /* params */)
145 // Tells the browser process to terminate the guest associated with the
146 // browser plugin associated with the provided |instance_id|.
147 IPC_MESSAGE_ROUTED1(BrowserPluginHostMsg_TerminateGuest,
148 int /* instance_id */)
150 // Tells the guest to navigate to an entry |relative_index| away from the
151 // current navigation entry.
152 IPC_MESSAGE_ROUTED2(BrowserPluginHostMsg_Go,
153 int /* instance_id */,
154 int /* relative_index */)
156 // Tells the guest to focus or defocus itself.
157 IPC_MESSAGE_ROUTED2(BrowserPluginHostMsg_SetFocus,
158 int /* instance_id */,
159 bool /* enable */)
161 // Tell the guest to stop loading.
162 IPC_MESSAGE_ROUTED1(BrowserPluginHostMsg_Stop,
163 int /* instance_id */)
165 // Tell the guest to reload.
166 IPC_MESSAGE_ROUTED1(BrowserPluginHostMsg_Reload,
167 int /* instance_id */)
169 // Sends an input event to the guest.
170 IPC_MESSAGE_ROUTED3(BrowserPluginHostMsg_HandleInputEvent,
171 int /* instance_id */,
172 gfx::Rect /* guest_window_rect */,
173 IPC::WebInputEventPointer /* event */)
175 // An ACK to the guest process letting it know that the embedder has handled
176 // the previous frame and is ready for the next frame. If the guest sent the
177 // embedder a bitmap that does not match the size of the BrowserPlugin's
178 // container, the BrowserPlugin requests a new size as well.
179 IPC_MESSAGE_ROUTED4(BrowserPluginHostMsg_UpdateRect_ACK,
180 int /* instance_id */,
181 int /* message_id */,
182 BrowserPluginHostMsg_AutoSize_Params /* auto_size_params */,
183 BrowserPluginHostMsg_ResizeGuest_Params /* resize_guest_params */)
185 // A BrowserPlugin sends this to BrowserPluginEmbedder (browser process) when it
186 // wants to navigate to a given src URL. If a guest WebContents already exists,
187 // it will navigate that WebContents. If not, it will create the WebContents,
188 // associate it with the BrowserPluginGuest, and navigate it to the requested
189 // URL.
190 IPC_MESSAGE_ROUTED2(BrowserPluginHostMsg_NavigateGuest,
191 int /* instance_id*/,
192 std::string /* src */)
194 // Acknowledge that we presented a HW buffer and provide a sync point
195 // to specify the location in the command stream when the compositor
196 // is no longer using it.
197 IPC_MESSAGE_ROUTED4(BrowserPluginHostMsg_BuffersSwappedACK,
198 int /* route_id */,
199 int /* gpu_host_id */,
200 uint64 /* surface_handle */,
201 uint32 /* sync_point */)
203 // When a BrowserPlugin has been removed from the embedder's DOM, it informs
204 // the browser process to cleanup the guest.
205 IPC_MESSAGE_ROUTED1(BrowserPluginHostMsg_PluginDestroyed,
206 int /* instance_id */)
208 // Tells the guest it has been shown or hidden.
209 IPC_MESSAGE_ROUTED2(BrowserPluginHostMsg_SetVisibility,
210 int /* instance_id */,
211 bool /* visible */)
213 // Tells the guest that a drag event happened on the plugin.
214 IPC_MESSAGE_ROUTED5(BrowserPluginHostMsg_DragStatusUpdate,
215 int /* instance_id */,
216 WebKit::WebDragStatus /* drag_status */,
217 WebDropData /* drop_data */,
218 WebKit::WebDragOperationsMask /* operation_mask */,
219 gfx::Point /* plugin_location */)
221 // Response to BrowserPluginMsg_PluginAtPositionRequest, returns the browser
222 // plugin instace id and the coordinates (local to the plugin).
223 IPC_MESSAGE_ROUTED3(BrowserPluginHostMsg_PluginAtPositionResponse,
224 int /* instance_id */,
225 int /* request_id */,
226 gfx::Point /* position */)
228 // -----------------------------------------------------------------------------
229 // These messages are from the guest renderer to the browser process
231 // A embedder sends this message to the browser when it wants
232 // to resize a guest plugin container so that the guest is relaid out
233 // according to the new size.
234 IPC_MESSAGE_ROUTED2(BrowserPluginHostMsg_ResizeGuest,
235 int /* instance_id*/,
236 BrowserPluginHostMsg_ResizeGuest_Params)
238 // -----------------------------------------------------------------------------
239 // These messages are from the browser process to the embedder.
241 // Once the swapped out guest RenderView has been created in the embedder render
242 // process, the browser process informs the embedder of its routing ID.
243 IPC_MESSAGE_ROUTED2(BrowserPluginMsg_GuestContentWindowReady,
244 int /* instance_id */,
245 int /* source_routing_id */)
247 // When the guest begins to load a page, the browser process informs the
248 // embedder through the BrowserPluginMsg_LoadStart message.
249 IPC_MESSAGE_ROUTED3(BrowserPluginMsg_LoadStart,
250 int /* instance_id */,
251 GURL /* url */,
252 bool /* is_top_level */)
254 // If the guest fails to commit a page load then it will inform the
255 // embedder through the BrowserPluginMsg_LoadAbort. A description
256 // of the error will be stored in |type|. The list of known error
257 // types can be found in net/base/net_error_list.h.
258 IPC_MESSAGE_ROUTED4(BrowserPluginMsg_LoadAbort,
259 int /* instance_id */,
260 GURL /* url */,
261 bool /* is_top_level */,
262 std::string /* type */)
264 // When the guest redirects a navigation, the browser process informs the
265 // embedder through the BrowserPluginMsg_LoadRedirect message.
266 IPC_MESSAGE_ROUTED4(BrowserPluginMsg_LoadRedirect,
267 int /* instance_id */,
268 GURL /* old_url */,
269 GURL /* new_url */,
270 bool /* is_top_level */)
272 // When the guest commits a navigation, the browser process informs
273 // the embedder through the BrowserPluginMsg_DidCommit message.
274 IPC_MESSAGE_ROUTED2(BrowserPluginMsg_LoadCommit,
275 int /* instance_id */,
276 BrowserPluginMsg_LoadCommit_Params)
278 // When the guest page has completed loading (including subframes), the browser
279 // process informs the embedder through the BrowserPluginMsg_LoadStop message.
280 IPC_MESSAGE_ROUTED1(BrowserPluginMsg_LoadStop,
281 int /* instance_id */)
283 // When the guest crashes, the browser process informs the embedder through this
284 // message.
285 IPC_MESSAGE_ROUTED3(BrowserPluginMsg_GuestGone,
286 int /* instance_id */,
287 int /* process_id */,
288 int /* This is really base::TerminationStatus */)
290 // When the guest is unresponsive, the browser process informs the embedder
291 // through this message.
292 IPC_MESSAGE_ROUTED2(BrowserPluginMsg_GuestUnresponsive,
293 int /* instance_id */,
294 int /* process_id */)
296 // When the guest begins responding again, the browser process informs the
297 // embedder through this message.
298 IPC_MESSAGE_ROUTED2(BrowserPluginMsg_GuestResponsive,
299 int /* instance_id */,
300 int /* process_id */)
302 // When the user tabs to the end of the tab stops of a guest, the browser
303 // process informs the embedder to tab out of the browser plugin.
304 IPC_MESSAGE_ROUTED2(BrowserPluginMsg_AdvanceFocus,
305 int /* instance_id */,
306 bool /* reverse */)
308 // When the guest starts/stops listening to touch events, it needs to notify the
309 // plugin in the embedder about it.
310 IPC_MESSAGE_ROUTED2(BrowserPluginMsg_ShouldAcceptTouchEvents,
311 int /* instance_id */,
312 bool /* accept */)
314 // Inform the embedder of the cursor the guest wishes to display.
315 IPC_MESSAGE_ROUTED2(BrowserPluginMsg_SetCursor,
316 int /* instance_id */,
317 WebCursor /* cursor */)
319 // The guest has damage it wants to convey to the embedder so that it can
320 // update its backing store.
321 IPC_MESSAGE_ROUTED3(BrowserPluginMsg_UpdateRect,
322 int /* instance_id */,
323 int /* message_id */,
324 BrowserPluginMsg_UpdateRect_Params)
326 // Requests the renderer to find out if a browser plugin is at position
327 // (|x|, |y|) within the embedder.
328 // The response message is BrowserPluginHostMsg_PluginAtPositionResponse.
329 // The |request_id| uniquely identifies a request from an embedder.
330 IPC_MESSAGE_ROUTED2(BrowserPluginMsg_PluginAtPositionRequest,
331 int /* request_id */,
332 gfx::Point /* position */)
334 // Guest renders into an FBO with textures provided by the embedder.
335 // When HW accelerated buffers are swapped in the guest, the message
336 // is forwarded to the embedder to notify it of a new texture
337 // available for compositing.
338 IPC_MESSAGE_ROUTED5(BrowserPluginMsg_BuffersSwapped,
339 int /* instance_id */,
340 gfx::Size /* size */,
341 uint64 /* surface_handle */,
342 int /* route_id */,
343 int /* gpu_host_id */)
345 // HW accelerated surface was created in the guest, forward this
346 // information to the embedder to update rendering parameters
347 // in the compositor.
348 IPC_MESSAGE_ROUTED3(BrowserPluginMsg_AcceleratedSurfaceNew,
349 int /* instance_id */,
350 uint64 /* surface_handle */,
351 std::string /* mailbox_name */)