Back to index

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

#include <nsXBLDocumentInfo.h>

Inheritance diagram for nsXBLDocumentInfo:
Inheritance graph
[legend]
Collaboration diagram for nsXBLDocumentInfo:
Collaboration graph
[legend]

List of all members.

Public Member Functions

NS_DECL_ISUPPORTS nsXBLDocumentInfo (nsIDocument *aDocument)
virtual ~nsXBLDocumentInfo ()
NS_IMETHOD GetDocument (nsIDocument **aResult)
NS_IMETHOD GetScriptAccess (PRBool *aResult)
 NS_IMETHOD_ (nsIURI *) DocumentURI()
NS_IMETHOD GetPrototypeBinding (const nsACString &aRef, nsXBLPrototypeBinding **aResult)
NS_IMETHOD SetPrototypeBinding (const nsACString &aRef, nsXBLPrototypeBinding *aBinding)
NS_IMETHOD FlushSkinStylesheets ()
 NS_IMETHOD_ (PRBool) IsChrome()
virtual nsIScriptGlobalObjectGetScriptGlobalObject ()
 Returns the script global object.

Private Attributes

nsCOMPtr< nsIDocumentmDocument
PRPackedBool mScriptAccess
PRPackedBool mIsChrome
nsObjectHashtable * mBindingTable
nsCOMPtr< nsIScriptGlobalObjectmGlobalObject

Detailed Description

Definition at line 46 of file nsXBLDocumentInfo.h.


Constructor & Destructor Documentation

Definition at line 416 of file nsXBLDocumentInfo.cpp.

  : mDocument(aDocument),
    mScriptAccess(PR_TRUE),
    mIsChrome(PR_FALSE),
    mBindingTable(nsnull)
{
  nsIURI* uri = aDocument->GetDocumentURI();
  if (IsChromeURI(uri)) {
    // Cache whether or not this chrome XBL can execute scripts.
    nsCOMPtr<nsIXULChromeRegistry> reg(do_GetService(NS_CHROMEREGISTRY_CONTRACTID));
    if (reg) {
      PRBool allow = PR_TRUE;
      reg->AllowScriptsForPackage(uri, &allow);
      mScriptAccess = allow;
    }
    mIsChrome = PR_TRUE;
  }
}

Here is the call graph for this function:

Definition at line 435 of file nsXBLDocumentInfo.cpp.

{
  /* destructor code */
  if (mGlobalObject) {
    mGlobalObject->SetContext(nsnull); // remove circular reference
    mGlobalObject->SetGlobalObjectOwner(nsnull); // just in case
  }
  delete mBindingTable;
}

Member Function Documentation

Implements nsIXBLDocumentInfo.

Definition at line 488 of file nsXBLDocumentInfo.cpp.

Here is the call graph for this function:

NS_IMETHOD nsXBLDocumentInfo::GetDocument ( nsIDocument **  aResult) [inline, virtual]

Implements nsIXBLDocumentInfo.

Definition at line 54 of file nsXBLDocumentInfo.h.

{ NS_ADDREF(*aResult = mDocument); return NS_OK; };

Here is the call graph for this function:

NS_IMETHODIMP nsXBLDocumentInfo::GetPrototypeBinding ( const nsACString &  aRef,
nsXBLPrototypeBinding **  aResult 
) [virtual]

Implements nsIXBLDocumentInfo.

Definition at line 446 of file nsXBLDocumentInfo.cpp.

{
  *aResult = nsnull;
  if (!mBindingTable)
    return NS_OK;

  const nsPromiseFlatCString& flat = PromiseFlatCString(aRef);
  nsCStringKey key(flat.get());
  *aResult = NS_STATIC_CAST(nsXBLPrototypeBinding*, mBindingTable->Get(&key));

  return NS_OK;
}

Here is the call graph for this function:

NS_IMETHOD nsXBLDocumentInfo::GetScriptAccess ( PRBool aResult) [inline, virtual]

Implements nsIXBLDocumentInfo.

Definition at line 56 of file nsXBLDocumentInfo.h.

{ *aResult = mScriptAccess; return NS_OK; };

Returns the script global object.

Implements nsIScriptGlobalObjectOwner.

Definition at line 502 of file nsXBLDocumentInfo.cpp.

{
  if (!mGlobalObject) {
    
    mGlobalObject = new nsXBLDocGlobalObject();
    
    if (!mGlobalObject)
      return nsnull;

    mGlobalObject->SetGlobalObjectOwner(this); // does not refcount
  }

  return mGlobalObject;
}
nsXBLDocumentInfo::NS_IMETHOD_ ( nsIURI ) [inline, virtual]

Implements nsIXBLDocumentInfo.

Definition at line 58 of file nsXBLDocumentInfo.h.

{ return mDocument->GetDocumentURI(); };
nsXBLDocumentInfo::NS_IMETHOD_ ( PRBool  ) [inline, virtual]

Implements nsIXBLDocumentInfo.

Definition at line 65 of file nsXBLDocumentInfo.h.

{ return mIsChrome; }
NS_IMETHODIMP nsXBLDocumentInfo::SetPrototypeBinding ( const nsACString &  aRef,
nsXBLPrototypeBinding aBinding 
) [virtual]

Implements nsIXBLDocumentInfo.

Definition at line 468 of file nsXBLDocumentInfo.cpp.

{
  if (!mBindingTable)
    mBindingTable = new nsObjectHashtable(nsnull, nsnull, DeletePrototypeBinding, nsnull);

  const nsPromiseFlatCString& flat = PromiseFlatCString(aRef);
  nsCStringKey key(flat.get());
  mBindingTable->Put(&key, aBinding);

  return NS_OK;
}

Here is the call graph for this function:


Member Data Documentation

nsObjectHashtable* nsXBLDocumentInfo::mBindingTable [private]

Definition at line 75 of file nsXBLDocumentInfo.h.

Definition at line 71 of file nsXBLDocumentInfo.h.

Definition at line 77 of file nsXBLDocumentInfo.h.

Definition at line 73 of file nsXBLDocumentInfo.h.

Definition at line 72 of file nsXBLDocumentInfo.h.


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