Chromium Code Reviews| Index: content/browser/browser_plugin/browser_plugin_embedder.cc |
| diff --git a/content/browser/browser_plugin/browser_plugin_embedder.cc b/content/browser/browser_plugin/browser_plugin_embedder.cc |
| index f646b9a32116d8a61c05d9e54e09dd4a7281f115..3a98f5d9252e1140df068faaa212b8182bb1feca 100644 |
| --- a/content/browser/browser_plugin/browser_plugin_embedder.cc |
| +++ b/content/browser/browser_plugin/browser_plugin_embedder.cc |
| @@ -6,7 +6,6 @@ |
| #include "base/values.h" |
| #include "content/browser/browser_plugin/browser_plugin_guest.h" |
| -#include "content/browser/browser_plugin/browser_plugin_guest_manager.h" |
| #include "content/browser/browser_plugin/browser_plugin_host_factory.h" |
| #include "content/browser/renderer_host/render_view_host_impl.h" |
| #include "content/browser/web_contents/web_contents_impl.h" |
| @@ -15,6 +14,7 @@ |
| #include "content/common/drag_messages.h" |
| #include "content/common/gpu/gpu_messages.h" |
| #include "content/public/browser/browser_context.h" |
| +#include "content/public/browser/browser_plugin_guest_manager_delegate.h" |
| #include "content/public/browser/content_browser_client.h" |
| #include "content/public/browser/native_web_keyboard_event.h" |
| #include "content/public/browser/render_view_host.h" |
| @@ -66,23 +66,21 @@ WebContentsImpl* BrowserPluginEmbedder::GetWebContents() const { |
| return static_cast<WebContentsImpl*>(web_contents()); |
| } |
| -BrowserPluginGuestManager* |
| +BrowserPluginGuestManagerDelegate* |
| BrowserPluginEmbedder::GetBrowserPluginGuestManager() const { |
| - return BrowserPluginGuestManager::FromBrowserContext( |
| - GetWebContents()->GetBrowserContext()); |
| + return GetWebContents()->GetBrowserContext()->GetGuestManagerDelegate(); |
| } |
| bool BrowserPluginEmbedder::DidSendScreenRectsCallback( |
| - BrowserPluginGuest* guest) { |
| + WebContents* guest_web_contents) { |
| static_cast<RenderViewHostImpl*>( |
| - guest->GetWebContents()->GetRenderViewHost())->SendScreenRects(); |
| + guest_web_contents->GetRenderViewHost())->SendScreenRects(); |
| // Not handled => Iterate over all guests. |
| return false; |
| } |
| void BrowserPluginEmbedder::DidSendScreenRects() { |
| - BrowserPluginGuestManager::FromBrowserContext( |
| - GetWebContents()->GetBrowserContext())->ForEachGuest( |
| + GetBrowserPluginGuestManager()->ForEachGuest( |
| GetWebContents(), base::Bind( |
| &BrowserPluginEmbedder::DidSendScreenRectsCallback, |
| base::Unretained(this))); |
| @@ -90,8 +88,9 @@ void BrowserPluginEmbedder::DidSendScreenRects() { |
| bool BrowserPluginEmbedder::UnlockMouseIfNecessaryCallback( |
| const NativeWebKeyboardEvent& event, |
| - BrowserPluginGuest* guest) { |
| - return guest->UnlockMouseIfNecessary(event); |
| + WebContents* guest_web_contents) { |
| + return static_cast<WebContentsImpl*>(guest_web_contents)-> |
| + GetBrowserPluginGuest()->UnlockMouseIfNecessary(event); |
| } |
| bool BrowserPluginEmbedder::HandleKeyboardEvent( |
| @@ -110,9 +109,10 @@ bool BrowserPluginEmbedder::HandleKeyboardEvent( |
| } |
| bool BrowserPluginEmbedder::SetZoomLevelCallback( |
| - double level, BrowserPluginGuest* guest) { |
| + double level, WebContents* guest_web_contents) { |
| double zoom_factor = content::ZoomLevelToZoomFactor(level); |
| - guest->SetZoom(zoom_factor); |
| + static_cast<WebContentsImpl*>(guest_web_contents)->GetBrowserPluginGuest()-> |
| + SetZoom(zoom_factor); |
| // Not handled => Iterate over all guests. |
| return false; |
| } |
| @@ -172,8 +172,12 @@ void BrowserPluginEmbedder::GuestCallback( |
| int instance_id, |
| const BrowserPluginHostMsg_Attach_Params& params, |
| const base::DictionaryValue* extra_params, |
| - BrowserPluginGuest* guest) { |
| - BrowserPluginGuestManager* guest_manager = GetBrowserPluginGuestManager(); |
| + WebContents* guest_web_contents) { |
| + BrowserPluginGuest* guest = guest_web_contents ? |
| + static_cast<WebContentsImpl*>(guest_web_contents)-> |
| + GetBrowserPluginGuest() : NULL; |
| + BrowserPluginGuestManagerDelegate* guest_manager = |
|
lazyboy
2014/05/05 21:40:54
Declare this close to where you use it.
Fady Samuel
2014/05/07 17:32:59
Removed entirely.
|
| + GetBrowserPluginGuestManager(); |
| if (guest) { |
| // There is an implicit order expectation here: |
| // 1. The content embedder is made aware of the attachment. |
| @@ -192,10 +196,13 @@ void BrowserPluginEmbedder::GuestCallback( |
| StorageInfo storage_info; |
| storage_info.partition_id = params.storage_partition_id; |
| storage_info.persist = params.persist_storage; |
| - guest = guest_manager->CreateGuest( |
| + guest_web_contents = guest_manager->CreateGuest( |
| GetWebContents()->GetSiteInstance(), |
| instance_id, storage_info, |
| copy_extra_params.Pass()); |
| + guest = guest_web_contents ? |
| + static_cast<WebContentsImpl*>(guest_web_contents)-> |
| + GetBrowserPluginGuest() : NULL; |
| if (guest) { |
| GetContentClient()->browser()->GuestWebContentsAttached( |
| guest->GetWebContents(), |