| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #ifndef WEBKIT_GLUE_PLUGIN_PLUGIN_LIB_H__ | 5 #ifndef WEBKIT_GLUE_PLUGIN_PLUGIN_LIB_H__ |
| 6 #define WEBKIT_GLUE_PLUGIN_PLUGIN_LIB_H__ | 6 #define WEBKIT_GLUE_PLUGIN_PLUGIN_LIB_H__ |
| 7 | 7 |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 namespace NPAPI | 23 namespace NPAPI |
| 24 { | 24 { |
| 25 | 25 |
| 26 class PluginInstance; | 26 class PluginInstance; |
| 27 | 27 |
| 28 // This struct fully describes a plugin. For external plugins, it's read in from | 28 // This struct fully describes a plugin. For external plugins, it's read in from |
| 29 // the version info of the dll; For internal plugins, it's predefined and | 29 // the version info of the dll; For internal plugins, it's predefined and |
| 30 // includes addresses of entry functions. (Yes, it's Win32 NPAPI-centric, but | 30 // includes addresses of entry functions. (Yes, it's Win32 NPAPI-centric, but |
| 31 // it'll do for holding descriptions of internal plugins cross-platform.) | 31 // it'll do for holding descriptions of internal plugins cross-platform.) |
| 32 struct PluginVersionInfo { | 32 struct PluginVersionInfo { |
| 33 const FilePath::CharType* path; | 33 FilePath::StringType path; |
| 34 // Info about the plugin itself. | 34 // Info about the plugin itself. |
| 35 const wchar_t* product_name; | 35 std::wstring product_name; |
| 36 const wchar_t* file_description; | 36 std::wstring file_description; |
| 37 const wchar_t* file_version; | 37 std::wstring file_version; |
| 38 // Info about the data types that the plugin supports. | 38 // Info about the data types that the plugin supports. |
| 39 const wchar_t* mime_types; | 39 std::wstring mime_types; |
| 40 const wchar_t* file_extensions; | 40 std::wstring file_extensions; |
| 41 const wchar_t* type_descriptions; | 41 std::wstring type_descriptions; |
| 42 // Entry points for internal plugins, NULL for external ones. | 42 // Entry points for internal plugins, NULL for external ones. |
| 43 NP_GetEntryPointsFunc np_getentrypoints; | 43 NP_GetEntryPointsFunc np_getentrypoints; |
| 44 NP_InitializeFunc np_initialize; | 44 NP_InitializeFunc np_initialize; |
| 45 NP_ShutdownFunc np_shutdown; | 45 NP_ShutdownFunc np_shutdown; |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 // A PluginLib is a single NPAPI Plugin Library, and is the lifecycle | 48 // A PluginLib is a single NPAPI Plugin Library, and is the lifecycle |
| 49 // manager for new PluginInstances. | 49 // manager for new PluginInstances. |
| 50 class PluginLib : public base::RefCounted<PluginLib> { | 50 class PluginLib : public base::RefCounted<PluginLib> { |
| 51 public: | 51 public: |
| 52 static PluginLib* CreatePluginLib(const FilePath& filename); | 52 static PluginLib* CreatePluginLib(const FilePath& filename); |
| 53 virtual ~PluginLib(); | 53 virtual ~PluginLib(); |
| 54 | 54 |
| 55 // Register an internal plugin with the specified plugin information and |
| 56 // function pointers. An internal plugin must be registered before it can |
| 57 // be loaded using PluginList::LoadPlugin(). |
| 58 static void RegisterInternalPlugin(const PluginVersionInfo& info); |
| 59 |
| 55 // Creates a WebPluginInfo structure given a plugin's path. On success | 60 // Creates a WebPluginInfo structure given a plugin's path. On success |
| 56 // returns true, with the information being put into "info". If it's an | 61 // returns true, with the information being put into "info". If it's an |
| 57 // internal plugin, the function pointers are returned as well. | 62 // internal plugin, the function pointers are returned as well. |
| 58 // Returns false if the library couldn't be found, or if it's not a plugin. | 63 // Returns false if the library couldn't be found, or if it's not a plugin. |
| 59 static bool ReadWebPluginInfo(const FilePath& filename, | 64 static bool ReadWebPluginInfo(const FilePath& filename, |
| 60 WebPluginInfo* info, | 65 WebPluginInfo* info, |
| 61 NP_GetEntryPointsFunc* np_getentrypoints, | 66 NP_GetEntryPointsFunc* np_getentrypoints, |
| 62 NP_InitializeFunc* np_initialize, | 67 NP_InitializeFunc* np_initialize, |
| 63 NP_ShutdownFunc* np_shutdown); | 68 NP_ShutdownFunc* np_shutdown); |
| 64 | 69 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 NP_InitializeFunc NP_Initialize_; | 163 NP_InitializeFunc NP_Initialize_; |
| 159 NP_GetEntryPointsFunc NP_GetEntryPoints_; | 164 NP_GetEntryPointsFunc NP_GetEntryPoints_; |
| 160 NP_ShutdownFunc NP_Shutdown_; | 165 NP_ShutdownFunc NP_Shutdown_; |
| 161 | 166 |
| 162 DISALLOW_EVIL_CONSTRUCTORS(PluginLib); | 167 DISALLOW_EVIL_CONSTRUCTORS(PluginLib); |
| 163 }; | 168 }; |
| 164 | 169 |
| 165 } // namespace NPAPI | 170 } // namespace NPAPI |
| 166 | 171 |
| 167 #endif // WEBKIT_GLUE_PLUGIN_PLUGIN_LIB_H__ | 172 #endif // WEBKIT_GLUE_PLUGIN_PLUGIN_LIB_H__ |
| OLD | NEW |