Concept of embedding
How is embedding!?
Constituents of embedding 
In the world of embedding, various objects work in cooperation. The most important object is nsWebBrowser and this is the central element of embedding. This nsWebBrowser holds multiple nsDocShells in tree structure. Each nsDocShell is instanciated one by one according to the HTML frame.
[Constituent objects of embedding]

I show main objects used in embedding below.
nsWebBrowser
The most important object of embedding. Embedding application creates instances of this class and uses them.
nsWebBrowser is XPCOM object and its functions are divided into each interface according to their usages.
The interfaces of nsWebBrowser are such as
- nsIWebBrowser
- nsIWebNavigation
- nsIWebProgress
- nsIWebBrowserSetup
- nsIDocShellTreeItem
- nsIBaseWindow
- nsIScrollable
- nsITextScroll
- nsIInterfaceRequestor
- nsIWebBrowserPersist
And embedding application should create WebBrowser Site Objects as a proxy for each nsWebbrowser object he instanciated. These WebBrowser Site Objects implement some of XPCOM interfaces to themselves and mediate between nsWebBrowser and embedding application by receiving callbacks from nsWebBrowser.
nsDocShell
XPCOM object that manages documents (HTML, XML) corresponding to one HTML frame. This object is responsible for loading documents, and has the feature of traversing tree structure of the document.
Because this nsDocShell is in charge of core fuctions, embedding application can do almost all things he want by dealing with upper level nsWebBrowser.
The interfaces of nsDocShell are such as
- nsIDocShell
- nsIDocShellTreeItem
- nsIDocShellTreeNode
- nsIDocShellHistory
- nsIWebNavigation
- nsIBaseWindow
- nsIScrollable
- nsITextScroll
- nsIContentViewerContainer
- nsIInterfaceRequestor
- nsIScriptGlobalObjectOwner
- nsIRefreshURI
- nsIWebProgressListener
- nsSupportsWeakReference
WebBrowser Site Object
XPCOM object that embedding application must implement.
Embedding application must create this object in one-to-one correspondence to nsWebBrowser that he created.
By being in close relations with nsWebBrowser and by being called its interfaces from nsWebBrowser at various timings, this object acts as a go-between for nsWebBrowser and application (i.e. Browser Shell Object).
The interfaces are divided into what must be implemented and what is implemented optionaly according to the functions of application.
Candidates of interfaces that WebBrowser Site Object implements are such as
- nsIBaseWindow
- nsIWebBrowserChrome
- nsIWebProgressListener
- nsIStreamObserver
- nsIURIContentListener
- nsIDocumentLoaderObserver - abolished
- nsIDocShellTreeOwner
- nsIInterfaceRequestor
- nsIPrompt
BrowserShell Object
Neither essential to embedding nor XPCOM object. This is just a C++ object for management of browser-visual parts on embedding application side.
But, if embedding application itself is created as object-oriented, this will be implemented inevitably.
This object creates and manages nsWebBrowser and WebBrowser Site Object.
|