Index: third_party/npapi/bindings/npapi_extensions.h |
=================================================================== |
--- third_party/npapi/bindings/npapi_extensions.h (revision 33382) |
+++ third_party/npapi/bindings/npapi_extensions.h (working copy) |
@@ -1,13 +1,11 @@ |
-// Copyright (c) 2006-2009 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. |
+/* Copyright (c) 2006-2009 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. |
+ */ |
-#ifndef WEBKIT_GLUE_PEPPER_PEPPER_H_ |
-#define WEBKIT_GLUE_PEPPER_PEPPER_H_ |
+#ifndef _NP_EXTENSIONS_H_ |
+#define _NP_EXTENSIONS_H_ |
-#ifdef PEPPER_APIS_ENABLED |
- |
-#include "base/basictypes.h" |
#include "third_party/npapi/bindings/npapi.h" |
/* |
@@ -16,6 +14,88 @@ |
*/ |
#define NPNVPepperExtensions ((NPNVariable) 4000) |
+typedef void NPDeviceConfig; |
+typedef void NPDeviceContext; |
+typedef void NPUserData; |
+ |
+/* unique id for each device interface */ |
+typedef int32 NPDeviceID; |
+ |
+/* completion callback for flush device */ |
+typedef void (*NPDeviceFlushContextCallbackPtr)( |
+ NPP instace, |
+ NPDeviceContext* context, |
+ NPError err, |
+ NPUserData* userData); |
+ |
+/* query single capabilities of device */ |
+typedef NPError ( |
+ *NPDeviceQueryCapabilityPtr)(NPP instance, |
+ int32 capability, |
+ int32 *value); |
+/* query config (configuration == a set of capabilities) */ |
+typedef NPError ( |
+ *NPDeviceQueryConfigPtr)(NPP instance, |
+ const NPDeviceConfig* request, |
+ NPDeviceConfig* obtain); |
+/* device initialization */ |
+typedef NPError (*NPDeviceInitializeContextPtr)( |
+ NPP instance, |
+ const NPDeviceConfig* config, |
+ NPDeviceContext* context); |
+/* peek at device state */ |
+typedef NPError (*NPDeviceGetStateContextPtr) ( |
+ NPP instance, |
+ NPDeviceContext* context, |
+ int32 state, |
+ int32 *value); |
+/* poke device state */ |
+typedef NPError (*NPDeviceSetStateContextPtr) ( |
+ NPP instance, |
+ NPDeviceContext* context, |
+ int32 state, |
+ int32 value); |
+/* flush context, if callback, userData are NULL */ |
+/* this becomes a blocking call */ |
+typedef NPError (*NPDeviceFlushContextPtr)( |
+ NPP instance, |
+ NPDeviceContext* context, |
+ NPDeviceFlushContextCallbackPtr callback, |
+ void* userData); |
+/* destroy device context. Application responsible for */ |
+/* freeing context, if applicable */ |
+typedef NPError (*NPDeviceDestroyContextPtr)( |
+ NPP instance, |
+ NPDeviceContext* context); |
+ |
+/* forward decl typdef structs */ |
+typedef struct NPDevice NPDevice; |
+typedef struct NPExtensions NPExtensions; |
+ |
+/* generic device interface */ |
+struct NPDevice { |
+ NPDeviceQueryCapabilityPtr queryCapability; |
+ NPDeviceQueryConfigPtr queryConfig; |
+ NPDeviceInitializeContextPtr initializeContext; |
+ NPDeviceSetStateContextPtr setStateContext; |
+ NPDeviceGetStateContextPtr getStateContext; |
+ NPDeviceFlushContextPtr flushContext; |
+ NPDeviceDestroyContextPtr destroyContext; |
+}; |
+ |
+/* returns NULL if deviceID unavailable / unrecognized */ |
+typedef NPDevice* (*NPAcquireDevicePtr)( |
+ NPP instance, |
+ NPDeviceID device); |
+ |
+/* Pepper extensions */ |
+struct NPExtensions { |
+ /* Device interface acquisition */ |
+ NPAcquireDevicePtr acquireDevice; |
+}; |
+ |
+/* Events -------------------------------------------------------------------*/ |
+ |
typedef enum { |
NPMouseButton_None = -1, |
NPMouseButton_Left = 0, |
@@ -98,7 +178,7 @@ |
int32 value; |
} NPFocusEvent; |
-typedef struct _NPPepprEvent |
+typedef struct _NPPepperEvent |
{ |
uint32 size; |
int32 type; |
@@ -114,30 +194,30 @@ |
} u; |
} NPPepperEvent; |
-typedef struct _NPPepperRegion |
-{ |
- int32 x; |
- int32 y; |
- int32 w; |
- int32 h; |
-} NPPepperRegion; |
+/* 2D -----------------------------------------------------------------------*/ |
+#define NPPepper2DDevice 1 |
+ |
typedef enum _NPRenderType |
{ |
NPRenderGraphicsRGBA |
} NPRenderType; |
-typedef struct _NPRenderContext |
+typedef struct _NPDeviceContext2DConfig { |
+} NPDeviceContext2DConfig; |
+ |
+typedef struct _NPDeviceContext2D |
{ |
union { |
struct { |
void* region; |
int32 stride; |
- // The dirty region that the plugin has painted into the buffer. This |
- // will be initialized to the size of the plugin image in |
- // initializeRenderContextPtr. The plugin can change the values to only |
- // update portions of the image. |
+ /* The dirty region that the plugin has painted into the buffer. This |
+ * will be initialized to the size of the plugin image in |
+ * initializeRenderContextPtr. The plugin can change the values to only |
+ * update portions of the image. |
+ */ |
struct { |
int32 left; |
int32 top; |
@@ -146,34 +226,6 @@ |
} dirty; |
} graphicsRgba; |
} u; |
-} NPRenderContext; |
+} NPDeviceContext2D; |
-typedef void (*NPFlushRenderContextCallbackPtr)(NPRenderContext* context, |
- NPError err, |
- void* userData); |
-typedef NPError (*NPInitializeRenderContextPtr)(NPP instance, |
- NPRenderType type, |
- NPRenderContext* context); |
-typedef NPError (*NPFlushRenderContextPtr)(NPP instance, |
- NPRenderContext* context, |
- NPFlushRenderContextCallbackPtr callback, |
- void* userData); |
-typedef NPError (*NPDestroyRenderContextPtr)(NPP instance, |
- NPRenderContext* context); |
-typedef NPError (*NPOpenFilePtr)(NPP instance, const char* fileName, void** handle); |
- |
-typedef struct _NPPepperExtensions |
-{ |
- /* Renderer extensions */ |
- NPInitializeRenderContextPtr initializeRender; |
- NPFlushRenderContextPtr flushRender; |
- NPDestroyRenderContextPtr destroyRender; |
- /* Shared memory extensions */ |
- |
- /* I/O extensions */ |
- NPOpenFilePtr openFile; |
-} NPPepperExtensions; |
- |
-#endif /* PEPPER_APIS_ENABLED */ |
- |
-#endif /* WEBKIT_GLUE_PEPPER_PEPPER_H_ */ |
+#endif /* _NP_EXTENSIONS_H_ */ |