Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes | Protected Attributes | Private Member Functions
nsPluginArray Class Reference

#include <nsPluginArray.h>

Inheritance diagram for nsPluginArray:
Inheritance graph
Collaboration diagram for nsPluginArray:
Collaboration graph

List of all members.

Public Member Functions

 nsPluginArray (nsNavigator *navigator, nsIDocShell *aDocShell)
virtual ~nsPluginArray ()
GetPluginHost (nsIPluginHost **aPluginHost)
void SetDocShell (nsIDocShell *aDocShell)
nsIDOMPlugin item (in unsigned long index)
nsIDOMPlugin namedItem (in DOMString name)
void refresh (in boolean reloadDocuments)
void refresh ()

Public Attributes

readonly attribute unsigned long length

Protected Attributes

nsCOMPtr< nsIPluginHostmPluginHost
PRUint32 mPluginCount
nsIDOMPlugin ** mPluginArray

Private Member Functions

nsresult GetPlugins ()
PRBool AllowPlugins ()

Detailed Description

Definition at line 50 of file nsPluginArray.h.

Constructor & Destructor Documentation

nsPluginArray::nsPluginArray ( nsNavigator navigator,
nsIDocShell aDocShell 

Definition at line 56 of file nsPluginArray.cpp.

  nsresult rv;
  mNavigator = navigator; // don't ADDREF here, needed for parent of script object.
  mPluginHost = do_GetService(kPluginManagerCID, &rv);
  mPluginCount = 0;
  mPluginArray = nsnull;
  mDocShell = aDocShell;

Here is the call graph for this function:

Definition at line 67 of file nsPluginArray.cpp.

  if (mPluginArray != nsnull) {
    for (PRUint32 i = 0; i < mPluginCount; i++) {
    delete[] mPluginArray;

Member Function Documentation

Definition at line 99 of file nsPluginArray.cpp.

  PRBool allowPlugins = PR_FALSE;
  if (mDocShell)
    if (NS_FAILED(mDocShell->GetAllowPlugins(&allowPlugins)))
      allowPlugins = PR_FALSE;

  return allowPlugins;

Definition at line 163 of file nsPluginArray.cpp.


  nsresult rv = NS_OK;

  if (!mPluginHost) {
    mPluginHost = do_GetService(kPluginManagerCID, &rv);

    if (NS_FAILED(rv)) {
      return rv;

  *aPluginHost = mPluginHost;

  return rv;

Here is the call graph for this function:

Definition at line 280 of file nsPluginArray.cpp.

  nsresult rv = GetLength(&mPluginCount);
  if (NS_SUCCEEDED(rv)) {
    mPluginArray = new nsIDOMPlugin*[mPluginCount];
    if (!mPluginArray)
      return NS_ERROR_OUT_OF_MEMORY;

    if (!mPluginCount)
      return NS_OK;

    rv = mPluginHost->GetPlugins(mPluginCount, mPluginArray);
    if (NS_SUCCEEDED(rv)) {
      // need to wrap each of these with a nsPluginElement, which
      // is scriptable.
      for (PRUint32 i = 0; i < mPluginCount; i++) {
        nsIDOMPlugin* wrapper = new nsPluginElement(mPluginArray[i]);
        mPluginArray[i] = wrapper;
    } else {
      /* XXX this code is all broken. If GetPlugins fails, there's no contract
       *     explaining what should happen. Instead of deleting elements in an
       *     array of random pointers, we mark the array as 0 length.
      mPluginCount = 0;
  return rv;
nsIDOMPlugin nsIDOMPluginArray::item ( in unsigned long  index) [inherited]
nsIDOMPlugin nsIDOMPluginArray::namedItem ( in DOMString  name) [inherited]
void nsIDOMPluginArray::refresh ( in boolean  reloadDocuments) [inherited]

Definition at line 184 of file nsPluginArray.cpp.

  mDocShell = aDocShell;

Member Data Documentation

readonly attribute unsigned long nsIDOMPluginArray::length [inherited]

Definition at line 45 of file nsIDOMPluginArray.idl.

Definition at line 79 of file nsPluginArray.h.

Definition at line 75 of file nsPluginArray.h.

Definition at line 78 of file nsPluginArray.h.

Definition at line 77 of file nsPluginArray.h.

Definition at line 76 of file nsPluginArray.h.

The documentation for this class was generated from the following files: