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 7f2a4f7addd26e151b82d979d4dca01b838f99e0..c7fc8ba2b528e38a802ff10ab51e7d7ea731197d 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,10 @@ void BrowserPluginEmbedder::OnGuestCallback( |
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; |
if (guest) { |
// There is an implicit order expectation here: |
// 1. The content embedder is made aware of the attachment. |
@@ -189,11 +191,15 @@ void BrowserPluginEmbedder::OnGuestCallback( |
} |
scoped_ptr<base::DictionaryValue> copy_extra_params(extra_params->DeepCopy()); |
- guest = guest_manager->CreateGuest(GetWebContents()->GetSiteInstance(), |
- instance_id, |
- params.storage_partition_id, |
- params.persist_storage, |
- copy_extra_params.Pass()); |
+ guest_web_contents = GetBrowserPluginGuestManager()->CreateGuest( |
+ GetWebContents()->GetSiteInstance(), |
+ instance_id, |
+ params.storage_partition_id, |
+ params.persist_storage, |
+ copy_extra_params.Pass()); |
+ guest = guest_web_contents ? |
+ static_cast<WebContentsImpl*>(guest_web_contents)-> |
+ GetBrowserPluginGuest() : NULL; |
if (guest) { |
GetContentClient()->browser()->GuestWebContentsAttached( |
guest->GetWebContents(), |