summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--third_party/npapi/bindings/npapi.h74
-rw-r--r--webkit/glue/plugins/plugin_host.cc29
-rw-r--r--webkit/tools/pepper_test_plugin/README20
-rw-r--r--webkit/tools/pepper_test_plugin/plugin_object.cc14
4 files changed, 79 insertions, 58 deletions
diff --git a/third_party/npapi/bindings/npapi.h b/third_party/npapi/bindings/npapi.h
index a7e6a3b..f997953 100644
--- a/third_party/npapi/bindings/npapi.h
+++ b/third_party/npapi/bindings/npapi.h
@@ -44,11 +44,11 @@
#define _NPAPI_H_
-// BEGIN GOOGLE MODIFICATIONS
+/* BEGIN GOOGLE MODIFICATIONS */
#include "base/basictypes.h"
-// END GOOGLE MODIFICATIONS
+/* END GOOGLE MODIFICATIONS */
#ifdef INCLUDE_JAVA
#include "jri.h" /* Java Runtime Interface */
@@ -63,13 +63,13 @@
# endif /* XP_WIN */
#endif /* _WIN32 */
-// BEGIN GOOGLE MODIFICATIONS
-// On Linux and Mac, be sure to set Mozilla-specific macros.
+/* BEGIN GOOGLE MODIFICATIONS */
+/* On Linux and Mac, be sure to set Mozilla-specific macros. */
#if defined(OS_LINUX) || defined(OS_FREEBSD)
#define XP_UNIX 1
#define MOZ_X11 1
#endif
-// END GOOGLE MODIFICATIONS
+/* END GOOGLE MODIFICATIONS */
#ifdef __MWERKS__
# define _declspec __declspec
@@ -117,16 +117,16 @@
#if defined(XP_UNIX)
# include <stdio.h>
-// BEGIN GOOGLE MODIFICATIONS
+/* BEGIN GOOGLE MODIFICATIONS */
#if 0
-// END GOOGLE MODIFICATIONS
+/* END GOOGLE MODIFICATIONS */
# if defined(MOZ_X11)
# include <X11/Xlib.h>
# include <X11/Xutil.h>
# endif
-// BEGIN GOOGLE MODIFICATIONS
+/* BEGIN GOOGLE MODIFICATIONS */
#endif
-// END GOOGLE MODIFICATIONS
+/* END GOOGLE MODIFICATIONS */
#endif
#ifdef XP_WIN
@@ -138,9 +138,9 @@
/*----------------------------------------------------------------------*/
#define NP_VERSION_MAJOR 0
-// BEGIN GOOGLE MODIFICATIONS
-#define NP_VERSION_MINOR 23 // maximum version currently supported by Chromium
-// END GOOGLE MODIFICATIONS
+/* BEGIN GOOGLE MODIFICATIONS */
+#define NP_VERSION_MINOR 23 /* maximum version currently supported by Chromium */
+/* END GOOGLE MODIFICATIONS */
/*----------------------------------------------------------------------*/
@@ -287,9 +287,9 @@ typedef struct
int32 type;
} NPAnyCallbackStruct;
-// BEGIN GOOGLE MODIFICATIONS
+/* BEGIN GOOGLE MODIFICATIONS */
typedef struct _NPSetWindowCallbackStruct NPSetWindowCallbackStruct;
-// END GOOGLE MODIFICATIONS
+/* END GOOGLE MODIFICATIONS */
typedef struct
{
@@ -443,8 +443,7 @@ typedef enum {
* Until they are, they need to be distinct values from other enum
* elements here.
*/
- , NPNVInitializeRenderContextFunc = 4000 /* A pointer to the InitializeRenderContext function */
- , NPNVFlushRenderContextFunc = 4001 /* A pointer to the FlushRenderContext function */
+ , NPNVPepperExtensions = 4000 /* A pointer to an NPPepperExtensions structure */
#endif
} NPNVariable;
@@ -453,7 +452,7 @@ typedef enum {
NPNURLVProxy
} NPNURLVariable;
-// BEGIN GOOGLE MODIFICATIONS
+/* BEGIN GOOGLE MODIFICATIONS */
/*
* The type of Tookkit the widgets use
*/
@@ -461,7 +460,7 @@ typedef enum {
NPNVGtk12 = 1,
NPNVGtk2
} NPNToolkitType;
-// END GOOGLE MODIFICATIONS
+/* END GOOGLE MODIFICATIONS */
/*
* The type of a NPWindow - it specifies the type of the data structure
@@ -600,9 +599,9 @@ typedef struct _NPPrint
} NPPrint;
#ifdef XP_MACOSX
-// BEGIN GOOGLE MODIFICATIONS
+/* BEGIN GOOGLE MODIFICATIONS */
typedef struct _NPNSMenu NPNSMenu;
-// END GOOGLE MODIFICATIONS
+/* END GOOGLE MODIFICATIONS */
typedef NPNSMenu NPMenu;
#else
typedef void * NPMenu;
@@ -631,9 +630,9 @@ typedef struct _NPEvent
uint32 lParam;
} NPEvent;
#elif defined (XP_UNIX) && defined(MOZ_X11)
-// BEGIN GOOGLE MODIFICATIONS
+/* BEGIN GOOGLE MODIFICATIONS */
typedef union _XEvent XEvent;
-// END GOOGLE MODIFICATIONS
+/* END GOOGLE MODIFICATIONS */
typedef XEvent NPEvent;
#else
typedef void* NPEvent;
@@ -655,9 +654,9 @@ typedef CGPathRef NPCGRegion;
#elif defined(XP_WIN)
typedef HRGN NPRegion;
#elif defined(XP_UNIX)
-// BEGIN GOOGLE MODIFICATIONS
+/* BEGIN GOOGLE MODIFICATIONS */
typedef struct _XRegion *Region;
-// END GOOGLE MODIFICATIONS
+/* END GOOGLE MODIFICATIONS */
typedef Region NPRegion;
#else
typedef void *NPRegion;
@@ -676,7 +675,7 @@ typedef struct NP_CGContext
#ifdef NP_NO_CARBON
NPNSWindow *window;
#else
- void *window; // Can be either an NSWindow or a WindowRef depending on the event model
+ void *window; /* Can be either an NSWindow or a WindowRef depending on the event model */
#endif
} NP_CGContext;
@@ -691,7 +690,7 @@ typedef struct NP_GLContext
#ifdef NP_NO_CARBON
NPNSWindow *window;
#else
- void *window; // Can be either an NSWindow or a WindowRef depending on the event model
+ void *window; /* Can be either an NSWindow or a WindowRef depending on the event model */
#endif
} NP_GLContext;
@@ -727,7 +726,7 @@ typedef struct NP_Port
/*
* Non-standard event types that can be passed to HandleEvent
*/
-// BEGIN GOOGLE MODIFICATIONS
+/* BEGIN GOOGLE MODIFICATIONS */
enum NPEventType {
NPEventType_GetFocusEvent = (osEvt + 16),
NPEventType_LoseFocusEvent,
@@ -743,15 +742,16 @@ enum NPEventType {
#define loseFocusEvent (osEvt + 17)
#define adjustCursorEvent (osEvt + 18)
#endif
-// END GOOGLE MODIFICATIONS
+/* END GOOGLE MODIFICATIONS */
#endif /* XP_MACOSX */
/* Stub typedefs for interfaces requiring Pepper types. */
typedef int NPRenderType;
typedef struct _NPRenderContext NPRenderContext;
+typedef struct _NPPepperExtensions NPPepperExtensions;
-#else // defined(PEPPER_APIS_ENABLED)
+#else /* defined(PEPPER_APIS_ENABLED) */
typedef enum {
NPMouseButton_None = -1,
NPMouseButton_Left = 0,
@@ -823,7 +823,7 @@ typedef struct _NPMouseWheelEvent
typedef struct _NPDeviceEvent {
uint32 device_uid;
uint32 subtype;
- // uint8 generic[0];
+ /* uint8 generic[0]; */
} NPDeviceEvent;
typedef struct _NPMinimizeEvent {
@@ -883,7 +883,19 @@ typedef NPError (*NPFlushRenderContextPtr)(NPP instance,
NPRenderContext* context,
NPFlushRenderContextCallbackPtr callback,
void* userData);
-#endif // defined(PEPPER_APIS_ENABLED)
+typedef NPError (*NPDestroyRenderContextPtr)(NPP instance,
+ NPRenderContext* context);
+
+typedef struct _NPPepperExtensions
+{
+ /* Renderer extensions */
+ NPInitializeRenderContextPtr initializeRender;
+ NPFlushRenderContextPtr flushRender;
+ NPDestroyRenderContextPtr destroyRender;
+ /* Shared memory extensions */
+} NPPepperExtensions;
+
+#endif /* defined(PEPPER_APIS_ENABLED) */
/*
* Values for mode passed to NPP_New:
diff --git a/webkit/glue/plugins/plugin_host.cc b/webkit/glue/plugins/plugin_host.cc
index ddbae1c..e0d2a85 100644
--- a/webkit/glue/plugins/plugin_host.cc
+++ b/webkit/glue/plugins/plugin_host.cc
@@ -695,6 +695,12 @@ static NPError FlushRenderContext(NPP id,
}
return NPERR_GENERIC_ERROR;
}
+
+static NPError DestroyRenderContext(NPP id,
+ NPRenderContext* context) {
+ // TODO(sehr) implement render context destruction.
+ return NPERR_GENERIC_ERROR;
+}
#endif // defined(PEPPER_APIS_ENABLED)
NPError NPN_GetValue(NPP id, NPNVariable variable, void *value) {
@@ -850,19 +856,18 @@ NPError NPN_GetValue(NPP id, NPNVariable variable, void *value) {
}
#endif
#if defined(PEPPER_APIS_ENABLED)
- case NPNVInitializeRenderContextFunc:
- {
- NPInitializeRenderContextPtr* func =
- reinterpret_cast<NPInitializeRenderContextPtr*>(value);
- *func = InitializeRenderContext;
- rv = NPERR_NO_ERROR;
- break;
- }
- case NPNVFlushRenderContextFunc:
+ case NPNVPepperExtensions:
{
- NPFlushRenderContextPtr* func =
- reinterpret_cast<NPFlushRenderContextPtr*>(value);
- *func = FlushRenderContext;
+ static const NPPepperExtensions kExtensions = {
+ InitializeRenderContext,
+ FlushRenderContext,
+ DestroyRenderContext
+ };
+ // Return a pointer to the canonical function table.
+ NPPepperExtensions* extensions =
+ const_cast<NPPepperExtensions*>(&kExtensions);
+ NPPepperExtensions** exts = reinterpret_cast<NPPepperExtensions**>(value);
+ *exts = extensions;
rv = NPERR_NO_ERROR;
break;
}
diff --git a/webkit/tools/pepper_test_plugin/README b/webkit/tools/pepper_test_plugin/README
index f6c57cd7..5af73ad 100644
--- a/webkit/tools/pepper_test_plugin/README
+++ b/webkit/tools/pepper_test_plugin/README
@@ -1,8 +1,12 @@
-This is a test plugin for manual testing of the Pepper plugin API. See
- https://wiki.mozilla.org/Plugins:PlatformIndependentNPAPI
-
-To generate a project from the gyp file, use:
- python ..\..\..\build\gyp_chromium pepper_test_plugin.gyp
-
-To load this plugin in Chrome, use the command line flag:
- --load-plugin=<<<YOUR CHECKOUT ROOT>>\src\webkit\tools\pepper_test_plugin\Debug\pepper_test_plugin.dll
+This is a test plugin for manual testing of the Pepper plugin API. See
+ https://wiki.mozilla.org/Plugins:PlatformIndependentNPAPI
+
+To generate a project from the gyp file, use:
+ python ..\..\..\build\gyp_chromium pepper_test_plugin.gyp
+
+You need to enable PEPPER_APIS_ENABLED in src\chrome\renderer\render_view.cc in your Chrome build.
+
+To load this plugin in Chrome, use the command line flags:
+ --no-sandbox
+ --load-plugin=<<<YOUR CHECKOUT ROOT>>\src\webkit\tools\pepper_test_plugin\Debug\pepper_test_plugin.dll
+ \ No newline at end of file
diff --git a/webkit/tools/pepper_test_plugin/plugin_object.cc b/webkit/tools/pepper_test_plugin/plugin_object.cc
index 90908d0..bd3e9e2 100644
--- a/webkit/tools/pepper_test_plugin/plugin_object.cc
+++ b/webkit/tools/pepper_test_plugin/plugin_object.cc
@@ -237,14 +237,14 @@ void FlushCallback(NPRenderContext* context, void* user_data) {
PluginObject::PluginObject(NPP npp)
: npp_(npp),
test_object_(browser->createobject(npp, GetTestClass())) {
- if (!initialize_render_context) {
- browser->getvalue(npp_, NPNVInitializeRenderContextFunc,
- reinterpret_cast<void*>(&initialize_render_context));
+ if (!initialize_render_context || !flush_render_context) {
+ NPPepperExtensions* extensions;
+ browser->getvalue(npp_, NPNVPepperExtensions,
+ reinterpret_cast<void*>(&extensions));
+ CHECK(extensions);
+ initialize_render_context = extensions->initializeRender;
CHECK(initialize_render_context);
- }
- if (!flush_render_context) {
- browser->getvalue(npp_, NPNVFlushRenderContextFunc,
- reinterpret_cast<void*>(&flush_render_context));
+ flush_render_context = extensions->flushRender;
CHECK(flush_render_context);
}
}