OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #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 "third_party/npapi/bindings/npapi_extensions.h" | 8 #include "third_party/npapi/bindings/npapi_extensions.h" |
9 #include "webkit/glue/plugins/plugin_instance.h" | 9 #include "webkit/glue/plugins/plugin_instance.h" |
10 #include "webkit/glue/webplugin.h" | 10 #include "webkit/glue/webplugin.h" |
11 #include "webkit/glue/webplugin_delegate.h" | 11 #include "webkit/glue/webplugin_delegate.h" |
12 //#include "third_party/npapi/bindings/npruntime.h" | |
13 | 12 |
14 #if defined(ENABLE_PEPPER) | |
15 | 13 |
16 // FindInstance() | 14 // FindInstance() |
17 // Finds a PluginInstance from an NPP. | 15 // Finds a PluginInstance from an NPP. |
18 // The caller must take a reference if needed. | 16 // The caller must take a reference if needed. |
19 static NPAPI::PluginInstance* FindInstance(NPP id) { | 17 static NPAPI::PluginInstance* FindInstance(NPP id) { |
20 if (id == NULL) { | 18 if (id == NULL) { |
21 NOTREACHED(); | 19 NOTREACHED(); |
22 return NULL; | 20 return NULL; |
23 } | 21 } |
24 return static_cast<NPAPI::PluginInstance*>(id->ndata); | 22 return static_cast<NPAPI::PluginInstance*>(id->ndata); |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 }; | 236 }; |
239 | 237 |
240 // Return a pointer to the canonical function table. | 238 // Return a pointer to the canonical function table. |
241 NPExtensions* extensions = const_cast<NPExtensions*>(&kExtensions); | 239 NPExtensions* extensions = const_cast<NPExtensions*>(&kExtensions); |
242 NPExtensions** exts = reinterpret_cast<NPExtensions**>(value); | 240 NPExtensions** exts = reinterpret_cast<NPExtensions**>(value); |
243 *exts = extensions; | 241 *exts = extensions; |
244 return NPERR_NO_ERROR; | 242 return NPERR_NO_ERROR; |
245 } | 243 } |
246 | 244 |
247 } // namespace NPAPI | 245 } // namespace NPAPI |
248 | |
249 #else // Not compiling with pepper support | |
250 | |
251 namespace NPAPI { | |
252 | |
253 // This NOP function implements the getter for the extensions when the | |
254 // extensions aren't available. | |
255 NPError GetPepperExtensionsFunctions(void* value) { | |
256 return NPERR_GENERIC_ERROR; | |
257 } | |
258 | |
259 } // namespace NPAPI | |
260 | |
261 #endif // defined(ENABLE_PEPPER) | |
262 | |
OLD | NEW |