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