michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nsPluginsDir_h_ michael@0: #define nsPluginsDir_h_ michael@0: michael@0: #include "nsError.h" michael@0: #include "nsIFile.h" michael@0: michael@0: /** michael@0: * nsPluginsDir is nearly obsolete. Directory Service should be used instead. michael@0: * It exists for the sake of one static function. michael@0: */ michael@0: michael@0: class nsPluginsDir { michael@0: public: michael@0: /** michael@0: * Determines whether or not the given file is actually a plugin file. michael@0: */ michael@0: static bool IsPluginFile(nsIFile* file); michael@0: }; michael@0: michael@0: struct PRLibrary; michael@0: michael@0: struct nsPluginInfo { michael@0: char* fName; // name of the plugin michael@0: char* fDescription; // etc. michael@0: uint32_t fVariantCount; michael@0: char** fMimeTypeArray; michael@0: char** fMimeDescriptionArray; michael@0: char** fExtensionArray; michael@0: char* fFileName; michael@0: char* fFullPath; michael@0: char* fVersion; michael@0: }; michael@0: michael@0: /** michael@0: * Provides cross-platform access to a plugin file. Deals with reading michael@0: * properties from the plugin file, and loading the plugin's shared michael@0: * library. Insulates core nsIPluginHost implementations from these michael@0: * details. michael@0: */ michael@0: class nsPluginFile { michael@0: PRLibrary* pLibrary; michael@0: nsCOMPtr mPlugin; michael@0: public: michael@0: /** michael@0: * If spec corresponds to a valid plugin file, constructs a reference michael@0: * to a plugin file on disk. Plugins are typically located using the michael@0: * nsPluginsDir class. michael@0: */ michael@0: nsPluginFile(nsIFile* spec); michael@0: virtual ~nsPluginFile(); michael@0: michael@0: /** michael@0: * Loads the plugin into memory using NSPR's shared-library loading michael@0: * mechanism. Handles platform differences in loading shared libraries. michael@0: */ michael@0: nsresult LoadPlugin(PRLibrary **outLibrary); michael@0: michael@0: /** michael@0: * Obtains all of the information currently available for this plugin. michael@0: * Has a library outparam which will be non-null if a library load was required. michael@0: */ michael@0: nsresult GetPluginInfo(nsPluginInfo &outPluginInfo, PRLibrary **outLibrary); michael@0: michael@0: /** michael@0: * Should be called after GetPluginInfo to free all allocated stuff michael@0: */ michael@0: nsresult FreePluginInfo(nsPluginInfo &PluginInfo); michael@0: }; michael@0: michael@0: #endif /* nsPluginsDir_h_ */