Index: components/plugins/renderer/mobile_youtube_plugin.cc |
diff --git a/components/plugins/renderer/mobile_youtube_plugin.cc b/components/plugins/renderer/mobile_youtube_plugin.cc |
index e2f5793e790e4dc55fcd2331828186d90964178a..229be561bd8a22d3d1653d05b04af8f093236710 100644 |
--- a/components/plugins/renderer/mobile_youtube_plugin.cc |
+++ b/components/plugins/renderer/mobile_youtube_plugin.cc |
@@ -79,7 +79,14 @@ MobileYouTubePlugin::MobileYouTubePlugin(content::RenderView* render_view, |
frame, |
params, |
HtmlData(params, template_html), |
- placeholderDataUrl) {} |
+ placeholderDataUrl), |
+ weak_factory_(this) { |
+ RegisterCallback("openYoutubeURL", |
+ base::Bind(&MobileYouTubePlugin::OpenYoutubeUrlCallback, |
+ weak_factory_.GetWeakPtr())); |
+} |
+ |
+MobileYouTubePlugin::~MobileYouTubePlugin() {} |
// static |
bool MobileYouTubePlugin::IsYouTubeURL(const GURL& url, |
@@ -92,9 +99,7 @@ bool MobileYouTubePlugin::IsYouTubeURL(const GURL& url, |
LowerCaseEqualsASCII(mime_type, content::kFlashPluginSwfMimeType); |
} |
-void MobileYouTubePlugin::OpenYoutubeUrlCallback( |
- const webkit_glue::CppArgumentList& args, |
- webkit_glue::CppVariant* result) { |
+void MobileYouTubePlugin::OpenYoutubeUrlCallback() { |
std::string youtube("vnd.youtube:"); |
GURL url(youtube.append(GetYoutubeVideoId(GetPluginParams()))); |
WebURLRequest request; |
@@ -103,11 +108,5 @@ void MobileYouTubePlugin::OpenYoutubeUrlCallback( |
render_view()->LoadURLExternally( |
GetFrame(), request, blink::WebNavigationPolicyNewForegroundTab); |
} |
-void MobileYouTubePlugin::BindWebFrame(WebFrame* frame) { |
- PluginPlaceholder::BindWebFrame(frame); |
- BindCallback("openYoutubeURL", |
- base::Bind(&MobileYouTubePlugin::OpenYoutubeUrlCallback, |
- base::Unretained(this))); |
-} |
} // namespace plugins |