nsIWebShell now supports a single observer for all documents loads...

git-svn-id: svn://10.0.0.236/trunk@6168 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
rpotts%netscape.com
1998-07-22 11:26:18 +00:00
parent 71f151059e
commit 0a063a503f
2 changed files with 13 additions and 6 deletions

View File

@@ -260,6 +260,7 @@ void
nsBrowserWindow::Destroy()
{
mWebShell->SetContainer(nsnull);
mWebShell->SetObserver(nsnull);
printf("refcnt=%d\n", mRefCnt);
Release();
}
@@ -267,22 +268,21 @@ nsBrowserWindow::Destroy()
void
nsBrowserWindow::Back()
{
mWebShell->Back((nsIStreamObserver*) this);
mWebShell->Back();
}
void
nsBrowserWindow::Forward()
{
mWebShell->Forward((nsIStreamObserver*) this);
mWebShell->Forward();
}
void
nsBrowserWindow::GoTo(const nsString& aURL)
{
mWebShell->LoadURL(aURL, (nsIStreamObserver*) this, nsnull);
mWebShell->LoadURL(aURL, nsnull);
}
#define FILE_PROTOCOL "file://"
static PRBool GetFileNameFromFileSelector(nsIWidget* aParentWindow,
@@ -429,6 +429,7 @@ nsBrowserWindow::Init(nsIAppShell* aAppShell,
r.x = r.y = 0;
rv = mWebShell->Init(mWindow->GetNativeData(NS_NATIVE_WIDGET), r);
mWebShell->SetContainer((nsIWebShellContainer*) this);
mWebShell->SetObserver((nsIStreamObserver*)this);
mWebShell->Show();
if (NS_CHROME_MENU_BAR_ON & aChromeMask) {
@@ -638,7 +639,7 @@ nsBrowserWindow::GetChrome(PRUint32& aChromeMaskResult)
NS_IMETHODIMP
nsBrowserWindow::LoadURL(const nsString& aURL)
{
return mWebShell->LoadURL(aURL, this, nsnull);
return mWebShell->LoadURL(aURL, nsnull);
}
NS_IMETHODIMP

View File

@@ -138,6 +138,13 @@ void nsDocLoader::StartLoading()
if (mStart == PR_FALSE)
{
mStart = PR_TRUE;
// Enable observing each URL load...
nsIWebShell* shell = nsnull;
mBrowser->GetWebShell(shell);
shell->SetObserver((nsIStreamObserver*)this);
NS_RELEASE(shell);
if (mURLList)
{
if (mDocNum < mURLList->Count())
@@ -158,7 +165,6 @@ nsDocLoader::LoadDoc(PRInt32 aDocNum, PRBool aObserveIt)
mBrowser->GetWebShell(shell);
if (nsnull != shell) {
shell->LoadURL(*url, // URL string
aObserveIt ? this : nsnull, // Observer
nsnull); // Post Data
NS_RELEASE(shell);
}