Index: content/renderer/render_frame_impl.cc |
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc |
index ff488741db1997fee661106571a7f1408ec9f566..ebbd280820792c94b68b188490f618ced0a14195 100644 |
--- a/content/renderer/render_frame_impl.cc |
+++ b/content/renderer/render_frame_impl.cc |
@@ -2512,19 +2512,17 @@ void RenderFrameImpl::CancelContextMenu(int request_id) { |
} |
blink::WebPlugin* RenderFrameImpl::CreatePlugin( |
- blink::WebFrame* frame, |
const WebPluginInfo& info, |
const blink::WebPluginParams& params, |
std::unique_ptr<content::PluginInstanceThrottler> throttler) { |
- DCHECK_EQ(frame_, frame); |
#if BUILDFLAG(ENABLE_PLUGINS) |
if (info.type == WebPluginInfo::PLUGIN_TYPE_BROWSER_PLUGIN) { |
+ // |delegate| deletes itself. |
+ BrowserPluginDelegate* delegate = |
+ GetContentClient()->renderer()->CreateBrowserPluginDelegate( |
+ this, params.mime_type.Utf8(), GURL(params.url)); |
return BrowserPluginManager::Get()->CreateBrowserPlugin( |
- this, GetContentClient() |
- ->renderer() |
- ->CreateBrowserPluginDelegate(this, params.mime_type.Utf8(), |
- GURL(params.url)) |
- ->GetWeakPtr()); |
+ this, delegate->GetWeakPtr()); |
} |
bool pepper_plugin_was_registered = false; |
@@ -2541,8 +2539,8 @@ blink::WebPlugin* RenderFrameImpl::CreatePlugin( |
#if defined(OS_CHROMEOS) |
LOG(WARNING) << "Pepper module/plugin creation failed."; |
#endif |
-#endif |
- return NULL; |
+#endif // BUILDFLAG(ENABLE_PLUGINS) |
+ return nullptr; |
} |
void RenderFrameImpl::LoadURLExternally(const blink::WebURLRequest& request, |
@@ -2782,23 +2780,21 @@ void RenderFrameImpl::SetHostZoomLevel(const GURL& url, double zoom_level) { |
// blink::WebFrameClient implementation ---------------------------------------- |
blink::WebPlugin* RenderFrameImpl::CreatePlugin( |
- blink::WebLocalFrame* frame, |
const blink::WebPluginParams& params) { |
- DCHECK_EQ(frame_, frame); |
- blink::WebPlugin* plugin = NULL; |
- if (GetContentClient()->renderer()->OverrideCreatePlugin( |
- this, frame, params, &plugin)) { |
+ blink::WebPlugin* plugin = nullptr; |
+ if (GetContentClient()->renderer()->OverrideCreatePlugin(this, params, |
+ &plugin)) { |
return plugin; |
} |
if (params.mime_type.ContainsOnlyASCII() && |
params.mime_type.Ascii() == kBrowserPluginMimeType) { |
+ // |delegate| deletes itself. |
+ BrowserPluginDelegate* delegate = |
+ GetContentClient()->renderer()->CreateBrowserPluginDelegate( |
+ this, kBrowserPluginMimeType, GURL(params.url)); |
return BrowserPluginManager::Get()->CreateBrowserPlugin( |
- this, GetContentClient() |
- ->renderer() |
- ->CreateBrowserPluginDelegate(this, kBrowserPluginMimeType, |
- GURL(params.url)) |
- ->GetWeakPtr()); |
+ this, delegate->GetWeakPtr()); |
} |
#if BUILDFLAG(ENABLE_PLUGINS) |
@@ -2806,16 +2802,16 @@ blink::WebPlugin* RenderFrameImpl::CreatePlugin( |
std::string mime_type; |
bool found = false; |
Send(new FrameHostMsg_GetPluginInfo( |
- routing_id_, params.url, frame->Top()->GetSecurityOrigin(), |
+ routing_id_, params.url, frame_->Top()->GetSecurityOrigin(), |
params.mime_type.Utf8(), &found, &info, &mime_type)); |
if (!found) |
- return NULL; |
+ return nullptr; |
WebPluginParams params_to_use = params; |
params_to_use.mime_type = WebString::FromUTF8(mime_type); |
- return CreatePlugin(frame, info, params_to_use, nullptr /* throttler */); |
+ return CreatePlugin(info, params_to_use, nullptr /* throttler */); |
#else |
- return NULL; |
+ return nullptr; |
#endif // BUILDFLAG(ENABLE_PLUGINS) |
} |