Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(165)

Side by Side Diff: webkit/glue/plugins/npapi_extension_thunk.cc

Issue 4192012: Convert implicit scoped_refptr constructor calls to explicit ones, part 1 (Closed) Base URL: http://git.chromium.org/git/chromium.git
Patch Set: fix presubmit Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/glue/media/buffered_data_source_unittest.cc ('k') | webkit/glue/plugins/plugin_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #include "webkit/glue/plugins/npapi_extension_thunk.h" 5 #include "webkit/glue/plugins/npapi_extension_thunk.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "third_party/npapi/bindings/npapi_extensions.h" 10 #include "third_party/npapi/bindings/npapi_extensions.h"
(...skipping 10 matching lines...) Expand all
21 NOTREACHED(); 21 NOTREACHED();
22 return NULL; 22 return NULL;
23 } 23 }
24 return static_cast<NPAPI::PluginInstance*>(id->ndata); 24 return static_cast<NPAPI::PluginInstance*>(id->ndata);
25 } 25 }
26 26
27 // 2D device API --------------------------------------------------------------- 27 // 2D device API ---------------------------------------------------------------
28 28
29 static NPError Device2DQueryCapability(NPP id, int32_t capability, 29 static NPError Device2DQueryCapability(NPP id, int32_t capability,
30 int32_t* value) { 30 int32_t* value) {
31 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); 31 scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id));
32 if (plugin) { 32 if (plugin) {
33 plugin->webplugin()->delegate()->Device2DQueryCapability(capability, value); 33 plugin->webplugin()->delegate()->Device2DQueryCapability(capability, value);
34 return NPERR_NO_ERROR; 34 return NPERR_NO_ERROR;
35 } else { 35 } else {
36 return NPERR_GENERIC_ERROR; 36 return NPERR_GENERIC_ERROR;
37 } 37 }
38 } 38 }
39 39
40 static NPError Device2DQueryConfig(NPP id, 40 static NPError Device2DQueryConfig(NPP id,
41 const NPDeviceConfig* request, 41 const NPDeviceConfig* request,
42 NPDeviceConfig* obtain) { 42 NPDeviceConfig* obtain) {
43 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); 43 scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id));
44 if (plugin) { 44 if (plugin) {
45 return plugin->webplugin()->delegate()->Device2DQueryConfig( 45 return plugin->webplugin()->delegate()->Device2DQueryConfig(
46 static_cast<const NPDeviceContext2DConfig*>(request), 46 static_cast<const NPDeviceContext2DConfig*>(request),
47 static_cast<NPDeviceContext2DConfig*>(obtain)); 47 static_cast<NPDeviceContext2DConfig*>(obtain));
48 } 48 }
49 return NPERR_GENERIC_ERROR; 49 return NPERR_GENERIC_ERROR;
50 } 50 }
51 51
52 static NPError Device2DInitializeContext(NPP id, 52 static NPError Device2DInitializeContext(NPP id,
53 const NPDeviceConfig* config, 53 const NPDeviceConfig* config,
54 NPDeviceContext* context) { 54 NPDeviceContext* context) {
55 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); 55 scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id));
56 if (plugin) { 56 if (plugin) {
57 return plugin->webplugin()->delegate()->Device2DInitializeContext( 57 return plugin->webplugin()->delegate()->Device2DInitializeContext(
58 static_cast<const NPDeviceContext2DConfig*>(config), 58 static_cast<const NPDeviceContext2DConfig*>(config),
59 static_cast<NPDeviceContext2D*>(context)); 59 static_cast<NPDeviceContext2D*>(context));
60 } 60 }
61 return NPERR_GENERIC_ERROR; 61 return NPERR_GENERIC_ERROR;
62 } 62 }
63 63
64 static NPError Device2DSetStateContext(NPP id, 64 static NPError Device2DSetStateContext(NPP id,
65 NPDeviceContext* context, 65 NPDeviceContext* context,
66 int32_t state, 66 int32_t state,
67 intptr_t value) { 67 intptr_t value) {
68 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); 68 scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id));
69 if (plugin) { 69 if (plugin) {
70 return plugin->webplugin()->delegate()->Device2DSetStateContext( 70 return plugin->webplugin()->delegate()->Device2DSetStateContext(
71 static_cast<NPDeviceContext2D*>(context), state, value); 71 static_cast<NPDeviceContext2D*>(context), state, value);
72 } 72 }
73 return NPERR_GENERIC_ERROR; 73 return NPERR_GENERIC_ERROR;
74 } 74 }
75 75
76 static NPError Device2DGetStateContext(NPP id, 76 static NPError Device2DGetStateContext(NPP id,
77 NPDeviceContext* context, 77 NPDeviceContext* context,
78 int32_t state, 78 int32_t state,
79 intptr_t* value) { 79 intptr_t* value) {
80 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); 80 scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id));
81 if (plugin) { 81 if (plugin) {
82 return plugin->webplugin()->delegate()->Device2DGetStateContext( 82 return plugin->webplugin()->delegate()->Device2DGetStateContext(
83 static_cast<NPDeviceContext2D*>(context), state, value); 83 static_cast<NPDeviceContext2D*>(context), state, value);
84 } 84 }
85 return NPERR_GENERIC_ERROR; 85 return NPERR_GENERIC_ERROR;
86 } 86 }
87 87
88 static NPError Device2DFlushContext(NPP id, 88 static NPError Device2DFlushContext(NPP id,
89 NPDeviceContext* context, 89 NPDeviceContext* context,
90 NPDeviceFlushContextCallbackPtr callback, 90 NPDeviceFlushContextCallbackPtr callback,
91 void* user_data) { 91 void* user_data) {
92 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); 92 scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id));
93 if (plugin) { 93 if (plugin) {
94 NPError err = plugin->webplugin()->delegate()->Device2DFlushContext( 94 NPError err = plugin->webplugin()->delegate()->Device2DFlushContext(
95 id, static_cast<NPDeviceContext2D*>(context), callback, user_data); 95 id, static_cast<NPDeviceContext2D*>(context), callback, user_data);
96 96
97 // Invoke the callback to inform the caller the work was done. 97 // Invoke the callback to inform the caller the work was done.
98 // TODO(brettw) this is probably not how we want this to work, this should 98 // TODO(brettw) this is probably not how we want this to work, this should
99 // happen when the frame is painted so the plugin knows when it can draw 99 // happen when the frame is painted so the plugin knows when it can draw
100 // the next frame. 100 // the next frame.
101 if (callback != NULL) 101 if (callback != NULL)
102 (*callback)(id, context, err, user_data); 102 (*callback)(id, context, err, user_data);
103 103
104 // Return any errors. 104 // Return any errors.
105 return err; 105 return err;
106 } 106 }
107 return NPERR_GENERIC_ERROR; 107 return NPERR_GENERIC_ERROR;
108 } 108 }
109 109
110 static NPError Device2DDestroyContext(NPP id, 110 static NPError Device2DDestroyContext(NPP id,
111 NPDeviceContext* context) { 111 NPDeviceContext* context) {
112 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); 112 scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id));
113 if (plugin) { 113 if (plugin) {
114 return plugin->webplugin()->delegate()->Device2DDestroyContext( 114 return plugin->webplugin()->delegate()->Device2DDestroyContext(
115 static_cast<NPDeviceContext2D*>(context)); 115 static_cast<NPDeviceContext2D*>(context));
116 } 116 }
117 return NPERR_GENERIC_ERROR; 117 return NPERR_GENERIC_ERROR;
118 } 118 }
119 119
120 static NPError Device2DCreateBuffer(NPP id, 120 static NPError Device2DCreateBuffer(NPP id,
121 NPDeviceContext* context, 121 NPDeviceContext* context,
122 size_t size, 122 size_t size,
(...skipping 11 matching lines...) Expand all
134 NPDeviceContext* context, 134 NPDeviceContext* context,
135 int32_t buffer_id, 135 int32_t buffer_id,
136 NPDeviceBuffer* buffer) { 136 NPDeviceBuffer* buffer) {
137 return NPERR_GENERIC_ERROR; 137 return NPERR_GENERIC_ERROR;
138 } 138 }
139 139
140 // 3D device API --------------------------------------------------------------- 140 // 3D device API ---------------------------------------------------------------
141 141
142 static NPError Device3DQueryCapability(NPP id, int32_t capability, 142 static NPError Device3DQueryCapability(NPP id, int32_t capability,
143 int32_t* value) { 143 int32_t* value) {
144 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); 144 scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id));
145 if (plugin) { 145 if (plugin) {
146 plugin->webplugin()->delegate()->Device3DQueryCapability(capability, value); 146 plugin->webplugin()->delegate()->Device3DQueryCapability(capability, value);
147 return NPERR_NO_ERROR; 147 return NPERR_NO_ERROR;
148 } else { 148 } else {
149 return NPERR_GENERIC_ERROR; 149 return NPERR_GENERIC_ERROR;
150 } 150 }
151 } 151 }
152 152
153 static NPError Device3DQueryConfig(NPP id, 153 static NPError Device3DQueryConfig(NPP id,
154 const NPDeviceConfig* request, 154 const NPDeviceConfig* request,
155 NPDeviceConfig* obtain) { 155 NPDeviceConfig* obtain) {
156 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); 156 scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id));
157 if (plugin) { 157 if (plugin) {
158 return plugin->webplugin()->delegate()->Device3DQueryConfig( 158 return plugin->webplugin()->delegate()->Device3DQueryConfig(
159 static_cast<const NPDeviceContext3DConfig*>(request), 159 static_cast<const NPDeviceContext3DConfig*>(request),
160 static_cast<NPDeviceContext3DConfig*>(obtain)); 160 static_cast<NPDeviceContext3DConfig*>(obtain));
161 } 161 }
162 return NPERR_GENERIC_ERROR; 162 return NPERR_GENERIC_ERROR;
163 } 163 }
164 164
165 static NPError Device3DInitializeContext(NPP id, 165 static NPError Device3DInitializeContext(NPP id,
166 const NPDeviceConfig* config, 166 const NPDeviceConfig* config,
167 NPDeviceContext* context) { 167 NPDeviceContext* context) {
168 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); 168 scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id));
169 if (plugin) { 169 if (plugin) {
170 return plugin->webplugin()->delegate()->Device3DInitializeContext( 170 return plugin->webplugin()->delegate()->Device3DInitializeContext(
171 static_cast<const NPDeviceContext3DConfig*>(config), 171 static_cast<const NPDeviceContext3DConfig*>(config),
172 static_cast<NPDeviceContext3D*>(context)); 172 static_cast<NPDeviceContext3D*>(context));
173 } 173 }
174 return NPERR_GENERIC_ERROR; 174 return NPERR_GENERIC_ERROR;
175 } 175 }
176 176
177 static NPError Device3DSetStateContext(NPP id, 177 static NPError Device3DSetStateContext(NPP id,
178 NPDeviceContext* context, 178 NPDeviceContext* context,
179 int32_t state, 179 int32_t state,
180 intptr_t value) { 180 intptr_t value) {
181 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); 181 scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id));
182 if (plugin) { 182 if (plugin) {
183 return plugin->webplugin()->delegate()->Device3DSetStateContext( 183 return plugin->webplugin()->delegate()->Device3DSetStateContext(
184 static_cast<NPDeviceContext3D*>(context), state, value); 184 static_cast<NPDeviceContext3D*>(context), state, value);
185 } 185 }
186 return NPERR_GENERIC_ERROR; 186 return NPERR_GENERIC_ERROR;
187 } 187 }
188 188
189 static NPError Device3DGetStateContext(NPP id, 189 static NPError Device3DGetStateContext(NPP id,
190 NPDeviceContext* context, 190 NPDeviceContext* context,
191 int32_t state, 191 int32_t state,
192 intptr_t* value) { 192 intptr_t* value) {
193 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); 193 scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id));
194 if (plugin) { 194 if (plugin) {
195 return plugin->webplugin()->delegate()->Device3DGetStateContext( 195 return plugin->webplugin()->delegate()->Device3DGetStateContext(
196 static_cast<NPDeviceContext3D*>(context), state, value); 196 static_cast<NPDeviceContext3D*>(context), state, value);
197 } 197 }
198 return NPERR_GENERIC_ERROR; 198 return NPERR_GENERIC_ERROR;
199 } 199 }
200 200
201 static NPError Device3DFlushContext(NPP id, 201 static NPError Device3DFlushContext(NPP id,
202 NPDeviceContext* context, 202 NPDeviceContext* context,
203 NPDeviceFlushContextCallbackPtr callback, 203 NPDeviceFlushContextCallbackPtr callback,
204 void* user_data) { 204 void* user_data) {
205 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); 205 scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id));
206 if (plugin) { 206 if (plugin) {
207 return plugin->webplugin()->delegate()->Device3DFlushContext( 207 return plugin->webplugin()->delegate()->Device3DFlushContext(
208 id, static_cast<NPDeviceContext3D*>(context), callback, user_data); 208 id, static_cast<NPDeviceContext3D*>(context), callback, user_data);
209 } 209 }
210 return NPERR_GENERIC_ERROR; 210 return NPERR_GENERIC_ERROR;
211 } 211 }
212 212
213 static NPError Device3DDestroyContext(NPP id, 213 static NPError Device3DDestroyContext(NPP id,
214 NPDeviceContext* context) { 214 NPDeviceContext* context) {
215 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); 215 scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id));
216 if (plugin) { 216 if (plugin) {
217 return plugin->webplugin()->delegate()->Device3DDestroyContext( 217 return plugin->webplugin()->delegate()->Device3DDestroyContext(
218 static_cast<NPDeviceContext3D*>(context)); 218 static_cast<NPDeviceContext3D*>(context));
219 } 219 }
220 return NPERR_GENERIC_ERROR; 220 return NPERR_GENERIC_ERROR;
221 } 221 }
222 222
223 static NPError Device3DCreateBuffer(NPP id, 223 static NPError Device3DCreateBuffer(NPP id,
224 NPDeviceContext* context, 224 NPDeviceContext* context,
225 size_t size, 225 size_t size,
226 int32_t* buffer_id) { 226 int32_t* buffer_id) {
227 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); 227 scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id));
228 if (plugin) { 228 if (plugin) {
229 return plugin->webplugin()->delegate()->Device3DCreateBuffer( 229 return plugin->webplugin()->delegate()->Device3DCreateBuffer(
230 static_cast<NPDeviceContext3D*>(context), size, buffer_id); 230 static_cast<NPDeviceContext3D*>(context), size, buffer_id);
231 } 231 }
232 return NPERR_GENERIC_ERROR; 232 return NPERR_GENERIC_ERROR;
233 } 233 }
234 234
235 static NPError Device3DDestroyBuffer(NPP id, 235 static NPError Device3DDestroyBuffer(NPP id,
236 NPDeviceContext* context, 236 NPDeviceContext* context,
237 int32_t buffer_id) { 237 int32_t buffer_id) {
238 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); 238 scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id));
239 if (plugin) { 239 if (plugin) {
240 return plugin->webplugin()->delegate()->Device3DDestroyBuffer( 240 return plugin->webplugin()->delegate()->Device3DDestroyBuffer(
241 static_cast<NPDeviceContext3D*>(context), buffer_id); 241 static_cast<NPDeviceContext3D*>(context), buffer_id);
242 } 242 }
243 return NPERR_GENERIC_ERROR; 243 return NPERR_GENERIC_ERROR;
244 } 244 }
245 245
246 static NPError Device3DMapBuffer(NPP id, 246 static NPError Device3DMapBuffer(NPP id,
247 NPDeviceContext* context, 247 NPDeviceContext* context,
248 int32_t buffer_id, 248 int32_t buffer_id,
249 NPDeviceBuffer* buffer) { 249 NPDeviceBuffer* buffer) {
250 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); 250 scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id));
251 if (plugin) { 251 if (plugin) {
252 return plugin->webplugin()->delegate()->Device3DMapBuffer( 252 return plugin->webplugin()->delegate()->Device3DMapBuffer(
253 static_cast<NPDeviceContext3D*>(context), buffer_id, buffer); 253 static_cast<NPDeviceContext3D*>(context), buffer_id, buffer);
254 } 254 }
255 return NPERR_GENERIC_ERROR; 255 return NPERR_GENERIC_ERROR;
256 } 256 }
257 257
258 // Experimental 3D device API -------------------------------------------------- 258 // Experimental 3D device API --------------------------------------------------
259 259
260 static NPError Device3DGetNumConfigs(NPP id, int32_t* num_configs) { 260 static NPError Device3DGetNumConfigs(NPP id, int32_t* num_configs) {
261 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); 261 scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id));
262 if (plugin) { 262 if (plugin) {
263 return plugin->webplugin()->delegate()->Device3DGetNumConfigs(num_configs); 263 return plugin->webplugin()->delegate()->Device3DGetNumConfigs(num_configs);
264 } 264 }
265 return NPERR_GENERIC_ERROR; 265 return NPERR_GENERIC_ERROR;
266 } 266 }
267 267
268 static NPError Device3DGetConfigAttribs(NPP id, 268 static NPError Device3DGetConfigAttribs(NPP id,
269 int32_t config, 269 int32_t config,
270 int32_t* attrib_list) { 270 int32_t* attrib_list) {
271 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); 271 scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id));
272 if (plugin) { 272 if (plugin) {
273 return plugin->webplugin()->delegate()->Device3DGetConfigAttribs( 273 return plugin->webplugin()->delegate()->Device3DGetConfigAttribs(
274 config, 274 config,
275 attrib_list); 275 attrib_list);
276 } 276 }
277 return NPERR_GENERIC_ERROR; 277 return NPERR_GENERIC_ERROR;
278 } 278 }
279 279
280 static NPError Device3DCreateContext(NPP id, 280 static NPError Device3DCreateContext(NPP id,
281 int32_t config, 281 int32_t config,
282 const int32_t* attrib_list, 282 const int32_t* attrib_list,
283 NPDeviceContext** context) { 283 NPDeviceContext** context) {
284 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); 284 scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id));
285 if (plugin) { 285 if (plugin) {
286 return plugin->webplugin()->delegate()->Device3DCreateContext( 286 return plugin->webplugin()->delegate()->Device3DCreateContext(
287 config, 287 config,
288 attrib_list, 288 attrib_list,
289 reinterpret_cast<NPDeviceContext3D**>(context)); 289 reinterpret_cast<NPDeviceContext3D**>(context));
290 } 290 }
291 return NPERR_GENERIC_ERROR; 291 return NPERR_GENERIC_ERROR;
292 } 292 }
293 293
294 static NPError Device3DSynchronizeContext( 294 static NPError Device3DSynchronizeContext(
295 NPP id, 295 NPP id,
296 NPDeviceContext* context, 296 NPDeviceContext* context,
297 NPDeviceSynchronizationMode mode, 297 NPDeviceSynchronizationMode mode,
298 const int32_t* input_attrib_list, 298 const int32_t* input_attrib_list,
299 int32_t* output_attrib_list, 299 int32_t* output_attrib_list,
300 NPDeviceSynchronizeContextCallbackPtr callback, 300 NPDeviceSynchronizeContextCallbackPtr callback,
301 void* callback_data) { 301 void* callback_data) {
302 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); 302 scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id));
303 if (plugin) { 303 if (plugin) {
304 return plugin->webplugin()->delegate()->Device3DSynchronizeContext( 304 return plugin->webplugin()->delegate()->Device3DSynchronizeContext(
305 id, 305 id,
306 static_cast<NPDeviceContext3D*>(context), 306 static_cast<NPDeviceContext3D*>(context),
307 mode, 307 mode,
308 input_attrib_list, 308 input_attrib_list,
309 output_attrib_list, 309 output_attrib_list,
310 callback, 310 callback,
311 callback_data); 311 callback_data);
312 } 312 }
313 return NPERR_GENERIC_ERROR; 313 return NPERR_GENERIC_ERROR;
314 } 314 }
315 315
316 static NPError Device3DRegisterCallback( 316 static NPError Device3DRegisterCallback(
317 NPP id, 317 NPP id,
318 NPDeviceContext* context, 318 NPDeviceContext* context,
319 int32_t callback_type, 319 int32_t callback_type,
320 NPDeviceGenericCallbackPtr callback, 320 NPDeviceGenericCallbackPtr callback,
321 void* callback_data) { 321 void* callback_data) {
322 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); 322 scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id));
323 if (plugin) { 323 if (plugin) {
324 return plugin->webplugin()->delegate()->Device3DRegisterCallback( 324 return plugin->webplugin()->delegate()->Device3DRegisterCallback(
325 id, 325 id,
326 static_cast<NPDeviceContext3D*>(context), 326 static_cast<NPDeviceContext3D*>(context),
327 callback_type, 327 callback_type,
328 callback, 328 callback,
329 callback_data); 329 callback_data);
330 } 330 }
331 return NPERR_GENERIC_ERROR; 331 return NPERR_GENERIC_ERROR;
332 } 332 }
333 333
334 // Audio device API ------------------------------------------------------------ 334 // Audio device API ------------------------------------------------------------
335 335
336 static NPError DeviceAudioQueryCapability(NPP id, int32_t capability, 336 static NPError DeviceAudioQueryCapability(NPP id, int32_t capability,
337 int32_t* value) { 337 int32_t* value) {
338 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); 338 scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id));
339 if (plugin) { 339 if (plugin) {
340 plugin->webplugin()->delegate()->DeviceAudioQueryCapability(capability, 340 plugin->webplugin()->delegate()->DeviceAudioQueryCapability(capability,
341 value); 341 value);
342 return NPERR_NO_ERROR; 342 return NPERR_NO_ERROR;
343 } else { 343 } else {
344 return NPERR_GENERIC_ERROR; 344 return NPERR_GENERIC_ERROR;
345 } 345 }
346 } 346 }
347 347
348 static NPError DeviceAudioQueryConfig(NPP id, 348 static NPError DeviceAudioQueryConfig(NPP id,
349 const NPDeviceConfig* request, 349 const NPDeviceConfig* request,
350 NPDeviceConfig* obtain) { 350 NPDeviceConfig* obtain) {
351 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); 351 scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id));
352 if (plugin) { 352 if (plugin) {
353 return plugin->webplugin()->delegate()->DeviceAudioQueryConfig( 353 return plugin->webplugin()->delegate()->DeviceAudioQueryConfig(
354 static_cast<const NPDeviceContextAudioConfig*>(request), 354 static_cast<const NPDeviceContextAudioConfig*>(request),
355 static_cast<NPDeviceContextAudioConfig*>(obtain)); 355 static_cast<NPDeviceContextAudioConfig*>(obtain));
356 } 356 }
357 return NPERR_GENERIC_ERROR; 357 return NPERR_GENERIC_ERROR;
358 } 358 }
359 359
360 static NPError DeviceAudioInitializeContext(NPP id, 360 static NPError DeviceAudioInitializeContext(NPP id,
361 const NPDeviceConfig* config, 361 const NPDeviceConfig* config,
362 NPDeviceContext* context) { 362 NPDeviceContext* context) {
363 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); 363 scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id));
364 if (plugin) { 364 if (plugin) {
365 return plugin->webplugin()->delegate()->DeviceAudioInitializeContext( 365 return plugin->webplugin()->delegate()->DeviceAudioInitializeContext(
366 static_cast<const NPDeviceContextAudioConfig*>(config), 366 static_cast<const NPDeviceContextAudioConfig*>(config),
367 static_cast<NPDeviceContextAudio*>(context)); 367 static_cast<NPDeviceContextAudio*>(context));
368 } 368 }
369 return NPERR_GENERIC_ERROR; 369 return NPERR_GENERIC_ERROR;
370 } 370 }
371 371
372 static NPError DeviceAudioSetStateContext(NPP id, 372 static NPError DeviceAudioSetStateContext(NPP id,
373 NPDeviceContext* context, 373 NPDeviceContext* context,
374 int32_t state, 374 int32_t state,
375 intptr_t value) { 375 intptr_t value) {
376 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); 376 scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id));
377 if (plugin) { 377 if (plugin) {
378 return plugin->webplugin()->delegate()->DeviceAudioSetStateContext( 378 return plugin->webplugin()->delegate()->DeviceAudioSetStateContext(
379 static_cast<NPDeviceContextAudio*>(context), state, value); 379 static_cast<NPDeviceContextAudio*>(context), state, value);
380 } 380 }
381 return NPERR_GENERIC_ERROR; 381 return NPERR_GENERIC_ERROR;
382 } 382 }
383 383
384 static NPError DeviceAudioGetStateContext(NPP id, 384 static NPError DeviceAudioGetStateContext(NPP id,
385 NPDeviceContext* context, 385 NPDeviceContext* context,
386 int32_t state, 386 int32_t state,
387 intptr_t* value) { 387 intptr_t* value) {
388 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); 388 scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id));
389 return plugin->webplugin()->delegate()->DeviceAudioGetStateContext( 389 return plugin->webplugin()->delegate()->DeviceAudioGetStateContext(
390 static_cast<NPDeviceContextAudio*>(context), state, value); 390 static_cast<NPDeviceContextAudio*>(context), state, value);
391 } 391 }
392 392
393 static NPError DeviceAudioFlushContext(NPP id, 393 static NPError DeviceAudioFlushContext(NPP id,
394 NPDeviceContext* context, 394 NPDeviceContext* context,
395 NPDeviceFlushContextCallbackPtr callback, 395 NPDeviceFlushContextCallbackPtr callback,
396 void* user_data) { 396 void* user_data) {
397 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); 397 scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id));
398 return plugin->webplugin()->delegate()->DeviceAudioFlushContext( 398 return plugin->webplugin()->delegate()->DeviceAudioFlushContext(
399 id, static_cast<NPDeviceContextAudio*>(context), callback, user_data); 399 id, static_cast<NPDeviceContextAudio*>(context), callback, user_data);
400 } 400 }
401 401
402 static NPError DeviceAudioDestroyContext(NPP id, 402 static NPError DeviceAudioDestroyContext(NPP id,
403 NPDeviceContext* context) { 403 NPDeviceContext* context) {
404 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); 404 scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id));
405 return plugin->webplugin()->delegate()->DeviceAudioDestroyContext( 405 return plugin->webplugin()->delegate()->DeviceAudioDestroyContext(
406 static_cast<NPDeviceContextAudio*>(context)); 406 static_cast<NPDeviceContextAudio*>(context));
407 } 407 }
408 // ----------------------------------------------------------------------------- 408 // -----------------------------------------------------------------------------
409 409
410 static NPDevice* AcquireDevice(NPP id, NPDeviceID device_id) { 410 static NPDevice* AcquireDevice(NPP id, NPDeviceID device_id) {
411 static NPDevice device_2d = { 411 static NPDevice device_2d = {
412 Device2DQueryCapability, 412 Device2DQueryCapability,
413 Device2DQueryConfig, 413 Device2DQueryConfig,
414 Device2DInitializeContext, 414 Device2DInitializeContext,
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 default: 470 default:
471 return NULL; 471 return NULL;
472 } 472 }
473 } 473 }
474 474
475 static NPError ChooseFile(NPP id, 475 static NPError ChooseFile(NPP id,
476 const char* mime_types, 476 const char* mime_types,
477 NPChooseFileMode mode, 477 NPChooseFileMode mode,
478 NPChooseFileCallback callback, 478 NPChooseFileCallback callback,
479 void* user_data) { 479 void* user_data) {
480 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); 480 scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id));
481 if (!plugin) 481 if (!plugin)
482 return NPERR_GENERIC_ERROR; 482 return NPERR_GENERIC_ERROR;
483 483
484 if (!plugin->webplugin()->delegate()->ChooseFile(mime_types, 484 if (!plugin->webplugin()->delegate()->ChooseFile(mime_types,
485 static_cast<int>(mode), 485 static_cast<int>(mode),
486 callback, user_data)) 486 callback, user_data))
487 return NPERR_GENERIC_ERROR; 487 return NPERR_GENERIC_ERROR;
488 488
489 return NPERR_NO_ERROR; 489 return NPERR_NO_ERROR;
490 } 490 }
491 491
492 static void NumberOfFindResultsChanged(NPP id, int total, bool final_result) { 492 static void NumberOfFindResultsChanged(NPP id, int total, bool final_result) {
493 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); 493 scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id));
494 if (plugin) { 494 if (plugin) {
495 plugin->webplugin()->delegate()->NumberOfFindResultsChanged( 495 plugin->webplugin()->delegate()->NumberOfFindResultsChanged(
496 total, final_result); 496 total, final_result);
497 } 497 }
498 } 498 }
499 499
500 static void SelectedFindResultChanged(NPP id, int index) { 500 static void SelectedFindResultChanged(NPP id, int index) {
501 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); 501 scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id));
502 if (plugin) 502 if (plugin)
503 plugin->webplugin()->delegate()->SelectedFindResultChanged(index); 503 plugin->webplugin()->delegate()->SelectedFindResultChanged(index);
504 } 504 }
505 505
506 static NPWidgetExtensions* GetWidgetExtensions(NPP id) { 506 static NPWidgetExtensions* GetWidgetExtensions(NPP id) {
507 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); 507 scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id));
508 if (!plugin) 508 if (!plugin)
509 return NULL; 509 return NULL;
510 510
511 return plugin->webplugin()->delegate()->GetWidgetExtensions(); 511 return plugin->webplugin()->delegate()->GetWidgetExtensions();
512 } 512 }
513 513
514 static NPError NPSetCursor(NPP id, NPCursorType type) { 514 static NPError NPSetCursor(NPP id, NPCursorType type) {
515 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); 515 scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id));
516 if (!plugin) 516 if (!plugin)
517 return NPERR_GENERIC_ERROR; 517 return NPERR_GENERIC_ERROR;
518 518
519 return plugin->webplugin()->delegate()->SetCursor(type) ? 519 return plugin->webplugin()->delegate()->SetCursor(type) ?
520 NPERR_NO_ERROR : NPERR_GENERIC_ERROR; 520 NPERR_NO_ERROR : NPERR_GENERIC_ERROR;
521 } 521 }
522 522
523 static NPFontExtensions* GetFontExtensions(NPP id) { 523 static NPFontExtensions* GetFontExtensions(NPP id) {
524 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); 524 scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id));
525 if (!plugin) 525 if (!plugin)
526 return NULL; 526 return NULL;
527 527
528 return plugin->webplugin()->delegate()->GetFontExtensions(); 528 return plugin->webplugin()->delegate()->GetFontExtensions();
529 } 529 }
530 530
531 namespace NPAPI { 531 namespace NPAPI {
532 532
533 NPError GetPepperExtensionsFunctions(void* value) { 533 NPError GetPepperExtensionsFunctions(void* value) {
534 static const NPNExtensions kExtensions = { 534 static const NPNExtensions kExtensions = {
535 &AcquireDevice, 535 &AcquireDevice,
536 &NumberOfFindResultsChanged, 536 &NumberOfFindResultsChanged,
537 &SelectedFindResultChanged, 537 &SelectedFindResultChanged,
538 &ChooseFile, 538 &ChooseFile,
539 &GetWidgetExtensions, 539 &GetWidgetExtensions,
540 &NPSetCursor, 540 &NPSetCursor,
541 &GetFontExtensions, 541 &GetFontExtensions,
542 }; 542 };
543 543
544 // Return a pointer to the canonical function table. 544 // Return a pointer to the canonical function table.
545 NPNExtensions* extensions = const_cast<NPNExtensions*>(&kExtensions); 545 NPNExtensions* extensions = const_cast<NPNExtensions*>(&kExtensions);
546 NPNExtensions** exts = reinterpret_cast<NPNExtensions**>(value); 546 NPNExtensions** exts = reinterpret_cast<NPNExtensions**>(value);
547 *exts = extensions; 547 *exts = extensions;
548 return NPERR_NO_ERROR; 548 return NPERR_NO_ERROR;
549 } 549 }
550 550
551 } // namespace NPAPI 551 } // namespace NPAPI
OLDNEW
« no previous file with comments | « webkit/glue/media/buffered_data_source_unittest.cc ('k') | webkit/glue/plugins/plugin_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698