2001-09-25 22:43:09 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 11:12:37 +00: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 19:18:51 +00:00
|
|
|
|
|
|
|
#ifndef nsPluginArray_h___
|
|
|
|
#define nsPluginArray_h___
|
|
|
|
|
2011-05-21 13:28:54 +00:00
|
|
|
#include "nsCOMPtr.h"
|
1999-04-20 19:18:51 +00:00
|
|
|
#include "nsIDOMPluginArray.h"
|
|
|
|
#include "nsIDOMPlugin.h"
|
2001-04-04 22:13:04 +00:00
|
|
|
#include "nsIPluginHost.h"
|
2001-08-10 01:12:05 +00:00
|
|
|
#include "nsIURL.h"
|
2011-12-01 08:28:16 +00:00
|
|
|
#include "nsWeakReference.h"
|
1999-04-20 19:18:51 +00:00
|
|
|
|
2011-11-02 13:44:16 +00:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
class Navigator;
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2001-01-23 22:29:41 +00:00
|
|
|
class nsIDocShell;
|
1999-04-20 19:18:51 +00:00
|
|
|
|
2011-11-02 13:44:16 +00:00
|
|
|
// NB: Due to weak references, Navigator has intimate knowledge of our
|
2010-08-13 04:05:05 +00:00
|
|
|
// internals.
|
2008-09-05 21:54:53 +00: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 17:42:36 +00:00
|
|
|
{
|
1999-04-20 19:18:51 +00:00
|
|
|
public:
|
2011-11-02 13:44:16 +00:00
|
|
|
nsPluginArray(mozilla::dom::Navigator* navigator, nsIDocShell *aDocShell);
|
2004-12-10 19:48:22 +00:00
|
|
|
virtual ~nsPluginArray();
|
1999-04-20 19:18:51 +00: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 17:42:36 +00:00
|
|
|
// nsIDOMPluginArray
|
|
|
|
NS_DECL_NSIDOMPLUGINARRAY
|
1999-04-20 19:18:51 +00:00
|
|
|
|
2001-04-04 22:13:04 +00:00
|
|
|
nsresult GetPluginHost(nsIPluginHost** aPluginHost);
|
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
nsIDOMPlugin* GetItemAt(uint32_t aIndex, nsresult* aResult);
|
2008-10-31 21:40:35 +00:00
|
|
|
nsIDOMPlugin* GetNamedItem(const nsAString& aName, nsresult* aResult);
|
2008-10-22 14:31:14 +00: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 19:18:51 +00:00
|
|
|
private:
|
|
|
|
nsresult GetPlugins();
|
2011-09-29 06:19:26 +00:00
|
|
|
bool AllowPlugins();
|
1999-04-20 19:18:51 +00:00
|
|
|
|
2001-01-23 22:29:41 +00:00
|
|
|
public:
|
2010-08-13 04:05:05 +00:00
|
|
|
void Invalidate();
|
2001-01-23 22:29:41 +00:00
|
|
|
|
1999-04-20 19:18:51 +00:00
|
|
|
protected:
|
2011-11-02 13:44:16 +00:00
|
|
|
mozilla::dom::Navigator* mNavigator;
|
2001-04-04 22:13:04 +00:00
|
|
|
nsCOMPtr<nsIPluginHost> mPluginHost;
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t mPluginCount;
|
1999-04-20 19:18:51 +00:00
|
|
|
nsIDOMPlugin** mPluginArray;
|
2011-12-01 08:28:16 +00:00
|
|
|
nsWeakPtr mDocShell;
|
1999-04-20 19:18:51 +00:00
|
|
|
};
|
|
|
|
|
2004-12-10 19:48:22 +00: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 17:42:36 +00:00
|
|
|
{
|
1999-04-20 19:18:51 +00:00
|
|
|
public:
|
2004-12-10 19:48:22 +00:00
|
|
|
nsPluginElement(nsIDOMPlugin* plugin);
|
|
|
|
virtual ~nsPluginElement();
|
1999-04-20 19:18:51 +00:00
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
2007-01-24 23:31:12 +00:00
|
|
|
NS_DECL_NSIDOMPLUGIN
|
1999-04-20 19:18:51 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
nsIDOMMimeType* GetItemAt(uint32_t aIndex, nsresult* aResult);
|
2008-10-31 21:40:35 +00:00
|
|
|
nsIDOMMimeType* GetNamedItem(const nsAString& aName, nsresult* aResult);
|
2008-10-22 14:31:14 +00: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 19:18:51 +00:00
|
|
|
private:
|
|
|
|
nsresult GetMimeTypes();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
nsIDOMPlugin* mPlugin;
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t mMimeTypeCount;
|
1999-04-20 19:18:51 +00:00
|
|
|
nsIDOMMimeType** mMimeTypeArray;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* nsPluginArray_h___ */
|