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 152f75ee0736b03bd726fa9c9b355e24b61f5263..207a5c5859a4172d0adb3f5b8558eb11132d403f 100644 |
--- a/content/browser/browser_plugin/browser_plugin_embedder.cc |
+++ b/content/browser/browser_plugin/browser_plugin_embedder.cc |
@@ -166,19 +166,12 @@ void BrowserPluginEmbedder::OnAllocateInstanceID(int request_id) { |
routing_id(), request_id, instance_id)); |
} |
-void BrowserPluginEmbedder::OnAttach( |
+void BrowserPluginEmbedder::GuestCallback( |
int instance_id, |
const BrowserPluginHostMsg_Attach_Params& params, |
- const base::DictionaryValue& extra_params) { |
+ const base::DictionaryValue* extra_params, |
+ BrowserPluginGuest* guest) { |
BrowserPluginGuestManager* guest_manager = GetBrowserPluginGuestManager(); |
- if (!guest_manager->CanEmbedderAccessInstanceIDMaybeKill( |
- GetWebContents()->GetRenderProcessHost()->GetID(), instance_id)) |
- return; |
- |
- BrowserPluginGuest* guest = |
- guest_manager->GetGuestByInstanceID( |
- instance_id, GetWebContents()->GetRenderProcessHost()->GetID()); |
- |
if (guest) { |
// There is an implicit order expectation here: |
// 1. The content embedder is made aware of the attachment. |
@@ -188,12 +181,12 @@ void BrowserPluginEmbedder::OnAttach( |
GetContentClient()->browser()->GuestWebContentsAttached( |
guest->GetWebContents(), |
GetWebContents(), |
- extra_params); |
- guest->Attach(GetWebContents(), params, extra_params); |
+ *extra_params); |
+ guest->Attach(GetWebContents(), params, *extra_params); |
return; |
} |
- scoped_ptr<base::DictionaryValue> copy_extra_params(extra_params.DeepCopy()); |
+ scoped_ptr<base::DictionaryValue> copy_extra_params(extra_params->DeepCopy()); |
guest = guest_manager->CreateGuest( |
GetWebContents()->GetSiteInstance(), |
instance_id, params, |
@@ -202,9 +195,22 @@ void BrowserPluginEmbedder::OnAttach( |
GetContentClient()->browser()->GuestWebContentsAttached( |
guest->GetWebContents(), |
GetWebContents(), |
- extra_params); |
+ *extra_params); |
guest->Initialize(params, GetWebContents()); |
} |
} |
+void BrowserPluginEmbedder::OnAttach( |
+ int instance_id, |
+ const BrowserPluginHostMsg_Attach_Params& params, |
+ const base::DictionaryValue& extra_params) { |
+ GetBrowserPluginGuestManager()->MaybeGetGuestByInstanceIDOrKill( |
+ instance_id, GetWebContents()->GetRenderProcessHost()->GetID(), |
+ base::Bind(&BrowserPluginEmbedder::GuestCallback, |
+ base::Unretained(this), |
+ instance_id, |
+ params, |
+ &extra_params)); |
+} |
+ |
} // namespace content |