diff options
author | alokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-11 17:25:48 +0000 |
---|---|---|
committer | alokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-11 17:25:48 +0000 |
commit | e453b77b771a08563748e1850ba680121f620c4a (patch) | |
tree | 77fd7a9b4edad60f6f3c7d400063f576a836ce95 /webkit | |
parent | 423424e87a08f84bfb13fe322ccd580fd729356c (diff) | |
download | chromium_src-e453b77b771a08563748e1850ba680121f620c4a.zip chromium_src-e453b77b771a08563748e1850ba680121f620c4a.tar.gz chromium_src-e453b77b771a08563748e1850ba680121f620c4a.tar.bz2 |
Added linux-specific NP_Initialize function so that the plugin is properly initialized. Also fixed the mime-type to be consistent with that on windows and mac.
Review URL: http://codereview.chromium.org/3129005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55743 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/glue/plugins/test/npapi_test.cc | 47 |
1 files changed, 39 insertions, 8 deletions
diff --git a/webkit/glue/plugins/test/npapi_test.cc b/webkit/glue/plugins/test/npapi_test.cc index 1b2baa1..895a842 100644 --- a/webkit/glue/plugins/test/npapi_test.cc +++ b/webkit/glue/plugins/test/npapi_test.cc @@ -66,24 +66,55 @@ EXPORT NPError API_CALL NP_GetEntryPoints(NPPluginFuncs* pFuncs) { return NPAPIClient::PluginClient::GetEntryPoints(pFuncs); } -EXPORT NPError API_CALL NP_Initialize(NPNetscapeFuncs* pFuncs) { - return NPAPIClient::PluginClient::Initialize(pFuncs); -} - EXPORT NPError API_CALL NP_Shutdown() { return NPAPIClient::PluginClient::Shutdown(); } -#if defined(OS_POSIX) && !defined(OS_MACOSX) +#if defined(OS_WIN) || defined(OS_MACOSX) +EXPORT NPError API_CALL NP_Initialize(NPNetscapeFuncs* npnFuncs) { + return NPAPIClient::PluginClient::Initialize(npnFuncs); +} +#elif defined(OS_POSIX) +EXPORT NPError API_CALL NP_Initialize(NPNetscapeFuncs* npnFuncs, + NPPluginFuncs* nppFuncs) { + NPError error = NPAPIClient::PluginClient::Initialize(npnFuncs); + if (error == NPERR_NO_ERROR) { + error = NP_GetEntryPoints(nppFuncs); + } + return error; +} + +EXPORT NPError API_CALL NP_GetValue(NPP instance, NPPVariable variable, + void* value) { + NPError err = NPERR_NO_ERROR; + + switch (variable) { + case NPPVpluginNameString: + *(static_cast<const char**>(value)) = "NPAPI Test Plugin"; + break; + case NPPVpluginDescriptionString: + *(static_cast<const char**>(value)) = + "Simple NPAPI plug-in for Chromium unit tests"; + break; + case NPPVpluginNeedsXEmbed: + *(static_cast<NPBool*>(value)) = true; + break; + default: + err = NPERR_GENERIC_ERROR; + break; + } + + return err; +} + EXPORT const char* API_CALL NP_GetMIMEDescription(void) { // The layout test LayoutTests/fast/js/navigator-mimeTypes-length.html // asserts that the number of mimetypes handled by plugins should be // greater than the number of plugins. We specify a mimetype here so // this plugin has at least one. - return "application/x-npapi-test-netscape:npapitestnetscape:" - "npapi test netscape content"; + return "application/vnd.npapi-test:npapitest:test npapi"; } -#endif +#endif // OS_POSIX } // extern "C" namespace WebCore { |