Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(586)

Unified Diff: components/plugins/renderer/mobile_youtube_plugin.cc

Issue 69953006: Bind plugin placeholder directly to v8 instead of over CppBoundClass (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..427e8657bc725c4444b6b6f1378cf4cd0aa99ad8 100644
--- a/components/plugins/renderer/mobile_youtube_plugin.cc
+++ b/components/plugins/renderer/mobile_youtube_plugin.cc
@@ -92,22 +92,26 @@ bool MobileYouTubePlugin::IsYouTubeURL(const GURL& url,
LowerCaseEqualsASCII(mime_type, content::kFlashPluginSwfMimeType);
}
+// static
void MobileYouTubePlugin::OpenYoutubeUrlCallback(
- const webkit_glue::CppArgumentList& args,
- webkit_glue::CppVariant* result) {
+ const v8::FunctionCallbackInfo<v8::Value>& args) {
Bernhard Bauer 2013/11/12 16:37:20 Move to anonymous namespace
+ MobileYouTubePlugin* plugin = reinterpret_cast<MobileYouTubePlugin*>(
+ v8::External::Cast(*args.Data())->Value());
std::string youtube("vnd.youtube:");
- GURL url(youtube.append(GetYoutubeVideoId(GetPluginParams())));
+ GURL url(youtube.append(GetYoutubeVideoId(plugin->GetPluginParams())));
WebURLRequest request;
request.initialize();
request.setURL(url);
- render_view()->LoadURLExternally(
- GetFrame(), request, blink::WebNavigationPolicyNewForegroundTab);
+ plugin->render_view()->LoadURLExternally(
+ plugin->GetFrame(), request, blink::WebNavigationPolicyNewForegroundTab);
}
-void MobileYouTubePlugin::BindWebFrame(WebFrame* frame) {
- PluginPlaceholder::BindWebFrame(frame);
- BindCallback("openYoutubeURL",
- base::Bind(&MobileYouTubePlugin::OpenYoutubeUrlCallback,
- base::Unretained(this)));
+
+void MobileYouTubePlugin::InstallAdditionalCallbacsk(
+ v8::Handle<v8::Template> prototype) {
+ prototype->Set(
+ v8::String::New("openYoutubeURL"),
+ v8::FunctionTemplate::New(&PluginPlaceholder::OpenYoutubeUrlCallback,
+ v8::External::New(this))->GetFunction());
}
} // namespace plugins

Powered by Google App Engine
This is Rietveld 408576698