dom/plugins/base/nsPluginsDir.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial