nsIWindowWatcher

IID:002286a8-494b-43b3-8ddd-49e3fc50622b
Inherits From:nsISupports

This interface is implemented by the following components:


Properties

nsIDOMWindow activeWindow

The Watcher serves as a global storage facility for the current active (frontmost non-floating-palette-type) window, storing and returning it on demand. Users must keep this attribute current, including after the topmost window is closed. This attribute obviously can return null if no windows are open, but should otherwise always return a valid window.


Methods

nsIWebBrowserChrome getChromeForWindow ( nsIDOMWindow window ) nsIAuthPrompt getNewAuthPrompter ( nsIDOMWindow parent ) nsIPrompt getNewPrompter ( nsIDOMWindow parent ) nsIDOMWindow getWindowByName ( PRUnichar* targetName , nsIDOMWindow currentWindow ) nsISimpleEnumerator getWindowEnumerator ( ) nsIDOMWindow openWindow ( nsIDOMWindow parent , char* url , char* name , char* features , nsISupports arguments ) void registerNotification ( nsIObserver observer ) void setWindowCreator ( nsIWindowCreator creator ) void unregisterNotification ( nsIObserver observer )

nsIWebBrowserChrome getChromeForWindow ( nsIDOMWindow window )

Retrieve the chrome window mapped to the given DOM window. Window Watcher keeps a list of all top-level DOM windows currently open, along with their corresponding chrome interfaces. Since DOM Windows lack a (public) means of retrieving their corresponding chrome, this method will do that.

Arguments:
window: the DOM window whose chrome window the caller needs
Returns:
the corresponding chrome window

nsIAuthPrompt getNewAuthPrompter ( nsIDOMWindow parent )

Return a newly created nsIAuthPrompt implementation.

Arguments:
parent: the parent window used for posing alerts. can be null.
Returns:
nsIAuthPrompt object

nsIPrompt getNewPrompter ( nsIDOMWindow parent )

Return a newly created nsIPrompt implementation.

Arguments:
parent: the parent window used for posing alerts. can be null.
Returns:
nsIPrompt object

nsIDOMWindow getWindowByName ( PRUnichar* targetName , nsIDOMWindow currentWindow )

Retrieve an existing window (or frame).

Note: This method will search all open windows for any window or frame with the given window name. Make sure you understand the security implications of this before using this method!

Arguments:
targetName: the window name
currentWindow: a starting point in the window hierarchy to begin the search. If null, each toplevel window will be searched.

nsISimpleEnumerator getWindowEnumerator ( )

Get an iterator for currently open windows in the order they were opened, guaranteeing that each will be visited exactly once.

Returns:
nsISupports objects which can be QIed to an nsIDOMWindow

nsIDOMWindow openWindow ( nsIDOMWindow parent , char* url , char* name , char* features , nsISupports arguments )

Create a new window. It will automatically be added to our list (via addWindow()).

Arguments:
parent: parent window, if any. Null if no parent. If it is impossible to get to an nsIWebBrowserChrome from parent, this method will effectively act as if parent were null.
url
name: window name from JS window.open. can be null.
features: window features from JS window.open. can be null.
arguments: extra argument(s) to the new window, to be attached as the |arguments| property. An nsISupportsArray will be unwound into multiple arguments (but not recursively!). can be null.
Returns:
the new window

void registerNotification ( nsIObserver observer )

Clients of this service can register themselves to be notified when a window is opened or closed (added to or removed from this service). This method adds an observer to the list of objects to be notified.

AObserver::Observe interprets its parameters so: subject the window being opened or closed, sent as an nsISupports which can be QIed to an nsIDOMWindow. topic a wstring, either "domwindowopened" or "domwindowclosed". someData not used.

Arguments:
observer: the object to be notified when windows are opened or closed. Its Observe method will be called with the following parameters:

void setWindowCreator ( nsIWindowCreator creator )

Set the window creator callback. It must be filled in by the app. openWindow will use it to create new windows.

Arguments:
creator: the callback. if null, the callback will be cleared and window creation capabilities lost.

void unregisterNotification ( nsIObserver observer )

Clients of this service can register themselves to be notified when a window is opened or closed (added to or removed from this service). This method removes an observer from the list of objects to be notified.

Arguments:
observer: the observer to be removed.

Reference documentation is generated from Mozilla's source.

Add a note User Contributed Notes
No comments available

Copyright © 1999 - 2005 XULPlanet.com