OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef WEBKIT_GLUE_PEPPER_PEPPER_H_ | |
6 #define WEBKIT_GLUE_PEPPER_PEPPER_H_ | |
7 | |
8 #ifdef PEPPER_APIS_ENABLED | |
9 | |
10 #include "base/basictypes.h" | |
11 #include "third_party/npapi/bindings/npapi.h" | |
12 | |
13 /* | |
14 * A fake "enum" value for getting Pepper extensions. | |
15 * The variable returns a pointer to an NPPepperExtensions structure | |
16 */ | |
17 #define NPNVPepperExtensions ((NPNVariable) 4000) | |
18 | |
19 typedef enum { | |
20 NPMouseButton_None = -1, | |
21 NPMouseButton_Left = 0, | |
22 NPMouseButton_Middle = 1, | |
23 NPMouseButton_Right = 2, | |
24 } NPMouseButtons; | |
25 | |
26 typedef enum { | |
27 NPEventType_Undefined = -1, | |
28 NPEventType_MouseDown = 0, | |
29 NPEventType_MouseUp = 1, | |
30 NPEventType_MouseMove = 2, | |
31 NPEventType_MouseEnter = 3, | |
32 NPEventType_MouseLeave = 4, | |
33 NPEventType_MouseWheel = 5, | |
34 NPEventType_RawKeyDown = 6, | |
35 NPEventType_KeyDown = 7, | |
36 NPEventType_KeyUp = 8, | |
37 NPEventType_Char = 9, | |
38 NPEventType_Minimize = 10, | |
39 NPEventType_Focus = 11, | |
40 NPEventType_Device = 12 | |
41 } NPEventTypes; | |
42 | |
43 typedef enum { | |
44 NPEventModifier_ShiftKey = 1 << 0, | |
45 NPEventModifier_ControlKey = 1 << 1, | |
46 NPEventModifier_AltKey = 1 << 2, | |
47 NPEventModifier_MetaKey = 1 << 3, | |
48 NPEventModifier_IsKeyPad = 1 << 4, | |
49 NPEventModifier_IsAutoRepeat = 1 << 5, | |
50 NPEventModifier_LeftButtonDown = 1 << 6, | |
51 NPEventModifier_MiddleButtonDown = 1 << 7, | |
52 NPEventModifier_RightButtonDown = 1 << 8 | |
53 } NPEventModifiers; | |
54 | |
55 typedef struct _NPKeyEvent | |
56 { | |
57 uint32 modifier; | |
58 uint32 normalizedKeyCode; | |
59 } NPKeyEvent; | |
60 | |
61 typedef struct _NPCharacterEvent | |
62 { | |
63 uint32 modifier; | |
64 uint16 text[4]; | |
65 uint16 unmodifiedText[4]; | |
66 } NPCharacterEvent; | |
67 | |
68 typedef struct _NPMouseEvent | |
69 { | |
70 uint32 modifier; | |
71 int32 button; | |
72 int32 x; | |
73 int32 y; | |
74 int32 clickCount; | |
75 } NPMouseEvent; | |
76 | |
77 typedef struct _NPMouseWheelEvent | |
78 { | |
79 uint32 modifier; | |
80 float deltaX; | |
81 float deltaY; | |
82 float wheelTicksX; | |
83 float wheelTicksY; | |
84 uint32 scrollByPage; | |
85 } NPMouseWheelEvent; | |
86 | |
87 typedef struct _NPDeviceEvent { | |
88 uint32 device_uid; | |
89 uint32 subtype; | |
90 /* uint8 generic[0]; */ | |
91 } NPDeviceEvent; | |
92 | |
93 typedef struct _NPMinimizeEvent { | |
94 int32 value; | |
95 } NPMinimizeEvent; | |
96 | |
97 typedef struct _NPFocusEvent { | |
98 int32 value; | |
99 } NPFocusEvent; | |
100 | |
101 typedef struct _NPPepprEvent | |
102 { | |
103 uint32 size; | |
104 int32 type; | |
105 double timeStampSeconds; | |
106 union { | |
107 NPKeyEvent key; | |
108 NPCharacterEvent character; | |
109 NPMouseEvent mouse; | |
110 NPMouseWheelEvent wheel; | |
111 NPMinimizeEvent minimize; | |
112 NPFocusEvent focus; | |
113 NPDeviceEvent device; | |
114 } u; | |
115 } NPPepperEvent; | |
116 | |
117 typedef struct _NPPepperRegion | |
118 { | |
119 int32 x; | |
120 int32 y; | |
121 int32 w; | |
122 int32 h; | |
123 } NPPepperRegion; | |
124 | |
125 typedef enum _NPRenderType | |
126 { | |
127 NPRenderGraphicsRGBA | |
128 } NPRenderType; | |
129 | |
130 typedef struct _NPRenderContext | |
131 { | |
132 union { | |
133 struct { | |
134 void* region; | |
135 int32 stride; | |
136 | |
137 // The dirty region that the plugin has painted into the buffer. This | |
138 // will be initialized to the size of the plugin image in | |
139 // initializeRenderContextPtr. The plugin can change the values to only | |
140 // update portions of the image. | |
141 struct { | |
142 int32 left; | |
143 int32 top; | |
144 int32 right; | |
145 int32 bottom; | |
146 } dirty; | |
147 } graphicsRgba; | |
148 } u; | |
149 } NPRenderContext; | |
150 | |
151 typedef void (*NPFlushRenderContextCallbackPtr)(NPRenderContext* context, | |
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 |