OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 /* Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 * Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 * found in the LICENSE file. |
| 4 */ |
4 | 5 |
5 #ifndef WEBKIT_GLUE_PEPPER_PEPPER_H_ | 6 #ifndef _NP_EXTENSIONS_H_ |
6 #define WEBKIT_GLUE_PEPPER_PEPPER_H_ | 7 #define _NP_EXTENSIONS_H_ |
7 | 8 |
8 #ifdef PEPPER_APIS_ENABLED | |
9 | |
10 #include "base/basictypes.h" | |
11 #include "third_party/npapi/bindings/npapi.h" | 9 #include "third_party/npapi/bindings/npapi.h" |
12 | 10 |
13 /* | 11 /* |
14 * A fake "enum" value for getting Pepper extensions. | 12 * A fake "enum" value for getting Pepper extensions. |
15 * The variable returns a pointer to an NPPepperExtensions structure | 13 * The variable returns a pointer to an NPPepperExtensions structure |
16 */ | 14 */ |
17 #define NPNVPepperExtensions ((NPNVariable) 4000) | 15 #define NPNVPepperExtensions ((NPNVariable) 4000) |
18 | 16 |
| 17 typedef void NPDeviceConfig; |
| 18 typedef void NPDeviceContext; |
| 19 typedef void NPUserData; |
| 20 |
| 21 /* unique id for each device interface */ |
| 22 typedef int32 NPDeviceID; |
| 23 |
| 24 /* completion callback for flush device */ |
| 25 typedef void (*NPDeviceFlushContextCallbackPtr)( |
| 26 NPP instace, |
| 27 NPDeviceContext* context, |
| 28 NPError err, |
| 29 NPUserData* userData); |
| 30 |
| 31 /* query single capabilities of device */ |
| 32 typedef NPError ( |
| 33 *NPDeviceQueryCapabilityPtr)(NPP instance, |
| 34 int32 capability, |
| 35 int32 *value); |
| 36 /* query config (configuration == a set of capabilities) */ |
| 37 typedef NPError ( |
| 38 *NPDeviceQueryConfigPtr)(NPP instance, |
| 39 const NPDeviceConfig* request, |
| 40 NPDeviceConfig* obtain); |
| 41 /* device initialization */ |
| 42 typedef NPError (*NPDeviceInitializeContextPtr)( |
| 43 NPP instance, |
| 44 const NPDeviceConfig* config, |
| 45 NPDeviceContext* context); |
| 46 /* peek at device state */ |
| 47 typedef NPError (*NPDeviceGetStateContextPtr) ( |
| 48 NPP instance, |
| 49 NPDeviceContext* context, |
| 50 int32 state, |
| 51 int32 *value); |
| 52 /* poke device state */ |
| 53 typedef NPError (*NPDeviceSetStateContextPtr) ( |
| 54 NPP instance, |
| 55 NPDeviceContext* context, |
| 56 int32 state, |
| 57 int32 value); |
| 58 /* flush context, if callback, userData are NULL */ |
| 59 /* this becomes a blocking call */ |
| 60 typedef NPError (*NPDeviceFlushContextPtr)( |
| 61 NPP instance, |
| 62 NPDeviceContext* context, |
| 63 NPDeviceFlushContextCallbackPtr callback, |
| 64 void* userData); |
| 65 /* destroy device context. Application responsible for */ |
| 66 /* freeing context, if applicable */ |
| 67 typedef NPError (*NPDeviceDestroyContextPtr)( |
| 68 NPP instance, |
| 69 NPDeviceContext* context); |
| 70 |
| 71 /* forward decl typdef structs */ |
| 72 typedef struct NPDevice NPDevice; |
| 73 typedef struct NPExtensions NPExtensions; |
| 74 |
| 75 /* generic device interface */ |
| 76 struct NPDevice { |
| 77 NPDeviceQueryCapabilityPtr queryCapability; |
| 78 NPDeviceQueryConfigPtr queryConfig; |
| 79 NPDeviceInitializeContextPtr initializeContext; |
| 80 NPDeviceSetStateContextPtr setStateContext; |
| 81 NPDeviceGetStateContextPtr getStateContext; |
| 82 NPDeviceFlushContextPtr flushContext; |
| 83 NPDeviceDestroyContextPtr destroyContext; |
| 84 }; |
| 85 |
| 86 /* returns NULL if deviceID unavailable / unrecognized */ |
| 87 typedef NPDevice* (*NPAcquireDevicePtr)( |
| 88 NPP instance, |
| 89 NPDeviceID device); |
| 90 |
| 91 /* Pepper extensions */ |
| 92 struct NPExtensions { |
| 93 /* Device interface acquisition */ |
| 94 NPAcquireDevicePtr acquireDevice; |
| 95 }; |
| 96 |
| 97 /* Events -------------------------------------------------------------------*/ |
| 98 |
19 typedef enum { | 99 typedef enum { |
20 NPMouseButton_None = -1, | 100 NPMouseButton_None = -1, |
21 NPMouseButton_Left = 0, | 101 NPMouseButton_Left = 0, |
22 NPMouseButton_Middle = 1, | 102 NPMouseButton_Middle = 1, |
23 NPMouseButton_Right = 2, | 103 NPMouseButton_Right = 2, |
24 } NPMouseButtons; | 104 } NPMouseButtons; |
25 | 105 |
26 typedef enum { | 106 typedef enum { |
27 NPEventType_Undefined = -1, | 107 NPEventType_Undefined = -1, |
28 NPEventType_MouseDown = 0, | 108 NPEventType_MouseDown = 0, |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 } NPDeviceEvent; | 171 } NPDeviceEvent; |
92 | 172 |
93 typedef struct _NPMinimizeEvent { | 173 typedef struct _NPMinimizeEvent { |
94 int32 value; | 174 int32 value; |
95 } NPMinimizeEvent; | 175 } NPMinimizeEvent; |
96 | 176 |
97 typedef struct _NPFocusEvent { | 177 typedef struct _NPFocusEvent { |
98 int32 value; | 178 int32 value; |
99 } NPFocusEvent; | 179 } NPFocusEvent; |
100 | 180 |
101 typedef struct _NPPepprEvent | 181 typedef struct _NPPepperEvent |
102 { | 182 { |
103 uint32 size; | 183 uint32 size; |
104 int32 type; | 184 int32 type; |
105 double timeStampSeconds; | 185 double timeStampSeconds; |
106 union { | 186 union { |
107 NPKeyEvent key; | 187 NPKeyEvent key; |
108 NPCharacterEvent character; | 188 NPCharacterEvent character; |
109 NPMouseEvent mouse; | 189 NPMouseEvent mouse; |
110 NPMouseWheelEvent wheel; | 190 NPMouseWheelEvent wheel; |
111 NPMinimizeEvent minimize; | 191 NPMinimizeEvent minimize; |
112 NPFocusEvent focus; | 192 NPFocusEvent focus; |
113 NPDeviceEvent device; | 193 NPDeviceEvent device; |
114 } u; | 194 } u; |
115 } NPPepperEvent; | 195 } NPPepperEvent; |
116 | 196 |
117 typedef struct _NPPepperRegion | 197 /* 2D -----------------------------------------------------------------------*/ |
118 { | 198 |
119 int32 x; | 199 #define NPPepper2DDevice 1 |
120 int32 y; | |
121 int32 w; | |
122 int32 h; | |
123 } NPPepperRegion; | |
124 | 200 |
125 typedef enum _NPRenderType | 201 typedef enum _NPRenderType |
126 { | 202 { |
127 NPRenderGraphicsRGBA | 203 NPRenderGraphicsRGBA |
128 } NPRenderType; | 204 } NPRenderType; |
129 | 205 |
130 typedef struct _NPRenderContext | 206 typedef struct _NPDeviceContext2DConfig { |
| 207 } NPDeviceContext2DConfig; |
| 208 |
| 209 typedef struct _NPDeviceContext2D |
131 { | 210 { |
132 union { | 211 union { |
133 struct { | 212 struct { |
134 void* region; | 213 void* region; |
135 int32 stride; | 214 int32 stride; |
136 | 215 |
137 // The dirty region that the plugin has painted into the buffer. This | 216 /* The dirty region that the plugin has painted into the buffer. This |
138 // will be initialized to the size of the plugin image in | 217 * will be initialized to the size of the plugin image in |
139 // initializeRenderContextPtr. The plugin can change the values to only | 218 * initializeRenderContextPtr. The plugin can change the values to only |
140 // update portions of the image. | 219 * update portions of the image. |
| 220 */ |
141 struct { | 221 struct { |
142 int32 left; | 222 int32 left; |
143 int32 top; | 223 int32 top; |
144 int32 right; | 224 int32 right; |
145 int32 bottom; | 225 int32 bottom; |
146 } dirty; | 226 } dirty; |
147 } graphicsRgba; | 227 } graphicsRgba; |
148 } u; | 228 } u; |
149 } NPRenderContext; | 229 } NPDeviceContext2D; |
150 | 230 |
151 typedef void (*NPFlushRenderContextCallbackPtr)(NPRenderContext* context, | 231 #endif /* _NP_EXTENSIONS_H_ */ |
152 NPError err, | |
153 void* userData); | |
154 typedef NPError (*NPInitializeRenderContextPtr)(NPP instance, | |
155 NPRenderType type, | |
156 NPRenderContext* context); | |
157 typedef NPError (*NPFlushRenderContextPtr)(NPP instance, | |
158 NPRenderContext* context, | |
159 NPFlushRenderContextCallbackPtr callb
ack, | |
160 void* userData); | |
161 typedef NPError (*NPDestroyRenderContextPtr)(NPP instance, | |
162 NPRenderContext* context); | |
163 typedef NPError (*NPOpenFilePtr)(NPP instance, const char* fileName, void** hand
le); | |
164 | |
165 typedef struct _NPPepperExtensions | |
166 { | |
167 /* Renderer extensions */ | |
168 NPInitializeRenderContextPtr initializeRender; | |
169 NPFlushRenderContextPtr flushRender; | |
170 NPDestroyRenderContextPtr destroyRender; | |
171 /* Shared memory extensions */ | |
172 | |
173 /* I/O extensions */ | |
174 NPOpenFilePtr openFile; | |
175 } NPPepperExtensions; | |
176 | |
177 #endif /* PEPPER_APIS_ENABLED */ | |
178 | |
179 #endif /* WEBKIT_GLUE_PEPPER_PEPPER_H_ */ | |
OLD | NEW |