You are currently viewing a snapshot of www.mozilla.org taken on April 21, 2008. Most of this content is highly out of date (some pages haven't been updated since the project began in 1998) and exists for historical purposes only. If there are any pages on this archive site that you think should be added back to www.mozilla.org, please file a bug.


TOC PREV NEXT INDEX

Embedding Gecko API


nsIWebBrowser


Embedders use this interface during initialization to associate the new WebBrowser instance with the embedder's chrome and to register any listeners. The interface may also be used at runtime to obtain the content DOM window and from that the rest of the DOM. This interface is scriptable

Methods
addWebBrowserListener

Registers a listener of the type specified by the IID to receive callbacks. The browser stores a weak reference to the listener to avoid any circular dependencies. Typically this method is called to register an object to receive nsIWebProgressListener or nsISHistoryListener notifications in which case the IID is that of the interface.

Syntax:

void nsIWebBrowser::addWebBrowserListener(
	in nsIWeakReference aListener,
	in nsIIDRef aIID)  

Parameters:

aListener: The listener to be added.
aIID: The IID of the interface to be called on the listener as appropriate.

nsresult :

NS_OK for successful registration.
NS_ERROR_INVALID_ARG if one of the arguments was invalid or the object did not implement the interface specified by aIID.
NS_ERROR_FAILURE
if aListener did not expose the interface specified by the IID, or some other internal error occurred.

See also: nsIWeakReference,nsIWebProgressListener, nsISHistoryListener.

removeWebBrowserListener

Removes a previously registered listener.

Syntax:

void nsIWebBrowser::removeWebBrowserListener(
	in nsIWeakReference aListener,
	in nsIIDRef aIID )  

Parameter:

aListener: The listener to be removed.
aIID: The IID of the interface on the listener that will no longer be called.

nsresult:

NS_OK if listener was successfully removed.
NS_ERROR_INVALID_ARG if argument was invalid or the object did not implement the interface specified by the IID.

See also: nsIWeakReference

Attributes
attribute nsIWebBrowserChrome nsIWebBrowser::containerWindow

Sets the chrome object. The embedder must create one chrome object for each browser object that is instantiated. This attribute associates the two by setting this property to point to the chrome object. This must be done before creating the browser window via the browser's nsIBaseWindow interface. The chrome object must also implement nsIEmbeddingSiteWindow.

The chrome object may optionally implement nsIInterfaceRequestor, nsIWebBrowserChromeFocus, nsIContextMenuListener and nsITooltipListener to receive additional notifications from the browser object.

The chrome object may also optionally implement nsIWebProgressListener instead of explicitly calling addWebBrowserListener and removeWebBrowserListener to register a progress listener object. If the implementation does this, it must also implement nsIWeakReference.

Note:The implementation should not refcount the supplied chrome object; it should assume that a non-nsnull value is always valid. The embedder must explicitly set this value back to nsnull if the chrome object is destroyed before the browser object.

See also: nsIURIContentListener

attribute nsIURIContentListener nsIWebBrowser::parentURIContentListener

Sets the URI content listener parent. Embedders may set this property to their own implementation if they intend to override or prevent how certain kinds of content are loaded.

Note: The implementation should not refcount this interface; it should assume that a non-nsnull value is always valid. The embedder should explicitly set this value back to nsnull if the parent content listener is destroyed before the browser object

See also: nsIURIContentListener

readonly attribute nsIDOMWindow nsIWebBrowser::contentDOMWindow

Gets the top-level DOM window.The embedder may walk the entire DOM starting from this value.

See also: nsIDOMWindow


Written by:Ellen Evans | Comments, questions, complaints? Bug 143387
TOC PREV NEXT INDEX