Chromium Code Reviews| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 82 | 82 |
| 83 // The WebContents passed into the factory method here has not been | 83 // The WebContents passed into the factory method here has not been |
| 84 // initialized yet and so it does not yet hold a SiteInstance. | 84 // initialized yet and so it does not yet hold a SiteInstance. |
| 85 // BrowserPluginGuest must be constructed and installed into a WebContents | 85 // BrowserPluginGuest must be constructed and installed into a WebContents |
| 86 // prior to its initialization because WebContents needs to determine what | 86 // prior to its initialization because WebContents needs to determine what |
| 87 // type of WebContentsView to construct on initialization. The content | 87 // type of WebContentsView to construct on initialization. The content |
| 88 // embedder needs to be aware of |guest_site_instance| on the guest's | 88 // embedder needs to be aware of |guest_site_instance| on the guest's |
| 89 // construction and so we pass it in here. | 89 // construction and so we pass it in here. |
| 90 static BrowserPluginGuest* Create( | 90 static BrowserPluginGuest* Create( |
| 91 int instance_id, | 91 int instance_id, |
| 92 SiteInstance* guest_site_instance, | |
| 93 WebContentsImpl* web_contents, | 92 WebContentsImpl* web_contents, |
| 94 scoped_ptr<base::DictionaryValue> extra_params, | 93 BrowserPluginGuestDelegate* delegate); |
| 95 BrowserPluginGuest* opener); | |
| 96 | 94 |
| 97 // Returns whether the given WebContents is a BrowserPlugin guest. | 95 // Returns whether the given WebContents is a BrowserPlugin guest. |
| 98 static bool IsGuest(WebContentsImpl* web_contents); | 96 static bool IsGuest(WebContentsImpl* web_contents); |
| 99 | 97 |
| 100 // Returns whether the given RenderviewHost is a BrowserPlugin guest. | 98 // Returns whether the given RenderviewHost is a BrowserPlugin guest. |
| 101 static bool IsGuest(RenderViewHostImpl* render_view_host); | 99 static bool IsGuest(RenderViewHostImpl* render_view_host); |
| 102 | 100 |
| 103 // Returns a WeakPtr to this BrowserPluginGuest. | 101 // Returns a WeakPtr to this BrowserPluginGuest. |
| 104 base::WeakPtr<BrowserPluginGuest> AsWeakPtr(); | 102 base::WeakPtr<BrowserPluginGuest> AsWeakPtr(); |
| 105 | 103 |
| 106 // Sets the lock state of the pointer. Returns true if |allowed| is true and | 104 // Sets the lock state of the pointer. Returns true if |allowed| is true and |
| 107 // the mouse has been successfully locked. | 105 // the mouse has been successfully locked. |
| 108 bool LockMouse(bool allowed); | 106 bool LockMouse(bool allowed); |
| 109 | 107 |
| 110 // Called when the embedder WebContents changes visibility. | 108 // Called when the embedder WebContents changes visibility. |
| 111 void EmbedderVisibilityChanged(bool visible); | 109 void EmbedderVisibilityChanged(bool visible); |
| 112 | 110 |
| 113 // Destroys the guest WebContents and all its associated state, including | 111 // Destroys the guest WebContents and all its associated state, including |
| 114 // this BrowserPluginGuest, and its new unattached windows. | 112 // this BrowserPluginGuest, and its new unattached windows. |
| 115 void Destroy(); | 113 void Destroy(); |
| 116 | 114 |
| 115 WebContentsImpl* CreateNewGuestWindow(WebContents::CreateParams* params); | |
|
lazyboy
2014/06/17 23:46:46
I'd add a note that |params| could be modified.
Al
Fady Samuel
2014/06/18 21:08:34
Done.
| |
| 116 | |
| 117 // Returns the identifier that uniquely identifies a browser plugin guest | 117 // Returns the identifier that uniquely identifies a browser plugin guest |
| 118 // within an embedder. | 118 // within an embedder. |
| 119 int instance_id() const { return instance_id_; } | 119 int instance_id() const { return instance_id_; } |
| 120 | 120 |
| 121 bool OnMessageReceivedFromEmbedder(const IPC::Message& message); | 121 bool OnMessageReceivedFromEmbedder(const IPC::Message& message); |
| 122 | 122 |
| 123 WebContentsImpl* embedder_web_contents() const { | 123 WebContentsImpl* embedder_web_contents() const { |
| 124 return embedder_web_contents_; | 124 return embedder_web_contents_; |
| 125 } | 125 } |
| 126 | 126 |
| 127 // Returns the embedder's RenderWidgetHostView if it is available. | 127 // Returns the embedder's RenderWidgetHostView if it is available. |
| 128 // Returns NULL otherwise. | 128 // Returns NULL otherwise. |
| 129 RenderWidgetHostView* GetEmbedderRenderWidgetHostView(); | 129 RenderWidgetHostView* GetEmbedderRenderWidgetHostView(); |
| 130 | 130 |
| 131 bool focused() const { return focused_; } | 131 bool focused() const { return focused_; } |
| 132 bool visible() const { return guest_visible_; } | 132 bool visible() const { return guest_visible_; } |
| 133 bool is_in_destruction() { return is_in_destruction_; } | 133 bool is_in_destruction() { return is_in_destruction_; } |
| 134 | 134 |
| 135 // Returns the BrowserPluginGuest that created this guest, if any. | |
| 136 BrowserPluginGuest* GetOpener() const; | |
| 137 | |
| 138 void UpdateVisibility(); | 135 void UpdateVisibility(); |
| 139 | 136 |
| 140 void CopyFromCompositingSurface( | 137 void CopyFromCompositingSurface( |
| 141 gfx::Rect src_subrect, | 138 gfx::Rect src_subrect, |
| 142 gfx::Size dst_size, | 139 gfx::Size dst_size, |
| 143 const base::Callback<void(bool, const SkBitmap&)>& callback); | 140 const base::Callback<void(bool, const SkBitmap&)>& callback); |
| 144 | 141 |
| 145 BrowserPluginGuestManager* GetBrowserPluginGuestManager() const; | 142 BrowserPluginGuestManager* GetBrowserPluginGuestManager() const; |
| 146 | 143 |
| 147 // WebContentsObserver implementation. | 144 // WebContentsObserver implementation. |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 387 // Weak pointer used to ask GeolocationPermissionContext about geolocation | 384 // Weak pointer used to ask GeolocationPermissionContext about geolocation |
| 388 // permission. | 385 // permission. |
| 389 base::WeakPtrFactory<BrowserPluginGuest> weak_ptr_factory_; | 386 base::WeakPtrFactory<BrowserPluginGuest> weak_ptr_factory_; |
| 390 | 387 |
| 391 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest); | 388 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest); |
| 392 }; | 389 }; |
| 393 | 390 |
| 394 } // namespace content | 391 } // namespace content |
| 395 | 392 |
| 396 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ | 393 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ |
| OLD | NEW |