Pokazywanie postów oznaczonych etykietą reference. Pokaż wszystkie posty
Pokazywanie postów oznaczonych etykietą reference. Pokaż wszystkie posty

sobota, 14 listopada 2009

Some interesting Gecko interfaces

Interfaces reference: Mozilla Embedding API Reference
Interfaces reference: XPCOM API Reference

Mandatory: you have to implement those on one object - the Chrome.

nsIWebBrowserChrome - this interface must be implemented by the embedder in a class that also implements nsIEmbeddingSiteWindow. It corresponds to the top-level, outermost window containing an embedded Gecko WebBrowser (aka. Chrome).

nsIEmbeddingSiteWindow - this interface is implemented by the embedder to provide Gecko with the means to call up to the host to resize the window, hide or show it and set/get its title.

nsIInterfaceRequestor - implements GetInterface(). Don't know why this is mandatory, but I know that without it the browser shows, but on first interaction crashes.

Those are provided:

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.

nsIBaseWindow - window manipulations (size/visibility) for the browser.

Optional: window creation. Dunno when they are used:

nsIWindowCreator - this is a embedder-provided callback interface used by Gecko to create new browser windows in certain specific circumstances, like in utilizing PSM. A WindowWatcher component must also be available, and must be notified of the nsIWindowCreator during application initialization.

nsIWindowWatcher - this interface keeps track of Gecko/DOM Windows. It is a service that maintains a list of open top-level windows, and allows some operations on them.
This component must be initialized at application startup by calling setWindowCreator.

Optional:

nsIWebBrowserChromeFocus - this interface represents focus up-calls from Gecko to the embedding chrome. It is is implemented by the same embedder-provided object that implements nsIEmbeddingSiteWindow.

Listeners: those are optional too.

nsIWebProgressListener
nsISHistoryListener
nsIContextMenuListener
nsITooltipListener

To play with listeners you have to (I think...) implement nsISupportsWeakReference. Easiest way to do it is to use class nsSupportsWeakReference.

Interesting:

nsIDOMWindow

nsIDOMDocument
nsIEmbeddingSiteWindow2 - ???
nsIObserver - use this to observe i.e. profile directory changes or something... (WinEmbed example shows how).

Obsolete:

nsIWebBrowserSiteWindow - it was replaced by nsIEmbeddingSiteWindow.
"A new interface has been checked in called nsIWebBrowserSiteWindow. This
is a cut-down version of the nsIBaseWindow containing only the methods
that an embedding client needs to implement."

Question:
There are those two methods:Why both? What is the difference?