2001-09-26 02:43:09 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04: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/. */
|
1999-04-20 23:18:51 +04:00
|
|
|
|
|
|
|
#ifndef nsPluginArray_h___
|
|
|
|
#define nsPluginArray_h___
|
|
|
|
|
2011-05-21 17:28:54 +04:00
|
|
|
#include "nsCOMPtr.h"
|
1999-04-20 23:18:51 +04:00
|
|
|
#include "nsIDOMPluginArray.h"
|
|
|
|
#include "nsIDOMPlugin.h"
|
2001-04-05 02:13:04 +04:00
|
|
|
#include "nsIPluginHost.h"
|
2001-08-10 05:12:05 +04:00
|
|
|
#include "nsIURL.h"
|
2011-12-01 12:28:16 +04:00
|
|
|
#include "nsWeakReference.h"
|
1999-04-20 23:18:51 +04:00
|
|
|
|
2011-11-02 17:44:16 +04:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
class Navigator;
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2001-01-24 01:29:41 +03:00
|
|
|
class nsIDocShell;
|
1999-04-20 23:18:51 +04:00
|
|
|
|
2011-11-02 17:44:16 +04:00
|
|
|
// NB: Due to weak references, Navigator has intimate knowledge of our
|
2010-08-13 08:05:05 +04:00
|
|
|
// internals.
|
2008-09-06 01:54:53 +04:00
|
|
|
class nsPluginArray : public nsIDOMPluginArray
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 21:42:36 +04:00
|
|
|
{
|
1999-04-20 23:18:51 +04:00
|
|
|
public:
|
2011-11-02 17:44:16 +04:00
|
|
|
nsPluginArray(mozilla::dom::Navigator* navigator, nsIDocShell *aDocShell);
|
2004-12-10 22:48:22 +03:00
|
|
|
virtual ~nsPluginArray();
|
1999-04-20 23:18:51 +04:00
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 21:42:36 +04:00
|
|
|
// nsIDOMPluginArray
|
|
|
|
NS_DECL_NSIDOMPLUGINARRAY
|
1999-04-20 23:18:51 +04:00
|
|
|
|
2001-04-05 02:13:04 +04:00
|
|
|
nsresult GetPluginHost(nsIPluginHost** aPluginHost);
|
|
|
|
|
2008-10-22 18:31:14 +04:00
|
|
|
nsIDOMPlugin* GetItemAt(PRUint32 aIndex, nsresult* aResult);
|
2008-11-01 00:40:35 +03:00
|
|
|
nsIDOMPlugin* GetNamedItem(const nsAString& aName, nsresult* aResult);
|
2008-10-22 18:31:14 +04:00
|
|
|
|
|
|
|
static nsPluginArray* FromSupports(nsISupports* aSupports)
|
|
|
|
{
|
|
|
|
#ifdef DEBUG
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsIDOMPluginArray> array_qi = do_QueryInterface(aSupports);
|
|
|
|
|
|
|
|
// If this assertion fires the QI implementation for the object in
|
|
|
|
// question doesn't use the nsIDOMPluginArray pointer as the nsISupports
|
|
|
|
// pointer. That must be fixed, or we'll crash...
|
|
|
|
NS_ASSERTION(array_qi == static_cast<nsIDOMPluginArray*>(aSupports),
|
|
|
|
"Uh, fix QI!");
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return static_cast<nsPluginArray*>(aSupports);
|
|
|
|
}
|
|
|
|
|
1999-04-20 23:18:51 +04:00
|
|
|
private:
|
|
|
|
nsresult GetPlugins();
|
2011-09-29 10:19:26 +04:00
|
|
|
bool AllowPlugins();
|
1999-04-20 23:18:51 +04:00
|
|
|
|
2001-01-24 01:29:41 +03:00
|
|
|
public:
|
2010-08-13 08:05:05 +04:00
|
|
|
void Invalidate();
|
2001-01-24 01:29:41 +03:00
|
|
|
|
1999-04-20 23:18:51 +04:00
|
|
|
protected:
|
2011-11-02 17:44:16 +04:00
|
|
|
mozilla::dom::Navigator* mNavigator;
|
2001-04-05 02:13:04 +04:00
|
|
|
nsCOMPtr<nsIPluginHost> mPluginHost;
|
1999-04-20 23:18:51 +04:00
|
|
|
PRUint32 mPluginCount;
|
|
|
|
nsIDOMPlugin** mPluginArray;
|
2011-12-01 12:28:16 +04:00
|
|
|
nsWeakPtr mDocShell;
|
1999-04-20 23:18:51 +04:00
|
|
|
};
|
|
|
|
|
2004-12-10 22:48:22 +03:00
|
|
|
class nsPluginElement : public nsIDOMPlugin
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 21:42:36 +04:00
|
|
|
{
|
1999-04-20 23:18:51 +04:00
|
|
|
public:
|
2004-12-10 22:48:22 +03:00
|
|
|
nsPluginElement(nsIDOMPlugin* plugin);
|
|
|
|
virtual ~nsPluginElement();
|
1999-04-20 23:18:51 +04:00
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
2007-01-25 02:31:12 +03:00
|
|
|
NS_DECL_NSIDOMPLUGIN
|
1999-04-20 23:18:51 +04:00
|
|
|
|
2008-10-22 18:31:14 +04:00
|
|
|
nsIDOMMimeType* GetItemAt(PRUint32 aIndex, nsresult* aResult);
|
2008-11-01 00:40:35 +03:00
|
|
|
nsIDOMMimeType* GetNamedItem(const nsAString& aName, nsresult* aResult);
|
2008-10-22 18:31:14 +04:00
|
|
|
|
|
|
|
static nsPluginElement* FromSupports(nsISupports* aSupports)
|
|
|
|
{
|
|
|
|
#ifdef DEBUG
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsIDOMPlugin> plugin_qi = do_QueryInterface(aSupports);
|
|
|
|
|
|
|
|
// If this assertion fires the QI implementation for the object in
|
|
|
|
// question doesn't use the nsIDOMPlugin pointer as the nsISupports
|
|
|
|
// pointer. That must be fixed, or we'll crash...
|
|
|
|
NS_ASSERTION(plugin_qi == static_cast<nsIDOMPlugin*>(aSupports),
|
|
|
|
"Uh, fix QI!");
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return static_cast<nsPluginElement*>(aSupports);
|
|
|
|
}
|
|
|
|
|
1999-04-20 23:18:51 +04:00
|
|
|
private:
|
|
|
|
nsresult GetMimeTypes();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
nsIDOMPlugin* mPlugin;
|
|
|
|
PRUint32 mMimeTypeCount;
|
|
|
|
nsIDOMMimeType** mMimeTypeArray;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* nsPluginArray_h___ */
|