Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Friends
CBrowserChrome Class Reference

#include <CBrowserChrome.h>

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

List of all members.

Public Member Functions

NS_DECL_ISUPPORTS
NS_DECL_NSIWEBBROWSERCHROME
NS_DECL_NSIWEBBROWSERCHROMEFOCUS
NS_DECL_NSIEMBEDDINGSITEWINDOW
NS_DECL_NSIEMBEDDINGSITEWINDOW2
NS_DECL_NSIINTERFACEREQUESTOR
NS_DECL_NSICONTEXTMENULISTENER2
virtual
NS_DECL_NSITOOLTIPLISTENER
void 
ListenToMessage (MessageT inMessage, void *ioParam)
void setStatus (in unsigned long statusType, in wstring status)
 Called when the status text in the chrome needs to be updated.
void destroyBrowserWindow ()
 Asks the implementer to destroy the window associated with this WebBrowser object.
void sizeBrowserTo (in long aCX, in long aCY)
 Tells the chrome to size itself such that the browser will be the specified size.
void showAsModal ()
 Shows the window as a modal window.
boolean isWindowModal ()
 Is the window modal (that is, currently executing a modal loop)?
void exitModalEventLoop (in nsresult aStatus)
 Exit a modal event loop if we're in one.
void focusNextElement ()
 Set the focus at the next focusable element in the chrome.
void focusPrevElement ()
 Set the focus at the previous focusable element in the chrome.
void blur ()
 Blur the window.
void setDimensions (in unsigned long flags, in long x, in long y, in long cx, in long cy)
 Sets the dimensions for the window; the position & size.
void getDimensions (in unsigned long flags, out long x, out long y, out long cx, out long cy)
 Gets the dimensions of the window.
void setFocus ()
 Give the window focus.
void getInterface (in nsIIDRef uuid,[iid_is(uuid), retval] out nsQIResult result)
 Retrieves the specified interface pointer.
