| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // A BrowserPluginGuest is the browser side of a browser <--> embedder | 5 // A BrowserPluginGuest is the browser side of a browser <--> embedder |
| 6 // renderer channel. A BrowserPlugin (a WebPlugin) is on the embedder | 6 // renderer channel. A BrowserPlugin (a WebPlugin) is on the embedder |
| 7 // renderer side of browser <--> embedder renderer communication. | 7 // renderer side of browser <--> embedder renderer communication. |
| 8 // | 8 // |
| 9 // BrowserPluginGuest lives on the UI thread of the browser process. Any | 9 // BrowserPluginGuest lives on the UI thread of the browser process. Any |
| 10 // messages about the guest render process that the embedder might be interested | 10 // messages about the guest render process that the embedder might be interested |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 struct FrameHostMsg_CompositorFrameSwappedACK_Params; | 43 struct FrameHostMsg_CompositorFrameSwappedACK_Params; |
| 44 struct FrameHostMsg_ReclaimCompositorResources_Params; | 44 struct FrameHostMsg_ReclaimCompositorResources_Params; |
| 45 #if defined(OS_MACOSX) | 45 #if defined(OS_MACOSX) |
| 46 struct FrameHostMsg_ShowPopup_Params; | 46 struct FrameHostMsg_ShowPopup_Params; |
| 47 #endif | 47 #endif |
| 48 struct ViewHostMsg_TextInputState_Params; | 48 struct ViewHostMsg_TextInputState_Params; |
| 49 struct ViewHostMsg_UpdateRect_Params; | 49 struct ViewHostMsg_UpdateRect_Params; |
| 50 | 50 |
| 51 namespace blink { | 51 namespace blink { |
| 52 class WebInputEvent; | 52 class WebInputEvent; |
| 53 } | 53 } // namespace blink |
| 54 |
| 55 namespace cc { |
| 56 class CompositorFrame; |
| 57 } // namespace cc |
| 54 | 58 |
| 55 namespace gfx { | 59 namespace gfx { |
| 56 class Range; | 60 class Range; |
| 57 } | 61 } // namespace gfx |
| 58 | 62 |
| 59 namespace content { | 63 namespace content { |
| 60 | 64 |
| 61 class BrowserPluginGuestManager; | 65 class BrowserPluginGuestManager; |
| 62 class RenderViewHostImpl; | 66 class RenderViewHostImpl; |
| 63 class RenderWidgetHostView; | 67 class RenderWidgetHostView; |
| 64 class SiteInstance; | 68 class SiteInstance; |
| 65 class WebCursor; | 69 class WebCursor; |
| 66 struct DropData; | 70 struct DropData; |
| 67 | 71 |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 | 190 |
| 187 // Called when the drag started by this guest ends at an OS-level. | 191 // Called when the drag started by this guest ends at an OS-level. |
| 188 void EndSystemDrag(); | 192 void EndSystemDrag(); |
| 189 | 193 |
| 190 void RespondToPermissionRequest(int request_id, | 194 void RespondToPermissionRequest(int request_id, |
| 191 bool should_allow, | 195 bool should_allow, |
| 192 const std::string& user_input); | 196 const std::string& user_input); |
| 193 | 197 |
| 194 void PointerLockPermissionResponse(bool allow); | 198 void PointerLockPermissionResponse(bool allow); |
| 195 | 199 |
| 200 void SwapCompositorFrame(uint32 output_surface_id, |
| 201 int host_process_id, |
| 202 int host_routing_id, |
| 203 scoped_ptr<cc::CompositorFrame> frame); |
| 204 |
| 196 private: | 205 private: |
| 197 class EmbedderWebContentsObserver; | 206 class EmbedderWebContentsObserver; |
| 198 | 207 |
| 199 // BrowserPluginGuest is a WebContentsObserver of |web_contents| and | 208 // BrowserPluginGuest is a WebContentsObserver of |web_contents| and |
| 200 // |web_contents| has to stay valid for the lifetime of BrowserPluginGuest. | 209 // |web_contents| has to stay valid for the lifetime of BrowserPluginGuest. |
| 201 BrowserPluginGuest(bool has_render_view, | 210 BrowserPluginGuest(bool has_render_view, |
| 202 WebContentsImpl* web_contents, | 211 WebContentsImpl* web_contents, |
| 203 BrowserPluginGuestDelegate* delegate); | 212 BrowserPluginGuestDelegate* delegate); |
| 204 | 213 |
| 205 void WillDestroy(); | 214 void WillDestroy(); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 // On MacOS X popups are painted by the browser process. We handle them here | 319 // On MacOS X popups are painted by the browser process. We handle them here |
| 311 // so that they are positioned correctly. | 320 // so that they are positioned correctly. |
| 312 void OnShowPopup(RenderFrameHost* render_frame_host, | 321 void OnShowPopup(RenderFrameHost* render_frame_host, |
| 313 const FrameHostMsg_ShowPopup_Params& params); | 322 const FrameHostMsg_ShowPopup_Params& params); |
| 314 #endif | 323 #endif |
| 315 void OnShowWidget(int route_id, const gfx::Rect& initial_pos); | 324 void OnShowWidget(int route_id, const gfx::Rect& initial_pos); |
| 316 void OnTakeFocus(bool reverse); | 325 void OnTakeFocus(bool reverse); |
| 317 void OnUpdateFrameName(int frame_id, | 326 void OnUpdateFrameName(int frame_id, |
| 318 bool is_top_level, | 327 bool is_top_level, |
| 319 const std::string& name); | 328 const std::string& name); |
| 320 void OnUpdateRect(const ViewHostMsg_UpdateRect_Params& params); | |
| 321 | 329 |
| 322 // Forwards all messages from the |pending_messages_| queue to the embedder. | 330 // Forwards all messages from the |pending_messages_| queue to the embedder. |
| 323 void SendQueuedMessages(); | 331 void SendQueuedMessages(); |
| 324 | 332 |
| 325 scoped_ptr<EmbedderWebContentsObserver> embedder_web_contents_observer_; | 333 scoped_ptr<EmbedderWebContentsObserver> embedder_web_contents_observer_; |
| 326 WebContentsImpl* embedder_web_contents_; | 334 WebContentsImpl* embedder_web_contents_; |
| 327 | 335 |
| 328 // An identifier that uniquely identifies a browser plugin within an embedder. | 336 // An identifier that uniquely identifies a browser plugin within an embedder. |
| 329 int browser_plugin_instance_id_; | 337 int browser_plugin_instance_id_; |
| 330 float guest_device_scale_factor_; | 338 float guest_device_scale_factor_; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 344 typedef std::map<int, const CopyRequestCallback> CopyRequestMap; | 352 typedef std::map<int, const CopyRequestCallback> CopyRequestMap; |
| 345 CopyRequestMap copy_request_callbacks_; | 353 CopyRequestMap copy_request_callbacks_; |
| 346 | 354 |
| 347 // Indicates that this BrowserPluginGuest has associated renderer-side state. | 355 // Indicates that this BrowserPluginGuest has associated renderer-side state. |
| 348 // This is used to determine whether or not to create a new RenderView when | 356 // This is used to determine whether or not to create a new RenderView when |
| 349 // this guest is attached. A BrowserPluginGuest would have renderer-side state | 357 // this guest is attached. A BrowserPluginGuest would have renderer-side state |
| 350 // prior to attachment if it is created via a call to window.open and | 358 // prior to attachment if it is created via a call to window.open and |
| 351 // maintains a JavaScript reference to its opener. | 359 // maintains a JavaScript reference to its opener. |
| 352 bool has_render_view_; | 360 bool has_render_view_; |
| 353 | 361 |
| 354 // Last seen size of guest contents (by OnUpdateRect). | 362 // Last seen size of guest contents (by SwapCompositorFrame). |
| 355 gfx::Size last_seen_view_size_; | 363 gfx::Size last_seen_view_size_; |
| 356 // Last seen size of BrowserPlugin (by OnResizeGuest). | 364 // Last seen size of BrowserPlugin (by OnResizeGuest). |
| 357 gfx::Size last_seen_browser_plugin_size_; | 365 gfx::Size last_seen_browser_plugin_size_; |
| 358 | 366 |
| 359 bool is_in_destruction_; | 367 bool is_in_destruction_; |
| 360 | 368 |
| 361 // Text input type states. | 369 // Text input type states. |
| 362 ui::TextInputType last_text_input_type_; | 370 ui::TextInputType last_text_input_type_; |
| 363 ui::TextInputMode last_input_mode_; | 371 ui::TextInputMode last_input_mode_; |
| 364 bool last_can_compose_inline_; | 372 bool last_can_compose_inline_; |
| 365 | 373 |
| 366 // This is a queue of messages that are destined to be sent to the embedder | 374 // This is a queue of messages that are destined to be sent to the embedder |
| 367 // once the guest is attached to a particular embedder. | 375 // once the guest is attached to a particular embedder. |
| 368 std::deque<linked_ptr<IPC::Message> > pending_messages_; | 376 std::deque<linked_ptr<IPC::Message> > pending_messages_; |
| 369 | 377 |
| 370 BrowserPluginGuestDelegate* const delegate_; | 378 BrowserPluginGuestDelegate* const delegate_; |
| 371 | 379 |
| 372 // Weak pointer used to ask GeolocationPermissionContext about geolocation | 380 // Weak pointer used to ask GeolocationPermissionContext about geolocation |
| 373 // permission. | 381 // permission. |
| 374 base::WeakPtrFactory<BrowserPluginGuest> weak_ptr_factory_; | 382 base::WeakPtrFactory<BrowserPluginGuest> weak_ptr_factory_; |
| 375 | 383 |
| 376 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest); | 384 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest); |
| 377 }; | 385 }; |
| 378 | 386 |
| 379 } // namespace content | 387 } // namespace content |
| 380 | 388 |
| 381 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ | 389 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ |
| OLD | NEW |