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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 // Returns the embedder's RenderWidgetHostView if it is available. | 134 // Returns the embedder's RenderWidgetHostView if it is available. |
135 // Returns NULL otherwise. | 135 // Returns NULL otherwise. |
136 RenderWidgetHostView* GetEmbedderRenderWidgetHostView(); | 136 RenderWidgetHostView* GetEmbedderRenderWidgetHostView(); |
137 | 137 |
138 bool focused() const { return focused_; } | 138 bool focused() const { return focused_; } |
139 bool visible() const { return guest_visible_; } | 139 bool visible() const { return guest_visible_; } |
140 bool is_in_destruction() { return is_in_destruction_; } | 140 bool is_in_destruction() { return is_in_destruction_; } |
141 | 141 |
142 void UpdateVisibility(); | 142 void UpdateVisibility(); |
143 | 143 |
144 void CopyFromCompositingSurface( | |
145 gfx::Rect src_subrect, | |
146 gfx::Size dst_size, | |
147 const base::Callback<void(bool, const SkBitmap&)>& callback); | |
148 | |
149 BrowserPluginGuestManager* GetBrowserPluginGuestManager() const; | 144 BrowserPluginGuestManager* GetBrowserPluginGuestManager() const; |
150 | 145 |
151 // WebContentsObserver implementation. | 146 // WebContentsObserver implementation. |
152 void DidCommitProvisionalLoadForFrame( | 147 void DidCommitProvisionalLoadForFrame( |
153 RenderFrameHost* render_frame_host, | 148 RenderFrameHost* render_frame_host, |
154 const GURL& url, | 149 const GURL& url, |
155 ui::PageTransition transition_type) override; | 150 ui::PageTransition transition_type) override; |
156 | 151 |
157 void RenderViewReady() override; | 152 void RenderViewReady() override; |
158 void RenderProcessGone(base::TerminationStatus status) override; | 153 void RenderProcessGone(base::TerminationStatus status) override; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 | 215 |
221 void WillDestroy(); | 216 void WillDestroy(); |
222 | 217 |
223 void Initialize(int browser_plugin_instance_id, | 218 void Initialize(int browser_plugin_instance_id, |
224 const BrowserPluginHostMsg_Attach_Params& params, | 219 const BrowserPluginHostMsg_Attach_Params& params, |
225 WebContentsImpl* embedder_web_contents); | 220 WebContentsImpl* embedder_web_contents); |
226 | 221 |
227 bool InAutoSizeBounds(const gfx::Size& size) const; | 222 bool InAutoSizeBounds(const gfx::Size& size) const; |
228 | 223 |
229 // Message handlers for messages from embedder. | 224 // Message handlers for messages from embedder. |
230 | |
231 void OnCompositorFrameSwappedACK( | 225 void OnCompositorFrameSwappedACK( |
232 int instance_id, | 226 int instance_id, |
233 const FrameHostMsg_CompositorFrameSwappedACK_Params& params); | 227 const FrameHostMsg_CompositorFrameSwappedACK_Params& params); |
234 void OnCopyFromCompositingSurfaceAck(int instance_id, | 228 |
235 int request_id, | |
236 const SkBitmap& bitmap); | |
237 // Handles drag events from the embedder. | 229 // Handles drag events from the embedder. |
238 // When dragging, the drag events go to the embedder first, and if the drag | 230 // When dragging, the drag events go to the embedder first, and if the drag |
239 // happens on the browser plugin, then the plugin sends a corresponding | 231 // happens on the browser plugin, then the plugin sends a corresponding |
240 // drag-message to the guest. This routes the drag-message to the guest | 232 // drag-message to the guest. This routes the drag-message to the guest |
241 // renderer. | 233 // renderer. |
242 void OnDragStatusUpdate(int instance_id, | 234 void OnDragStatusUpdate(int instance_id, |
243 blink::WebDragStatus drag_status, | 235 blink::WebDragStatus drag_status, |
244 const DropData& drop_data, | 236 const DropData& drop_data, |
245 blink::WebDragOperationsMask drag_mask, | 237 blink::WebDragOperationsMask drag_mask, |
246 const gfx::Point& location); | 238 const gfx::Point& location); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 float guest_device_scale_factor_; | 333 float guest_device_scale_factor_; |
342 gfx::Rect guest_window_rect_; | 334 gfx::Rect guest_window_rect_; |
343 bool focused_; | 335 bool focused_; |
344 bool mouse_locked_; | 336 bool mouse_locked_; |
345 bool pending_lock_request_; | 337 bool pending_lock_request_; |
346 bool guest_visible_; | 338 bool guest_visible_; |
347 bool embedder_visible_; | 339 bool embedder_visible_; |
348 // Whether the browser plugin is inside a plugin document. | 340 // Whether the browser plugin is inside a plugin document. |
349 bool is_full_page_plugin_; | 341 bool is_full_page_plugin_; |
350 | 342 |
351 // Each copy-request is identified by a unique number. The unique number is | |
352 // used to keep track of the right callback. | |
353 int copy_request_id_; | |
354 typedef base::Callback<void(bool, const SkBitmap&)> CopyRequestCallback; | |
355 typedef std::map<int, const CopyRequestCallback> CopyRequestMap; | |
356 CopyRequestMap copy_request_callbacks_; | |
357 | |
358 // Indicates that this BrowserPluginGuest has associated renderer-side state. | 343 // Indicates that this BrowserPluginGuest has associated renderer-side state. |
359 // This is used to determine whether or not to create a new RenderView when | 344 // This is used to determine whether or not to create a new RenderView when |
360 // this guest is attached. A BrowserPluginGuest would have renderer-side state | 345 // this guest is attached. A BrowserPluginGuest would have renderer-side state |
361 // prior to attachment if it is created via a call to window.open and | 346 // prior to attachment if it is created via a call to window.open and |
362 // maintains a JavaScript reference to its opener. | 347 // maintains a JavaScript reference to its opener. |
363 bool has_render_view_; | 348 bool has_render_view_; |
364 | 349 |
365 // Last seen size of guest contents (by SwapCompositorFrame). | 350 // Last seen size of guest contents (by SwapCompositorFrame). |
366 gfx::Size last_seen_view_size_; | 351 gfx::Size last_seen_view_size_; |
367 // Last seen size of BrowserPlugin (by OnResizeGuest). | 352 // Last seen size of BrowserPlugin (by OnResizeGuest). |
(...skipping 20 matching lines...) Expand all Loading... |
388 // Weak pointer used to ask GeolocationPermissionContext about geolocation | 373 // Weak pointer used to ask GeolocationPermissionContext about geolocation |
389 // permission. | 374 // permission. |
390 base::WeakPtrFactory<BrowserPluginGuest> weak_ptr_factory_; | 375 base::WeakPtrFactory<BrowserPluginGuest> weak_ptr_factory_; |
391 | 376 |
392 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest); | 377 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest); |
393 }; | 378 }; |
394 | 379 |
395 } // namespace content | 380 } // namespace content |
396 | 381 |
397 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ | 382 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ |
OLD | NEW |