| 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" |
| 12 | 13 |
| 14 #if defined(ENABLE_PEPPER) |
| 13 | 15 |
| 14 // FindInstance() | 16 // FindInstance() |
| 15 // Finds a PluginInstance from an NPP. | 17 // Finds a PluginInstance from an NPP. |
| 16 // The caller must take a reference if needed. | 18 // The caller must take a reference if needed. |
| 17 static NPAPI::PluginInstance* FindInstance(NPP id) { | 19 static NPAPI::PluginInstance* FindInstance(NPP id) { |
| 18 if (id == NULL) { | 20 if (id == NULL) { |
| 19 NOTREACHED(); | 21 NOTREACHED(); |
| 20 return NULL; | 22 return NULL; |
| 21 } | 23 } |
| 22 return static_cast<NPAPI::PluginInstance*>(id->ndata); | 24 return static_cast<NPAPI::PluginInstance*>(id->ndata); |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 }; | 238 }; |
| 237 | 239 |
| 238 // Return a pointer to the canonical function table. | 240 // Return a pointer to the canonical function table. |
| 239 NPExtensions* extensions = const_cast<NPExtensions*>(&kExtensions); | 241 NPExtensions* extensions = const_cast<NPExtensions*>(&kExtensions); |
| 240 NPExtensions** exts = reinterpret_cast<NPExtensions**>(value); | 242 NPExtensions** exts = reinterpret_cast<NPExtensions**>(value); |
| 241 *exts = extensions; | 243 *exts = extensions; |
| 242 return NPERR_NO_ERROR; | 244 return NPERR_NO_ERROR; |
| 243 } | 245 } |
| 244 | 246 |
| 245 } // namespace NPAPI | 247 } // 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 |