summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-27 02:56:16 +0000
committerthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-27 02:56:16 +0000
commit82539f244b0f38fab7e24aa3f6a6025753ac19b7 (patch)
tree4c914d7da0a63d75c10b623c9c2f804a5447251b /webkit
parentc5648a72f41da5bc2598668d5a058521eb5b961e (diff)
downloadchromium_src-82539f244b0f38fab7e24aa3f6a6025753ac19b7.zip
chromium_src-82539f244b0f38fab7e24aa3f6a6025753ac19b7.tar.gz
chromium_src-82539f244b0f38fab7e24aa3f6a6025753ac19b7.tar.bz2
Part 2 of http://codereview.chromium.org/2079016
BUG=10952 Review URL: http://codereview.chromium.org/2282004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48356 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/default_plugin/default_plugin.gyp111
-rw-r--r--webkit/default_plugin/plugin_main.cc69
-rw-r--r--webkit/default_plugin/plugin_main.h7
-rw-r--r--webkit/glue/plugins/plugin_list.cc4
-rw-r--r--webkit/glue/webkit_glue.gypi2
5 files changed, 125 insertions, 68 deletions
diff --git a/webkit/default_plugin/default_plugin.gyp b/webkit/default_plugin/default_plugin.gyp
index c353ed9..3128e72 100644
--- a/webkit/default_plugin/default_plugin.gyp
+++ b/webkit/default_plugin/default_plugin.gyp
@@ -7,62 +7,63 @@
'chromium_code': 1,
},
'targets': [
- ],
- 'conditions': [
- ['OS=="win" or OS=="mac"', {
- 'targets': [
- {
- 'target_name': 'default_plugin',
- 'type': '<(library)',
- 'dependencies': [
- '../../net/net.gyp:net_resources',
- '../../third_party/icu/icu.gyp:icui18n',
- '../../third_party/icu/icu.gyp:icuuc',
- '../../third_party/libxml/libxml.gyp:libxml',
- '../../third_party/npapi/npapi.gyp:npapi',
- ],
- 'include_dirs': [
- '../..',
- '<(DEPTH)/third_party/wtl/include',
- # TODO(bradnelson): this should fall out of the dependencies.
- '<(SHARED_INTERMEDIATE_DIR)/webkit',
- ],
- 'sources': [
- 'default_plugin_shared.h',
- 'plugin_impl_mac.h',
- 'plugin_impl_mac.mm',
- 'plugin_impl_win.cc',
- 'plugin_impl_win.h',
- 'plugin_main.cc',
- 'plugin_main.h',
- ],
- 'conditions': [
- ['OS=="win"', {
- 'dependencies': [
- # TODO(thakis): These throw a CircularException on mac.
- # Figure out why once they're needed.
- '../support/webkit_support.gyp:webkit_resources',
- '../support/webkit_support.gyp:webkit_strings',
- ],
- 'msvs_guid': '5916D37D-8C97-424F-A904-74E52594C2D6',
- 'link_settings': {
- 'libraries': ['-lurlmon.lib'],
- },
- 'sources': [
- 'default_plugin.cc',
- 'default_plugin_resources.h',
- 'install_dialog.cc',
- 'install_dialog.h',
- 'plugin_database_handler.cc',
- 'plugin_database_handler.h',
- 'plugin_install_job_monitor.cc',
- 'plugin_install_job_monitor.h',
- ],
- }],
- ],
- },
+ {
+ 'target_name': 'default_plugin',
+ 'type': '<(library)',
+ 'dependencies': [
+ '../../net/net.gyp:net_resources',
+ '../../third_party/icu/icu.gyp:icui18n',
+ '../../third_party/icu/icu.gyp:icuuc',
+ '../../third_party/libxml/libxml.gyp:libxml',
+ '../../third_party/npapi/npapi.gyp:npapi',
+ ],
+ 'include_dirs': [
+ '../..',
+ '<(DEPTH)/third_party/wtl/include',
+ # TODO(bradnelson): this should fall out of the dependencies.
+ '<(SHARED_INTERMEDIATE_DIR)/webkit',
+ ],
+ 'sources': [
+ 'default_plugin_shared.h',
+ 'plugin_impl_gtk.cc',
+ 'plugin_impl_gtk.h',
+ 'plugin_impl_mac.h',
+ 'plugin_impl_mac.mm',
+ 'plugin_impl_win.cc',
+ 'plugin_impl_win.h',
+ 'plugin_main.cc',
+ 'plugin_main.h',
+ ],
+ 'conditions': [
+ ['OS=="win"', {
+ 'dependencies': [
+ # TODO(thakis): These throw a CircularException on mac.
+ # Figure out why once they're needed.
+ '../support/webkit_support.gyp:webkit_resources',
+ '../support/webkit_support.gyp:webkit_strings',
+ ],
+ 'msvs_guid': '5916D37D-8C97-424F-A904-74E52594C2D6',
+ 'link_settings': {
+ 'libraries': ['-lurlmon.lib'],
+ },
+ 'sources': [
+ 'default_plugin.cc',
+ 'default_plugin_resources.h',
+ 'install_dialog.cc',
+ 'install_dialog.h',
+ 'plugin_database_handler.cc',
+ 'plugin_database_handler.h',
+ 'plugin_install_job_monitor.cc',
+ 'plugin_install_job_monitor.h',
+ ],
+ }],
+ ['OS=="linux"', {
+ 'dependencies': [
+ '../../build/linux/system.gyp:gtk',
+ ],
+ }],
],
- }],
+ },
],
}
diff --git a/webkit/default_plugin/plugin_main.cc b/webkit/default_plugin/plugin_main.cc
index a4dacc5..5025007 100644
--- a/webkit/default_plugin/plugin_main.cc
+++ b/webkit/default_plugin/plugin_main.cc
@@ -28,20 +28,27 @@ inline HMODULE GetCurrentModuleHandle() {
NPNetscapeFuncs* g_browser = NULL;
NPError API_CALL NP_GetEntryPoints(NPPluginFuncs* funcs) {
+ // Be explicit about the namespace, because all internal plugins have
+ // functions with these names and some might accidentally put them into the
+ // global namespace. In that case, the linker might prefer the global one.
funcs->version = 11;
funcs->size = sizeof(*funcs);
- funcs->newp = NPP_New;
- funcs->destroy = NPP_Destroy;
- funcs->setwindow = NPP_SetWindow;
- funcs->newstream = NPP_NewStream;
- funcs->destroystream = NPP_DestroyStream;
- funcs->writeready = NPP_WriteReady;
- funcs->write = NPP_Write;
+ funcs->newp = default_plugin::NPP_New;
+ funcs->destroy = default_plugin::NPP_Destroy;
+ funcs->setwindow = default_plugin::NPP_SetWindow;
+ funcs->newstream = default_plugin::NPP_NewStream;
+ funcs->destroystream = default_plugin::NPP_DestroyStream;
+ funcs->writeready = default_plugin::NPP_WriteReady;
+ funcs->write = default_plugin::NPP_Write;
funcs->asfile = NULL;
funcs->print = NULL;
- funcs->event = NPP_HandleEvent;
- funcs->urlnotify = NPP_URLNotify;
+ funcs->event = default_plugin::NPP_HandleEvent;
+ funcs->urlnotify = default_plugin::NPP_URLNotify;
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
+ funcs->getvalue = default_plugin::NPP_GetValue;
+#else
funcs->getvalue = NULL;
+#endif
funcs->setvalue = NULL;
return NPERR_NO_ERROR;
}
@@ -51,9 +58,18 @@ NPError API_CALL NP_Initialize(NPNetscapeFuncs* funcs) {
return 0;
}
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
+NPError API_CALL NP_Initialize(NPNetscapeFuncs* funcs, NPPluginFuncs* p_funcs) {
+ NPError err = NP_Initialize(funcs);
+ if (err != NPERR_NO_ERROR)
+ return err;
+ return NP_GetEntryPoints(p_funcs);
+}
+#endif
+
NPError API_CALL NP_Shutdown(void) {
g_browser = NULL;
- return 0;
+ return NPERR_NO_ERROR;
}
namespace {
@@ -117,6 +133,27 @@ bool NegotiateModels(NPP instance) {
NOTREACHED();
return false;
}
+#elif defined(OS_POSIX)
+ NPError err;
+ // Check that chrome still supports xembed.
+ NPBool supportsXEmbed = FALSE;
+ err = g_browser->getvalue(instance,
+ NPNVSupportsXEmbedBool,
+ &supportsXEmbed);
+ if (err != NPERR_NO_ERROR || !supportsXEmbed) {
+ NOTREACHED();
+ return false;
+ }
+
+ // Check that the toolkit is still gtk2.
+ NPNToolkitType toolkit;
+ err = g_browser->getvalue(instance,
+ NPNVToolkit,
+ &toolkit);
+ if (err != NPERR_NO_ERROR || toolkit != NPNVGtk2) {
+ NOTREACHED();
+ return false;
+ }
#endif
return true;
}
@@ -280,6 +317,18 @@ void NPP_URLNotify(NPP instance, const char* url, NPReason reason,
}
}
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
+NPError NPP_GetValue(NPP instance, NPPVariable variable, void* value) {
+ switch (variable) {
+ case NPPVpluginNeedsXEmbed:
+ *static_cast<NPBool*>(value) = TRUE;
+ return NPERR_NO_ERROR;
+ default:
+ return NPERR_INVALID_PARAM;
+ }
+}
+#endif
+
int16 NPP_HandleEvent(NPP instance, void* event) {
if (instance == NULL)
return 0;
diff --git a/webkit/default_plugin/plugin_main.h b/webkit/default_plugin/plugin_main.h
index 4f73651..dc1e071 100644
--- a/webkit/default_plugin/plugin_main.h
+++ b/webkit/default_plugin/plugin_main.h
@@ -23,12 +23,19 @@ NPError NPP_DestroyStream(NPP instance, NPStream* stream, NPReason reason);
int32 NPP_WriteReady(NPP instance, NPStream* stream);
int32 NPP_Write(NPP instance, NPStream* stream, int32 offset, int32 len,
void* buffer);
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
+NPError NPP_GetValue(NPP instance, NPPVariable variable, void* value);
+#endif
void NPP_URLNotify(NPP instance, const char* url, NPReason reason,
void* notifyData);
int16 NPP_HandleEvent(NPP instance, void* event);
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
+NPError API_CALL NP_Initialize(NPNetscapeFuncs* funcs, NPPluginFuncs* p_funcs);
+#else
NPError API_CALL NP_GetEntryPoints(NPPluginFuncs* funcs);
NPError API_CALL NP_Initialize(NPNetscapeFuncs* funcs);
+#endif
NPError API_CALL NP_Shutdown(void);
} // default_plugin
diff --git a/webkit/glue/plugins/plugin_list.cc b/webkit/glue/plugins/plugin_list.cc
index d0a628d..d8651d7 100644
--- a/webkit/glue/plugins/plugin_list.cc
+++ b/webkit/glue/plugins/plugin_list.cc
@@ -141,7 +141,6 @@ PluginList::PluginList()
: plugins_loaded_(false), plugins_need_refresh_(false) {
PlatformInit();
-#if defined(OS_WIN) || defined(OS_MACOSX)
const PluginVersionInfo default_plugin = {
FilePath(kDefaultPluginLibraryName),
L"Default Plug-in",
@@ -151,14 +150,15 @@ PluginList::PluginList()
L"",
L"",
{
+#if !defined(OS_POSIX) || defined(OS_MACOSX)
default_plugin::NP_GetEntryPoints,
+#endif
default_plugin::NP_Initialize,
default_plugin::NP_Shutdown
}
};
internal_plugins_.push_back(default_plugin);
-#endif
}
void PluginList::LoadPlugins(bool refresh) {
diff --git a/webkit/glue/webkit_glue.gypi b/webkit/glue/webkit_glue.gypi
index 3c42c6b..1274a7a 100644
--- a/webkit/glue/webkit_glue.gypi
+++ b/webkit/glue/webkit_glue.gypi
@@ -366,7 +366,7 @@
'plugins/plugin_stubs.cc',
],
}],
- ['inside_chromium_build==1 and (OS=="mac" or OS=="win")', {
+ ['inside_chromium_build==1', {
'dependencies': [
'<(DEPTH)/webkit/default_plugin/default_plugin.gyp:default_plugin',
],