diff options
Diffstat (limited to 'webkit/tools/npapi_pepper_test_plugin/main.cc')
-rw-r--r-- | webkit/tools/npapi_pepper_test_plugin/main.cc | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/webkit/tools/npapi_pepper_test_plugin/main.cc b/webkit/tools/npapi_pepper_test_plugin/main.cc new file mode 100644 index 0000000..78faa99 --- /dev/null +++ b/webkit/tools/npapi_pepper_test_plugin/main.cc @@ -0,0 +1,64 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#if defined(__GNUC__) && __GNUC__ >= 4 +#define EXPORT __attribute__((visibility ("default"))) +#else +#define EXPORT +#endif + +#include "webkit/glue/plugins/test/plugin_client.h" + +extern "C" { +EXPORT NPError API_CALL NP_GetEntryPoints(NPPluginFuncs* nppFuncs) { + return NPAPIClient::PluginClient::GetEntryPoints(nppFuncs); +} + +EXPORT NPError API_CALL NP_Shutdown() { + return NPAPIClient::PluginClient::Shutdown(); +} + +#if defined(OS_POSIX) && !defined(OS_MACOSX) +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 Pepper Test Plugin"; + break; + case NPPVpluginDescriptionString: + *(static_cast<const char**>(value)) = "NPAPI Pepper Test Plugin"; + break; + case NPPVpluginNeedsXEmbed: + *(static_cast<NPBool*>(value)) = true; + break; + default: + err = NPERR_GENERIC_ERROR; + break; + } + + return err; +} + +EXPORT const char* API_CALL NP_GetMIMEDescription() { + return "pepper-application/x-pepper-test:pepper:NPAPI Pepper Test Plugin"; +} +#else // OS_POSIX +EXPORT NPError API_CALL NP_Initialize(NPNetscapeFuncs* npnFuncs) { + return NPAPIClient::PluginClient::Initialize(npnFuncs); +} +#endif // OS_POSIX + +} // extern "C" + |