| 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 } | 129 } |
| 130 | 130 |
| 131 // Returns the embedder's RenderWidgetHostView if it is available. | 131 // Returns the embedder's RenderWidgetHostView if it is available. |
| 132 // Returns NULL otherwise. | 132 // Returns NULL otherwise. |
| 133 RenderWidgetHostView* GetEmbedderRenderWidgetHostView(); | 133 RenderWidgetHostView* GetEmbedderRenderWidgetHostView(); |
| 134 | 134 |
| 135 bool focused() const { return focused_; } | 135 bool focused() const { return focused_; } |
| 136 bool visible() const { return guest_visible_; } | 136 bool visible() const { return guest_visible_; } |
| 137 bool is_in_destruction() { return is_in_destruction_; } | 137 bool is_in_destruction() { return is_in_destruction_; } |
| 138 | 138 |
| 139 BrowserPluginGuest* opener() const { return opener_.get(); } | 139 BrowserPluginGuest* GetOpener(); |
| 140 | 140 |
| 141 // Returns whether the mouse pointer was unlocked. | 141 // Returns whether the mouse pointer was unlocked. |
| 142 bool UnlockMouseIfNecessary(const NativeWebKeyboardEvent& event); | 142 bool UnlockMouseIfNecessary(const NativeWebKeyboardEvent& event); |
| 143 | 143 |
| 144 void UpdateVisibility(); | 144 void UpdateVisibility(); |
| 145 | 145 |
| 146 void CopyFromCompositingSurface( | 146 void CopyFromCompositingSurface( |
| 147 gfx::Rect src_subrect, | 147 gfx::Rect src_subrect, |
| 148 gfx::Size dst_size, | 148 gfx::Size dst_size, |
| 149 const base::Callback<void(bool, const SkBitmap&)>& callback); | 149 const base::Callback<void(bool, const SkBitmap&)>& callback); |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 NewWindowInfo(const GURL& url, const std::string& name) : | 290 NewWindowInfo(const GURL& url, const std::string& name) : |
| 291 changed(false), | 291 changed(false), |
| 292 url(url), | 292 url(url), |
| 293 name(name) {} | 293 name(name) {} |
| 294 }; | 294 }; |
| 295 | 295 |
| 296 // BrowserPluginGuest is a WebContentsObserver of |web_contents| and | 296 // BrowserPluginGuest is a WebContentsObserver of |web_contents| and |
| 297 // |web_contents| has to stay valid for the lifetime of BrowserPluginGuest. | 297 // |web_contents| has to stay valid for the lifetime of BrowserPluginGuest. |
| 298 BrowserPluginGuest(int instance_id, | 298 BrowserPluginGuest(int instance_id, |
| 299 bool has_render_view, | 299 bool has_render_view, |
| 300 WebContentsImpl* web_contents, | 300 WebContentsImpl* web_contents); |
| 301 BrowserPluginGuest* opener); | |
| 302 | 301 |
| 303 // Destroy unattached new windows that have been opened by this | 302 // Destroy unattached new windows that have been opened by this |
| 304 // BrowserPluginGuest. | 303 // BrowserPluginGuest. |
| 305 void DestroyUnattachedWindows(); | 304 void DestroyUnattachedWindows(); |
| 306 | 305 |
| 307 void LoadURLWithParams(const GURL& url, | 306 void LoadURLWithParams(const GURL& url, |
| 308 const Referrer& referrer, | 307 const Referrer& referrer, |
| 309 PageTransition transition_type, | 308 PageTransition transition_type, |
| 310 WebContents* web_contents); | 309 WebContents* web_contents); |
| 311 | 310 |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 | 480 |
| 482 // Each copy-request is identified by a unique number. The unique number is | 481 // Each copy-request is identified by a unique number. The unique number is |
| 483 // used to keep track of the right callback. | 482 // used to keep track of the right callback. |
| 484 int copy_request_id_; | 483 int copy_request_id_; |
| 485 typedef base::Callback<void(bool, const SkBitmap&)> CopyRequestCallback; | 484 typedef base::Callback<void(bool, const SkBitmap&)> CopyRequestCallback; |
| 486 typedef std::map<int, const CopyRequestCallback> CopyRequestMap; | 485 typedef std::map<int, const CopyRequestCallback> CopyRequestMap; |
| 487 CopyRequestMap copy_request_callbacks_; | 486 CopyRequestMap copy_request_callbacks_; |
| 488 | 487 |
| 489 typedef std::map<BrowserPluginGuest*, NewWindowInfo> PendingWindowMap; | 488 typedef std::map<BrowserPluginGuest*, NewWindowInfo> PendingWindowMap; |
| 490 PendingWindowMap pending_new_windows_; | 489 PendingWindowMap pending_new_windows_; |
| 491 base::WeakPtr<BrowserPluginGuest> opener_; | |
| 492 // A counter to generate a unique request id for a permission request. | 490 // A counter to generate a unique request id for a permission request. |
| 493 // We only need the ids to be unique for a given BrowserPluginGuest. | 491 // We only need the ids to be unique for a given BrowserPluginGuest. |
| 494 int next_permission_request_id_; | 492 int next_permission_request_id_; |
| 495 | 493 |
| 496 // A map to store relevant info for a request keyed by the request's id. | 494 // A map to store relevant info for a request keyed by the request's id. |
| 497 typedef std::map<int, scoped_refptr<PermissionRequest> > RequestMap; | 495 typedef std::map<int, scoped_refptr<PermissionRequest> > RequestMap; |
| 498 RequestMap permission_request_map_; | 496 RequestMap permission_request_map_; |
| 499 | 497 |
| 500 // Indicates that this BrowserPluginGuest has associated renderer-side state. | 498 // Indicates that this BrowserPluginGuest has associated renderer-side state. |
| 501 // This is used to determine whether or not to create a new RenderView when | 499 // This is used to determine whether or not to create a new RenderView when |
| (...skipping 25 matching lines...) Expand all Loading... |
| 527 // Weak pointer used to ask GeolocationPermissionContext about geolocation | 525 // Weak pointer used to ask GeolocationPermissionContext about geolocation |
| 528 // permission. | 526 // permission. |
| 529 base::WeakPtrFactory<BrowserPluginGuest> weak_ptr_factory_; | 527 base::WeakPtrFactory<BrowserPluginGuest> weak_ptr_factory_; |
| 530 | 528 |
| 531 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest); | 529 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest); |
| 532 }; | 530 }; |
| 533 | 531 |
| 534 } // namespace content | 532 } // namespace content |
| 535 | 533 |
| 536 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ | 534 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ |
| OLD | NEW |