dom/plugins/base/nsPluginsDir.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #ifndef nsPluginsDir_h_
michael@0 7 #define nsPluginsDir_h_
michael@0 8
michael@0 9 #include "nsError.h"
michael@0 10 #include "nsIFile.h"
michael@0 11
michael@0 12 /**
michael@0 13 * nsPluginsDir is nearly obsolete. Directory Service should be used instead.
michael@0 14 * It exists for the sake of one static function.
michael@0 15 */
michael@0 16
michael@0 17 class nsPluginsDir {
michael@0 18 public:
michael@0 19 /**
michael@0 20 * Determines whether or not the given file is actually a plugin file.
michael@0 21 */
michael@0 22 static bool IsPluginFile(nsIFile* file);
michael@0 23 };
michael@0 24
michael@0 25 struct PRLibrary;
michael@0 26
michael@0 27 struct nsPluginInfo {
michael@0 28 char* fName; // name of the plugin
michael@0 29 char* fDescription; // etc.
michael@0 30 uint32_t fVariantCount;
michael@0 31 char** fMimeTypeArray;
michael@0 32 char** fMimeDescriptionArray;
michael@0 33 char** fExtensionArray;
michael@0 34 char* fFileName;
michael@0 35 char* fFullPath;
michael@0 36 char* fVersion;
michael@0 37 };
michael@0 38
michael@0 39 /**
michael@0 40 * Provides cross-platform access to a plugin file. Deals with reading
michael@0 41 * properties from the plugin file, and loading the plugin's shared
michael@0 42 * library. Insulates core nsIPluginHost implementations from these
michael@0 43 * details.
michael@0 44 */
michael@0 45 class nsPluginFile {
michael@0 46 PRLibrary* pLibrary;
michael@0 47 nsCOMPtr<nsIFile> mPlugin;
michael@0 48 public:
michael@0 49 /**
michael@0 50 * If spec corresponds to a valid plugin file, constructs a reference
michael@0 51 * to a plugin file on disk. Plugins are typically located using the
michael@0 52 * nsPluginsDir class.
michael@0 53 */
michael@0 54 nsPluginFile(nsIFile* spec);
michael@0 55 virtual ~nsPluginFile();
michael@0 56
michael@0 57 /**
michael@0 58 * Loads the plugin into memory using NSPR's shared-library loading
michael@0 59 * mechanism. Handles platform differences in loading shared libraries.
michael@0 60 */
michael@0 61 nsresult LoadPlugin(PRLibrary **outLibrary);
michael@0 62
michael@0 63 /**
michael@0 64 * Obtains all of the information currently available for this plugin.
michael@0 65 * Has a library outparam which will be non-null if a library load was required.
michael@0 66 */
michael@0 67 nsresult GetPluginInfo(nsPluginInfo &outPluginInfo, PRLibrary **outLibrary);
michael@0 68
michael@0 69 /**
michael@0 70 * Should be called after GetPluginInfo to free all allocated stuff
michael@0 71 */
michael@0 72 nsresult FreePluginInfo(nsPluginInfo &PluginInfo);
michael@0 73 };
michael@0 74
michael@0 75 #endif /* nsPluginsDir_h_ */

mercurial