1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
15 * The Original Code is mozilla.org code.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
23 * Josh Aas <josh@mozilla.com>
25 * Alternatively, the contents of this file may be used under the terms of
26 * either the GNU General Public License Version 2 or later (the "GPL"), or
27 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 * in which case the provisions of the GPL or the LGPL are applicable instead
29 * of those above. If you wish to allow use of your version of this file only
30 * under the terms of either the GPL or the LGPL, and not to allow others to
31 * use your version of this file under the terms of the MPL, indicate your
32 * decision by deleting the provisions above and replace them with the notice
33 * and other provisions required by the GPL or the LGPL. If you do not delete
34 * the provisions above, a recipient may use your version of this file under
35 * the terms of any one of the MPL, the GPL or the LGPL.
37 * ***** END LICENSE BLOCK ***** */
39 #ifndef nsPluginTags_h_
40 #define nsPluginTags_h_
44 #include "nsAutoPtr.h"
46 #include "nsCOMArray.h"
47 #include "nsIPluginTag.h"
48 #include "nsIPlugin.h"
49 #include "nsNPAPIPluginInstance.h"
50 #include "nsISupportsArray.h"
56 // Remember that flags are written out to pluginreg.dat, be careful
57 // changing their meaning.
58 #define NS_PLUGIN_FLAG_ENABLED 0x0001 // is this plugin enabled?
59 // no longer used 0x0002 // reuse only if regenerating pluginreg.dat
60 #define NS_PLUGIN_FLAG_FROMCACHE 0x0004 // this plugintag info was loaded from cache
61 #define NS_PLUGIN_FLAG_UNWANTED 0x0008 // this is an unwanted plugin
62 #define NS_PLUGIN_FLAG_BLOCKLISTED 0x0010 // this is a blocklisted plugin
64 // A linked-list of plugin information that is used for instantiating plugins
65 // and reflecting plugin information into JavaScript.
66 class nsPluginTag
: public nsIPluginTag
77 nsPluginTag(nsPluginTag
* aPluginTag
);
78 nsPluginTag(nsPluginInfo
* aPluginInfo
);
79 nsPluginTag(const char* aName
,
80 const char* aDescription
,
81 const char* aFileName
,
82 const char* aFullPath
,
84 const char* const* aMimeTypes
,
85 const char* const* aMimeDescriptions
,
86 const char* const* aExtensions
,
88 PRInt64 aLastModifiedTime
= 0,
89 PRBool aCanUnload
= PR_TRUE
,
90 PRBool aArgsAreUTF8
= PR_FALSE
);
93 void SetHost(nsPluginHost
* aHost
);
94 void TryUnloadPlugin();
95 void Mark(PRUint32 mask
);
96 void UnMark(PRUint32 mask
);
97 PRBool
HasFlag(PRUint32 flag
);
99 PRBool
Equals(nsPluginTag
* aPluginTag
);
101 void RegisterWithCategoryManager(PRBool aOverrideInternalTypes
,
102 nsRegisterType aType
= ePluginRegister
);
104 nsRefPtr
<nsPluginTag
> mNext
;
105 nsPluginHost
*mPluginHost
;
106 nsCString mName
; // UTF-8
107 nsCString mDescription
; // UTF-8
109 char **mMimeTypeArray
;
110 nsTArray
<nsCString
> mMimeDescriptionArray
; // UTF-8
111 char **mExtensionsArray
;
113 nsCOMPtr
<nsIPlugin
> mEntryPoint
;
114 PRPackedBool mCanUnloadLibrary
;
115 PRPackedBool mIsJavaPlugin
;
116 PRPackedBool mIsNPRuntimeEnabledJavaPlugin
;
117 nsCString mFileName
; // UTF-8
118 nsCString mFullPath
; // UTF-8
119 nsCString mVersion
; // UTF-8
120 PRInt64 mLastModifiedTime
;
124 nsresult
EnsureMembersAreUTF8();
127 struct nsPluginInstanceTag
130 nsRefPtr
<nsPluginTag
> mPluginTag
;
131 nsNPAPIPluginInstance
* mInstance
; // this must always be valid
132 // Array holding all opened stream listeners for this entry
133 nsCOMArray
<nsIPluginStreamInfo
> mStreams
;
135 nsPluginInstanceTag(nsPluginTag
* aPluginTag
,
136 nsIPluginInstance
* aInstance
,
138 ~nsPluginInstanceTag();
141 #endif // nsPluginTags_h_