Added support for GetContainer()/SetContainer(). Added the OnStartURLLoad() notification to the DocumentLoadObserver...

This commit is contained in:
rpotts@netscape.com
1999-01-14 06:44:23 +00:00
parent 118c28ad56
commit bd9df2d67b
4 changed files with 212 additions and 38 deletions

View File

@@ -138,6 +138,7 @@ public:
NS_IMETHOD Embed(nsIContentViewer* aDocViewer,
const char* aCommand,
nsISupports* aExtraInfo);
NS_IMETHOD GetContentViewer(nsIContentViewer** aResult);
// nsIWebShell
NS_IMETHOD Init(nsNativeWidget aNativeParent,
@@ -155,7 +156,6 @@ public:
NS_IMETHOD RemoveFocus();
NS_IMETHOD Repaint(PRBool aForce);
NS_IMETHOD SetContentViewer(nsIContentViewer* aViewer);
NS_IMETHOD GetContentViewer(nsIContentViewer*& aResult);
NS_IMETHOD SetContainer(nsIWebShellContainer* aContainer);
NS_IMETHOD GetContainer(nsIWebShellContainer*& aResult);
NS_IMETHOD SetObserver(nsIStreamObserver* anObserver);
@@ -237,6 +237,8 @@ public:
NS_IMETHOD ReleaseScriptContext(nsIScriptContext *aContext);
// nsIDocumentLoaderObserver
NS_IMETHOD OnStartURLLoad(nsIURL* aURL, const char* aContentType,
nsIContentViewer* aViewer);
NS_IMETHOD OnConnectionsComplete();
// nsIRefreshURL interface methods...
@@ -443,6 +445,7 @@ nsWebShell::~nsWebShell()
if (nsnull != mDocLoader) {
mDocLoader->Stop();
mDocLoader->RemoveObserver((nsIDocumentLoaderObserver*)this);
mDocLoader->SetContainer(nsnull);
NS_RELEASE(mDocLoader);
}
// Cancel any timers that were set for this loader.
@@ -646,6 +649,20 @@ nsWebShell::Embed(nsIContentViewer* aContentViewer,
return rv;
}
NS_IMETHODIMP
nsWebShell::GetContentViewer(nsIContentViewer** aResult)
{
nsresult rv = NS_OK;
if (nsnull == aResult) {
rv = NS_ERROR_NULL_POINTER;
} else {
*aResult = mContentViewer;
NS_IF_ADDREF(mContentViewer);
}
return rv;
}
NS_IMETHODIMP
nsWebShell::Init(nsNativeWidget aNativeParent,
PRInt32 x, PRInt32 y, PRInt32 w, PRInt32 h,
@@ -711,6 +728,10 @@ nsWebShell::Init(nsNativeWidget aNativeParent,
if (NS_FAILED(rv)) {
goto done;
}
// Set the webshell as the default IContentViewerContainer for the loader...
mDocLoader->SetContainer(this);
//Register ourselves as an observer for the new doc loader
mDocLoader->AddObserver((nsIDocumentLoaderObserver*)this);
@@ -757,6 +778,10 @@ nsWebShell::Destroy()
SetContainer(nsnull);
SetObserver(nsnull);
if (nsnull != mDocLoader) {
mDocLoader->SetContainer(nsnull);
}
NS_IF_RELEASE(mContentViewer);
// Destroy our child web shells and release references to them
@@ -899,14 +924,6 @@ nsWebShell::SetContentViewer(nsIContentViewer* aViewer)
return NS_OK;
}
NS_IMETHODIMP
nsWebShell::GetContentViewer(nsIContentViewer*& aResult)
{
aResult = mContentViewer;
NS_IF_ADDREF(mContentViewer);
return NS_OK;
}
NS_IMETHODIMP
nsWebShell::SetContainer(nsIWebShellContainer* aContainer)
{
@@ -1874,6 +1891,14 @@ nsWebShell::ReleaseScriptContext(nsIScriptContext *aContext)
return NS_OK;
}
NS_IMETHODIMP
nsWebShell::OnStartURLLoad(nsIURL* aURL, const char* aContentType,
nsIContentViewer* aViewer)
{
return NS_OK;
}
NS_IMETHODIMP
nsWebShell::OnConnectionsComplete()
{