void onShowContextMenu (in unsigned long aContextFlags, in nsIContextMenuInfo aUtils)
 Called when the browser receives a context menu event (e.g.
void onShowTooltip (in long aXCoords, in long aYCoords, in wstring aTipText)
 Called when a tooltip should be displayed.
void onHideTooltip ()
 Called when the tooltip should be hidden, either because the pointer has moved or the tooltip has timed out.

Static Public Member Functions

static LWindow * GetLWindowForDOMWindow (nsIDOMWindow *aDOMWindow)

Public Attributes

const unsigned long STATUS_SCRIPT = 0x00000001
const unsigned long STATUS_SCRIPT_DEFAULT = 0x00000002
const unsigned long STATUS_LINK = 0x00000003
attribute nsIWebBrowser webBrowser
 The currently loaded WebBrowser.
const unsigned long CHROME_DEFAULT = 0x00000001
 Definitions for the chrome flags.
const unsigned long CHROME_WINDOW_BORDERS = 0x00000002
const unsigned long CHROME_WINDOW_CLOSE = 0x00000004
const unsigned long CHROME_WINDOW_RESIZE = 0x00000008
const unsigned long CHROME_MENUBAR = 0x00000010
const unsigned long CHROME_TOOLBAR = 0x00000020
const unsigned long CHROME_LOCATIONBAR = 0x00000040
const unsigned long CHROME_STATUSBAR = 0x00000080
const unsigned long CHROME_PERSONAL_TOOLBAR = 0x00000100
const unsigned long CHROME_SCROLLBARS = 0x00000200
const unsigned long CHROME_TITLEBAR = 0x00000400
const unsigned long CHROME_EXTRA = 0x00000800
const unsigned long CHROME_WITH_SIZE = 0x00001000
const unsigned long CHROME_WITH_POSITION = 0x00002000
const unsigned long CHROME_WINDOW_MIN = 0x00004000
const unsigned long CHROME_WINDOW_POPUP = 0x00008000
const unsigned long CHROME_WINDOW_RAISED = 0x02000000
const unsigned long CHROME_WINDOW_LOWERED = 0x04000000
const unsigned long CHROME_CENTER_SCREEN = 0x08000000
const unsigned long CHROME_DEPENDENT = 0x10000000
const unsigned long CHROME_MODAL = 0x20000000
const unsigned long CHROME_OPENAS_DIALOG = 0x40000000
const unsigned long CHROME_OPENAS_CHROME = 0x80000000
const unsigned long CHROME_ALL = 0x00000ffe
attribute unsigned long chromeFlags
 The chrome flags for this browser chrome.
const unsigned long DIM_FLAGS_POSITION = 1
 Flag indicates that position of the top left corner of the outer area is required/specified.
const unsigned long DIM_FLAGS_SIZE_INNER = 2
 Flag indicates that the size of the inner area is required/specified.
const unsigned long DIM_FLAGS_SIZE_OUTER = 4
 Flag indicates that the size of the outer area is required/specified.
attribute boolean visibility
 Visibility of the window.
attribute wstring title
 Title of the window.
readonly attribute voidPtr siteWindow
 Native window for the site's window.
const unsigned long CONTEXT_NONE = 0
 Flag.
const unsigned long CONTEXT_LINK = 1
 Flag.
const unsigned long CONTEXT_IMAGE = 2
 Flag.
const unsigned long CONTEXT_DOCUMENT = 4
 Flag.
const unsigned long CONTEXT_TEXT = 8
 Flag.
const unsigned long CONTEXT_INPUT = 16
 Flag.
const unsigned long CONTEXT_BACKGROUND_IMAGE = 32
 Flag.

Protected Member Functions

 CBrowserChrome (CBrowserShell *aShell, UInt32 aChromeFlags, Boolean aIsMainContent)
virtual ~CBrowserChrome ()
void SetBrowserShell (CBrowserShell *aShell)

Protected Attributes

CBrowserShellmBrowserShell
LWindow * mBrowserWindow
PRUint32 mChromeFlags
Boolean mIsMainContent
Boolean mSizeToContent
Boolean mInModalLoop
Boolean mWindowVisible
Boolean mInitialLoadComplete

Friends

class CBrowserShell

Detailed Description

Definition at line 65 of file CBrowserChrome.h.


Constructor & Destructor Documentation

CBrowserChrome::CBrowserChrome ( CBrowserShell aShell,
UInt32  aChromeFlags,
Boolean  aIsMainContent 
) [protected]

Definition at line 79 of file CBrowserChrome.cpp.

                                                       :
    mBrowserShell(aShell), mBrowserWindow(nsnull),
    mChromeFlags(aChromeFlags), mIsMainContent(aIsMainContent),
    mSizeToContent(false),    
    mInModalLoop(false), mWindowVisible(false),
    mInitialLoadComplete(false)
{
       ThrowIfNil_(mBrowserShell);
       mBrowserWindow = LWindow::FetchWindowObject(mBrowserShell->GetMacWindow());
       StartListening();
}
CBrowserChrome::~CBrowserChrome ( ) [protected, virtual]

Definition at line 93 of file CBrowserChrome.cpp.

{
}

Member Function Documentation

Blur the window.

This should unfocus the window and send an onblur event.

Asks the implementer to destroy the window associated with this WebBrowser object.

Exit a modal event loop if we're in one.

The implementation should also exit out of the loop if the window is destroyed.

Parameters:
aStatus- the result code to return from showAsModal

Set the focus at the next focusable element in the chrome.

Set the focus at the previous focusable element in the chrome.

void nsIEmbeddingSiteWindow::getDimensions ( in unsigned long  flags,
out long  x,
out long  y,
out long  cx,
out long  cy 
) [inherited]

Gets the dimensions of the window.

The caller may pass nsnull for any value it is uninterested in receiving.

Parameters:
flagsCombination of position, inner and outer size flag .
xLeft hand corner of the outer area; or nsnull.
yTop corner of the outer area; or nsnull.
cxWidth of the inner or outer area; or nsnull.
cyHeight of the inner or outer area; or nsnull.
See also:
setDimensions
DIM_FLAGS_POSITION
DIM_FLAGS_SIZE_OUTER
DIM_FLAGS_SIZE_INNER
void nsIInterfaceRequestor::getInterface ( in nsIIDRef  uuid,
[iid_is(uuid), retval] out nsQIResult  result 
) [inherited]

Retrieves the specified interface pointer.

Parameters:
uuidThe IID of the interface being requested.
result[out] The interface pointer to be filled in if the interface is accessible.
Returns:
NS_OK - interface was successfully returned. NS_NOINTERFACE - interface not accessible. NS_ERROR* - method failure.
LWindow * CBrowserChrome::GetLWindowForDOMWindow ( nsIDOMWindow aDOMWindow) [static]

Definition at line 547 of file CBrowserChrome.cpp.

{
    if (!aDOMWindow)
        return nsnull;
        
    nsCOMPtr<nsIWindowWatcher> windowWatcher(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
    if (!windowWatcher)
        return nsnull;
    nsCOMPtr<nsIWebBrowserChrome> windowChrome;
    windowWatcher->GetChromeForWindow(aDOMWindow, getter_AddRefs(windowChrome));
    if (!windowChrome)
        return nsnull;        
    nsCOMPtr<nsIEmbeddingSiteWindow> siteWindow(do_QueryInterface(windowChrome));
    if (!siteWindow)
        return nsnull;
    WindowPtr macWindow = nsnull;
    siteWindow->GetSiteWindow((void **)&macWindow);
    if (!macWindow)
        return nsnull;
    
    return LWindow::FetchWindowObject(macWindow);
}

Here is the call graph for this function:

Is the window modal (that is, currently executing a modal loop)?

Returns:
true if it's a modal window
void CBrowserChrome::ListenToMessage ( MessageT  inMessage,
void ioParam 
) [virtual]

Definition at line 495 of file CBrowserChrome.cpp.

{
    switch (inMessage)
    {
        case msg_OnNetStopChange:
            {
                mInitialLoadComplete = true;

                // See if we need to size it and show it
                if (mIsMainContent &&
                    (mChromeFlags & nsIWebBrowserChrome::CHROME_OPENAS_CHROME) &&
                    (mChromeFlags & nsIWebBrowserChrome::CHROME_OPENAS_DIALOG))
                {
                    nsCOMPtr<nsIDOMWindow> domWindow;
                    (void)GetInterface(NS_GET_IID(nsIDOMWindow), getter_AddRefs(domWindow));
                    if (domWindow)
                        domWindow->SizeToContent();
                    if (mWindowVisible != mBrowserWindow->IsVisible())
                        mBrowserWindow->Show();
                }
                
                // If we are chrome, get the window title from the DOM
                if (mChromeFlags & nsIWebBrowserChrome::CHROME_OPENAS_CHROME)
                {
                    nsresult rv;
                    nsCOMPtr<nsIDOMWindow> domWindow;
                    rv = GetInterface(NS_GET_IID(nsIDOMWindow), getter_AddRefs(domWindow));
                    if (NS_FAILED(rv)) return;
                    nsCOMPtr<nsIDOMDocument> domDoc;
                    rv = domWindow->GetDocument(getter_AddRefs(domDoc));
                    if (NS_FAILED(rv)) return;
                    nsCOMPtr<nsIDOMElement> domDocElem;
                    rv = domDoc->GetDocumentElement(getter_AddRefs(domDocElem));
                    if (NS_FAILED(rv)) return;

                    nsAutoString windowTitle;
                    domDocElem->GetAttribute(NS_LITERAL_STRING("title"), windowTitle);
                    if (!windowTitle.IsEmpty()) {
                        Str255 pStr;
                        CPlatformUCSConversion::GetInstance()->UCSToPlatform(windowTitle, pStr);
                        mBrowserWindow->SetDescriptor(pStr);
                    }
                }
            }
            break;
    }
}

Here is the call graph for this function:

Called when the tooltip should be hidden, either because the pointer has moved or the tooltip has timed out.

void nsIContextMenuListener2::onShowContextMenu ( in unsigned long  aContextFlags,
in nsIContextMenuInfo  aUtils 
) [inherited]

Called when the browser receives a context menu event (e.g.

user is right-mouse clicking somewhere on the document). The combination of flags, along with the attributes of aUtils, indicate where and what was clicked on.

The following table describes what context flags and node combinations are possible.

aContextFlags aUtils.targetNode

CONTEXT_LINK CONTEXT_IMAGE CONTEXT_IMAGE | CONTEXT_LINK with as an ancestor CONTEXT_INPUT <INPUT> CONTEXT_INPUT | CONTEXT_IMAGE <INPUT> with type=image CONTEXT_TEXT <TEXTAREA> CONTEXT_DOCUMENT <HTML> CONTEXT_BACKGROUND_IMAGE <HTML> with background image

Parameters:
aContextFlagsFlags indicating the kind of context.
aUtilsContext information and helper utilities.
See also:
nsIContextMenuInfo
void nsITooltipListener::onShowTooltip ( in long  aXCoords,
in long  aYCoords,
in wstring  aTipText 
) [inherited]

Called when a tooltip should be displayed.

Parameters:
aXCoordsThe tooltip left edge X coordinate.
aYCoordsThe tooltip top edge Y coordinate.
aTipTextThe text to display in the tooltip, typically obtained from the TITLE attribute of the node (or containing parent) over which the pointer has been positioned.
Note:
Coordinates are specified in pixels, relative to the top-left corner of the browser area.
Returns:
NS_OK if the tooltip was displayed.

Definition at line 97 of file CBrowserChrome.cpp.

{
    mBrowserShell = aShell;
    if (mBrowserShell)
           mBrowserWindow = LWindow::FetchWindowObject(mBrowserShell->GetMacWindow());
    else
        mBrowserWindow = nsnull;    
}

Here is the caller graph for this function:

void nsIEmbeddingSiteWindow::setDimensions ( in unsigned long  flags,
in long  x,
in long  y,
in long  cx,
in long  cy 
) [inherited]

Sets the dimensions for the window; the position & size.

The flags to indicate what the caller wants to set and whether the size refers to the inner or outer area. The inner area refers to just the embedded area, wheras the outer area can also include any surrounding chrome, window frame, title bar, and so on.

Parameters:
flagsCombination of position, inner and outer size flags.
xLeft hand corner of the outer area.
yTop corner of the outer area.
cxWidth of the inner or outer area.
cyHeight of the inner or outer area.
Returns:
NS_OK if operation was performed correctly; NS_ERROR_UNEXPECTED if window could not be destroyed; NS_ERROR_INVALID_ARG for bad flag combination or illegal dimensions.
See also:
getDimensions
DIM_FLAGS_POSITION
DIM_FLAGS_SIZE_OUTER
DIM_FLAGS_SIZE_INNER

Give the window focus.

void nsIWebBrowserChrome::setStatus ( in unsigned long  statusType,
in wstring  status 
) [inherited]

Called when the status text in the chrome needs to be updated.

Parameters:
statusTypeindicates what is setting the text
statusstatus string. null is an acceptable value meaning no status.

Shows the window as a modal window.

Returns:
(the function error code) the status value specified by in exitModalEventLoop.
void nsIWebBrowserChrome::sizeBrowserTo ( in long  aCX,
in long  aCY 
) [inherited]

Tells the chrome to size itself such that the browser will be the specified size.

Parameters:
aCXnew width of the browser
aCYnew height of the browser

Friends And Related Function Documentation

friend class CBrowserShell [friend]

Definition at line 74 of file CBrowserChrome.h.


Member Data Documentation

const unsigned long nsIWebBrowserChrome::CHROME_ALL = 0x00000ffe [inherited]

Definition at line 116 of file nsIWebBrowserChrome.idl.

const unsigned long nsIWebBrowserChrome::CHROME_CENTER_SCREEN = 0x08000000 [inherited]

Definition at line 103 of file nsIWebBrowserChrome.idl.

const unsigned long nsIWebBrowserChrome::CHROME_DEFAULT = 0x00000001 [inherited]

Definitions for the chrome flags.

Definition at line 80 of file nsIWebBrowserChrome.idl.

const unsigned long nsIWebBrowserChrome::CHROME_DEPENDENT = 0x10000000 [inherited]

Definition at line 108 of file nsIWebBrowserChrome.idl.

const unsigned long nsIWebBrowserChrome::CHROME_EXTRA = 0x00000800 [inherited]

Definition at line 91 of file nsIWebBrowserChrome.idl.

const unsigned long nsIWebBrowserChrome::CHROME_LOCATIONBAR = 0x00000040 [inherited]

Definition at line 86 of file nsIWebBrowserChrome.idl.

const unsigned long nsIWebBrowserChrome::CHROME_MENUBAR = 0x00000010 [inherited]

Definition at line 84 of file nsIWebBrowserChrome.idl.

const unsigned long nsIWebBrowserChrome::CHROME_MODAL = 0x20000000 [inherited]

Definition at line 112 of file nsIWebBrowserChrome.idl.

const unsigned long nsIWebBrowserChrome::CHROME_OPENAS_CHROME = 0x80000000 [inherited]

Definition at line 114 of file nsIWebBrowserChrome.idl.

const unsigned long nsIWebBrowserChrome::CHROME_OPENAS_DIALOG = 0x40000000 [inherited]

Definition at line 113 of file nsIWebBrowserChrome.idl.

const unsigned long nsIWebBrowserChrome::CHROME_PERSONAL_TOOLBAR = 0x00000100 [inherited]

Definition at line 88 of file nsIWebBrowserChrome.idl.

const unsigned long nsIWebBrowserChrome::CHROME_SCROLLBARS = 0x00000200 [inherited]

Definition at line 89 of file nsIWebBrowserChrome.idl.

const unsigned long nsIWebBrowserChrome::CHROME_STATUSBAR = 0x00000080 [inherited]

Definition at line 87 of file nsIWebBrowserChrome.idl.

const unsigned long nsIWebBrowserChrome::CHROME_TITLEBAR = 0x00000400 [inherited]

Definition at line 90 of file nsIWebBrowserChrome.idl.

const unsigned long nsIWebBrowserChrome::CHROME_TOOLBAR = 0x00000020 [inherited]

Definition at line 85 of file nsIWebBrowserChrome.idl.

const unsigned long nsIWebBrowserChrome::CHROME_WINDOW_BORDERS = 0x00000002 [inherited]

Definition at line 81 of file nsIWebBrowserChrome.idl.

const unsigned long nsIWebBrowserChrome::CHROME_WINDOW_CLOSE = 0x00000004 [inherited]

Definition at line 82 of file nsIWebBrowserChrome.idl.

const unsigned long nsIWebBrowserChrome::CHROME_WINDOW_LOWERED = 0x04000000 [inherited]

Definition at line 102 of file nsIWebBrowserChrome.idl.

const unsigned long nsIWebBrowserChrome::CHROME_WINDOW_MIN = 0x00004000 [inherited]

Definition at line 98 of file nsIWebBrowserChrome.idl.

const unsigned long nsIWebBrowserChrome::CHROME_WINDOW_POPUP = 0x00008000 [inherited]

Definition at line 99 of file nsIWebBrowserChrome.idl.

const unsigned long nsIWebBrowserChrome::CHROME_WINDOW_RAISED = 0x02000000 [inherited]

Definition at line 101 of file nsIWebBrowserChrome.idl.

const unsigned long nsIWebBrowserChrome::CHROME_WINDOW_RESIZE = 0x00000008 [inherited]

Definition at line 83 of file nsIWebBrowserChrome.idl.

const unsigned long nsIWebBrowserChrome::CHROME_WITH_POSITION = 0x00002000 [inherited]

Definition at line 95 of file nsIWebBrowserChrome.idl.

const unsigned long nsIWebBrowserChrome::CHROME_WITH_SIZE = 0x00001000 [inherited]

Definition at line 94 of file nsIWebBrowserChrome.idl.

The chrome flags for this browser chrome.

The implementation should reflect the value of this attribute by hiding or showing its chrome appropriately.

Definition at line 123 of file nsIWebBrowserChrome.idl.

Flag.

Context is a background image.

Definition at line 79 of file nsIContextMenuListener2.idl.

Flag.

Context is the whole document.

Definition at line 73 of file nsIContextMenuListener2.idl.

Flag.

Context is an image element.

Definition at line 71 of file nsIContextMenuListener2.idl.

Flag.

Context is an input element.

Definition at line 77 of file nsIContextMenuListener2.idl.

Flag.

Context is a link element.

Definition at line 69 of file nsIContextMenuListener2.idl.

Flag.

No context.

Definition at line 67 of file nsIContextMenuListener2.idl.

Flag.

Context is a text area element.

Definition at line 75 of file nsIContextMenuListener2.idl.

Flag indicates that position of the top left corner of the outer area is required/specified.

See also:
setDimensions
getDimensions

Definition at line 61 of file nsIEmbeddingSiteWindow.idl.

Flag indicates that the size of the inner area is required/specified.

Note:
The inner and outer flags are mutually exclusive and it is invalid to combine them.
See also:
setDimensions
getDimensions
DIM_FLAGS_SIZE_OUTER

Definition at line 73 of file nsIEmbeddingSiteWindow.idl.

Flag indicates that the size of the outer area is required/specified.

See also:
setDimensions
getDimensions
DIM_FLAGS_SIZE_INNER

Definition at line 82 of file nsIEmbeddingSiteWindow.idl.

Definition at line 103 of file CBrowserChrome.h.

LWindow* CBrowserChrome::mBrowserWindow [protected]

Definition at line 104 of file CBrowserChrome.h.

Definition at line 106 of file CBrowserChrome.h.

Definition at line 111 of file CBrowserChrome.h.

Definition at line 109 of file CBrowserChrome.h.

Definition at line 107 of file CBrowserChrome.h.

Definition at line 108 of file CBrowserChrome.h.

Definition at line 110 of file CBrowserChrome.h.

readonly attribute voidPtr nsIEmbeddingSiteWindow::siteWindow [inherited]

Native window for the site's window.

The implementor should copy the native window object into the address supplied by the caller. The type of the native window that the address refers to is platform and OS specific as follows:

  • On Win32 it is an HWND.
  • On MacOS this is a WindowPtr.
  • On GTK this is a GtkWidget*.

Definition at line 154 of file nsIEmbeddingSiteWindow.idl.

const unsigned long nsIWebBrowserChrome::STATUS_LINK = 0x00000003 [inherited]

Definition at line 57 of file nsIWebBrowserChrome.idl.

const unsigned long nsIWebBrowserChrome::STATUS_SCRIPT = 0x00000001 [inherited]

Definition at line 55 of file nsIWebBrowserChrome.idl.

const unsigned long nsIWebBrowserChrome::STATUS_SCRIPT_DEFAULT = 0x00000002 [inherited]

Definition at line 56 of file nsIWebBrowserChrome.idl.

Title of the window.

Definition at line 140 of file nsIEmbeddingSiteWindow.idl.

Visibility of the window.

Definition at line 135 of file nsIEmbeddingSiteWindow.idl.

The currently loaded WebBrowser.

The browser chrome may be told to set the WebBrowser object to a new object by setting this attribute. In this case the implementer is responsible for taking the new WebBrowser object and doing any necessary initialization or setup as if it had created the WebBrowser itself. This includes positioning setting up listeners etc.

Definition at line 75 of file nsIWebBrowserChrome.idl.


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