Back to index

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

#include <nsCommandHandler.h>

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

List of all members.

Public Member Functions

 nsCommandHandler ()
string exec (in string aCommand, in string aParameters)
string query (in string aCommand, in string aParameters)

Public Attributes

attribute nsIDOMWindow window

Protected Member Functions

virtual ~nsCommandHandler ()

Private Member Functions

nsresult GetCommandHandler (nsICommandHandler **aCommandHandler)

Private Attributes

nsIDOMWindowmWindow

Detailed Description

Definition at line 47 of file nsCommandHandler.h.


Constructor & Destructor Documentation

Definition at line 47 of file nsCommandHandler.cpp.

                                   :
    mWindow(nsnull)
{
}
nsCommandHandler::~nsCommandHandler ( ) [protected, virtual]

Definition at line 52 of file nsCommandHandler.cpp.

{
}

Member Function Documentation

string nsICommandHandler::exec ( in string  aCommand,
in string  aParameters 
) [inherited]

Definition at line 56 of file nsCommandHandler.cpp.

{
    NS_ENSURE_ARG_POINTER(aCommandHandler);

    *aCommandHandler = nsnull;
    if (mWindow == nsnull)
    {
        return NS_ERROR_FAILURE;
    }

    nsCOMPtr<nsIScriptGlobalObject> globalObj( do_QueryInterface(mWindow) );
    if (!globalObj)
    {
        return NS_ERROR_FAILURE;
    }

    // Get the document tree owner

    nsCOMPtr<nsIDocShellTreeItem> docShellAsTreeItem =
      do_QueryInterface(globalObj->GetDocShell());
    nsIDocShellTreeOwner *treeOwner = nsnull;
    docShellAsTreeItem->GetTreeOwner(&treeOwner);

    // Make sure the tree owner is an an nsDocShellTreeOwner object
    // by QI'ing for a hidden interface. If it doesn't have the interface
    // then it's not safe to do the casting.

    nsCOMPtr<nsICDocShellTreeOwner> realTreeOwner(do_QueryInterface(treeOwner));
    if (realTreeOwner)
    {
        nsDocShellTreeOwner *tree = NS_STATIC_CAST(nsDocShellTreeOwner *, treeOwner);
        if (tree->mTreeOwner)
        {
            nsresult rv;
            rv = tree->mTreeOwner->QueryInterface(NS_GET_IID(nsICommandHandler), (void **)aCommandHandler);
            NS_RELEASE(treeOwner);
            return rv;
        }
     
        NS_RELEASE(treeOwner);
     }

    *aCommandHandler = nsnull;

    return NS_OK;
}

Here is the call graph for this function:

string nsICommandHandler::query ( in string  aCommand,
in string  aParameters 
) [inherited]

Member Data Documentation

Definition at line 51 of file nsCommandHandler.h.

Definition at line 51 of file nsICommandHandler.idl.


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