diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-12 19:43:44 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-12 19:43:44 +0000 |
commit | b734450b86e9d6bd7a07b381c119ca91803ae46b (patch) | |
tree | 5099af8aa485c96af0c487e434bca5a0212f424e /webkit/glue/plugins/plugin_lib.h | |
parent | 64a02b8056c86576428022859baadbb9a7b929f1 (diff) | |
download | chromium_src-b734450b86e9d6bd7a07b381c119ca91803ae46b.zip chromium_src-b734450b86e9d6bd7a07b381c119ca91803ae46b.tar.gz chromium_src-b734450b86e9d6bd7a07b381c119ca91803ae46b.tar.bz2 |
Get rid of lowercasing plugin filenames in order to determine if two paths point to the same plugin. Check plugin versions and load the latest version if multiple versions are found.I've also refactored and cleaned PluginList so that it doesn't depend on PluginLib, which only made sense a long time ago when plugins were loaded in process. Now PluginLib will only be loaded in the plugin process (and not in the browser process as well).
Review URL: http://codereview.chromium.org/17451
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7888 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/plugins/plugin_lib.h')
-rw-r--r-- | webkit/glue/plugins/plugin_lib.h | 56 |
1 files changed, 25 insertions, 31 deletions
diff --git a/webkit/glue/plugins/plugin_lib.h b/webkit/glue/plugins/plugin_lib.h index cd3db97..884f235 100644 --- a/webkit/glue/plugins/plugin_lib.h +++ b/webkit/glue/plugins/plugin_lib.h @@ -8,13 +8,14 @@ #include "build/build_config.h" #include <string> +#include <vector> #include "base/basictypes.h" #include "base/file_path.h" -#include "base/hash_tables.h" #include "base/ref_counted.h" #include "base/scoped_ptr.h" #include "webkit/glue/plugins/nphostapi.h" +#include "webkit/glue/webplugin.h" #include "third_party/npapi/bindings/npapi.h" struct WebPluginInfo; @@ -27,7 +28,8 @@ class PluginInstance; // This struct fully describes a plugin. For external plugins, it's read in from // the version info of the dll; For internal plugins, it's predefined. struct PluginVersionInfo { - std::wstring file_name; + std::wstring filename; + std::wstring path; std::wstring product_name; std::wstring file_description; std::wstring file_version; @@ -49,8 +51,13 @@ struct InternalPluginInfo { // manager for new PluginInstances. class PluginLib : public base::RefCounted<PluginLib> { public: + static PluginLib* PluginLib::CreatePluginLib(const FilePath& filename); virtual ~PluginLib(); - static PluginLib* CreatePluginLib(const FilePath& filename); + + // Creates a WebPluginInfo structure given a plugin's path. On success + // returns true, with the information being put into "info". Returns false if + // the library couldn't be found, or if it's not a plugin. + static bool ReadWebPluginInfo(const FilePath &filename, WebPluginInfo* info); // Unloads all the loaded plugin libraries and cleans up the plugin map. static void UnloadAllPlugins(); @@ -61,10 +68,6 @@ class PluginLib : public base::RefCounted<PluginLib> { // Get the Plugin's function pointer table. NPPluginFuncs *functions(); - // Returns true if this Plugin supports a given mime-type. - // mime_type should be all lower case. - bool SupportsType(const std::string &mime_type, bool allow_wildcard); - // Creates a new instance of this plugin. PluginInstance *CreateInstance(const std::string &mime_type); @@ -73,7 +76,7 @@ class PluginLib : public base::RefCounted<PluginLib> { // Gets information about this plugin and the mime types that it // supports. - const WebPluginInfo& plugin_info() { return *web_plugin_info_; } + const WebPluginInfo& plugin_info() { return web_plugin_info_; } // // NPAPI functions @@ -95,11 +98,8 @@ class PluginLib : public base::RefCounted<PluginLib> { int instance_count() const { return instance_count_; } private: - // Creates a new PluginLib. The WebPluginInfo object is owned by this - // object. If internal_plugin_info is not NULL, this Lib is an internal - // plugin thus doesn't need to load a library. - PluginLib(WebPluginInfo* info, - const InternalPluginInfo* internal_plugin_info); + // Creates a new PluginLib + PluginLib(const WebPluginInfo& info); // Attempts to load the plugin from the library. // Returns true if it is a legitimate plugin, false otherwise @@ -111,31 +111,25 @@ class PluginLib : public base::RefCounted<PluginLib> { // Shutdown the plugin library. void Shutdown(); - // Returns a WebPluginInfo structure given a plugin's path. Returns NULL if - // the library couldn't be found, or if it's not a plugin. - static WebPluginInfo* ReadWebPluginInfo(const FilePath &filename); // Creates WebPluginInfo structure based on read in or built in // PluginVersionInfo. - static WebPluginInfo* CreateWebPluginInfo(const PluginVersionInfo& info); + static bool CreateWebPluginInfo(const PluginVersionInfo& pvi, + WebPluginInfo* info); - bool internal_; // Whether this an internal plugin. - scoped_ptr<WebPluginInfo> web_plugin_info_; // supported mime types, description + bool internal_; // Whether this an internal plugin. + WebPluginInfo web_plugin_info_; // supported mime types, description #if defined(OS_WIN) - HMODULE module_; // the opened DLL handle + HMODULE module_; // the opened DLL handle #endif - NPPluginFuncs plugin_funcs_; // the struct of plugin side functions - bool initialized_; // is the plugin initialized - NPSavedData *saved_data_; // persisted plugin info for NPAPI - int instance_count_; // count of plugins in use - - // A map of all the instantiated plugins. - typedef base::hash_map<FilePath, scoped_refptr<PluginLib> > PluginMap; - static PluginMap* loaded_libs_; + NPPluginFuncs plugin_funcs_; // the struct of plugin side functions + bool initialized_; // is the plugin initialized + NPSavedData *saved_data_; // persisted plugin info for NPAPI + int instance_count_; // count of plugins in use // C-style function pointers - NP_InitializeFunc NP_Initialize_; - NP_GetEntryPointsFunc NP_GetEntryPoints_; - NP_ShutdownFunc NP_Shutdown_; + NP_InitializeFunc NP_Initialize_; + NP_GetEntryPointsFunc NP_GetEntryPoints_; + NP_ShutdownFunc NP_Shutdown_; DISALLOW_EVIL_CONSTRUCTORS(PluginLib); }; |