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

Unified Diff: webkit/default_plugin/plugin_main.cc

Issue 72004: Relanding the following revisions.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 8 months 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
« no previous file with comments | « webkit/activex_shim/activex_shared.cc ('k') | webkit/glue/plugins/plugin_list_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/default_plugin/plugin_main.cc
===================================================================
--- webkit/default_plugin/plugin_main.cc (revision 13602)
+++ webkit/default_plugin/plugin_main.cc (working copy)
@@ -5,6 +5,7 @@
#include "webkit/default_plugin/plugin_main.h"
#include "base/logging.h"
+#include "base/string_util.h"
#include "webkit/activex_shim/npp_impl.h"
#include "webkit/default_plugin/plugin_impl.h"
#include "webkit/glue/webkit_glue.h"
@@ -54,6 +55,31 @@
return 0;
}
+namespace {
+// This function is only invoked when the default plugin is invoked
+// with a special mime type application/chromium-test-default-plugin
+void SignalTestResult(NPP instance) {
+ NPObject *window_obj = NULL;
+ g_browser->getvalue(instance, NPNVWindowNPObject, &window_obj);
+ if (!window_obj) {
+ NOTREACHED();
+ return;
+ }
+
+ std::string script = "javascript:onSuccess()";
+ NPString script_string;
+ script_string.UTF8Characters = script.c_str();
+ script_string.UTF8Length =
+ static_cast<unsigned int>(script.length());
+
+ NPVariant result_var;
+ NPError result = g_browser->evaluate(instance, window_obj,
+ &script_string, &result_var);
+ g_browser->releaseobject(window_obj);
+}
+
+} // namespace CHROMIUM_DefaultPluginTest
+
NPError NPP_New(NPMIMEType plugin_type, NPP instance, uint16 mode, int16 argc,
char* argn[], char* argv[], NPSavedData* saved) {
if (instance == NULL)
@@ -63,9 +89,15 @@
// 1. Test-shell
// 2. The plugin is running in the renderer process.
if (webkit_glue::IsPluginRunningInRendererProcess()) {
+ if (!base::strcasecmp(plugin_type,
+ "application/chromium-test-default-plugin")) {
+ SignalTestResult(instance);
+ return NPERR_NO_ERROR;
+ }
return NPERR_GENERIC_ERROR;
}
+
PluginInstallerImpl* plugin_impl = new PluginInstallerImpl(mode);
plugin_impl->Initialize(GetCurrentModuleHandle(), instance, plugin_type, argc,
argn, argv);
« no previous file with comments | « webkit/activex_shim/activex_shared.cc ('k') | webkit/glue/plugins/plugin_list_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698