1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/plugins/base/nsPluginsDir.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,75 @@ 1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#ifndef nsPluginsDir_h_ 1.10 +#define nsPluginsDir_h_ 1.11 + 1.12 +#include "nsError.h" 1.13 +#include "nsIFile.h" 1.14 + 1.15 +/** 1.16 + * nsPluginsDir is nearly obsolete. Directory Service should be used instead. 1.17 + * It exists for the sake of one static function. 1.18 + */ 1.19 + 1.20 +class nsPluginsDir { 1.21 +public: 1.22 + /** 1.23 + * Determines whether or not the given file is actually a plugin file. 1.24 + */ 1.25 + static bool IsPluginFile(nsIFile* file); 1.26 +}; 1.27 + 1.28 +struct PRLibrary; 1.29 + 1.30 +struct nsPluginInfo { 1.31 + char* fName; // name of the plugin 1.32 + char* fDescription; // etc. 1.33 + uint32_t fVariantCount; 1.34 + char** fMimeTypeArray; 1.35 + char** fMimeDescriptionArray; 1.36 + char** fExtensionArray; 1.37 + char* fFileName; 1.38 + char* fFullPath; 1.39 + char* fVersion; 1.40 +}; 1.41 + 1.42 +/** 1.43 + * Provides cross-platform access to a plugin file. Deals with reading 1.44 + * properties from the plugin file, and loading the plugin's shared 1.45 + * library. Insulates core nsIPluginHost implementations from these 1.46 + * details. 1.47 + */ 1.48 +class nsPluginFile { 1.49 + PRLibrary* pLibrary; 1.50 + nsCOMPtr<nsIFile> mPlugin; 1.51 +public: 1.52 + /** 1.53 + * If spec corresponds to a valid plugin file, constructs a reference 1.54 + * to a plugin file on disk. Plugins are typically located using the 1.55 + * nsPluginsDir class. 1.56 + */ 1.57 + nsPluginFile(nsIFile* spec); 1.58 + virtual ~nsPluginFile(); 1.59 + 1.60 + /** 1.61 + * Loads the plugin into memory using NSPR's shared-library loading 1.62 + * mechanism. Handles platform differences in loading shared libraries. 1.63 + */ 1.64 + nsresult LoadPlugin(PRLibrary **outLibrary); 1.65 + 1.66 + /** 1.67 + * Obtains all of the information currently available for this plugin. 1.68 + * Has a library outparam which will be non-null if a library load was required. 1.69 + */ 1.70 + nsresult GetPluginInfo(nsPluginInfo &outPluginInfo, PRLibrary **outLibrary); 1.71 + 1.72 + /** 1.73 + * Should be called after GetPluginInfo to free all allocated stuff 1.74 + */ 1.75 + nsresult FreePluginInfo(nsPluginInfo &PluginInfo); 1.76 +}; 1.77 + 1.78 +#endif /* nsPluginsDir_h_ */