Changed nsDocShellTreeOwner to call out to embedder's nsIWebBrowserSiteWindow interface instead of nsIBaseWindow. b=46852, sr=blizzard@mozilla.org

This commit is contained in:
locka%iol.ie 2001-02-02 12:52:44 +00:00
parent 189dae3f1d
commit 6aff77fe88
2 changed files with 84 additions and 98 deletions

View File

@ -268,187 +268,171 @@ NS_IMETHODIMP nsDocShellTreeOwner::GetNewWindow(PRInt32 aChromeFlags,
return NS_OK;
}
//*****************************************************************************
// nsDocShellTreeOwner::nsIBaseWindow
//*****************************************************************************
NS_IMETHODIMP nsDocShellTreeOwner::InitWindow(nativeWindow aParentNativeWindow,
nsIWidget* aParentWidget, PRInt32 aX, PRInt32 aY, PRInt32 aCX, PRInt32 aCY)
{
if (!mOwnerWin)
return NS_ERROR_NULL_POINTER;
return mOwnerWin->InitWindow(aParentNativeWindow, aParentWidget, aX, aY,
aCX, aCY);
}
NS_IMETHODIMP nsDocShellTreeOwner::Create()
{
if (!mOwnerWin)
return NS_ERROR_NULL_POINTER;
return mOwnerWin->Create();
}
NS_IMETHODIMP nsDocShellTreeOwner::Destroy()
{
if (!mOwnerWin)
return NS_ERROR_NULL_POINTER;
if (mOwnerWin)
{
return mOwnerWin->Destroy();
}
return NS_ERROR_NULL_POINTER;
}
NS_IMETHODIMP nsDocShellTreeOwner::SetPosition(PRInt32 aX, PRInt32 aY)
{
if (!mOwnerWin)
return NS_ERROR_NULL_POINTER;
if (mOwnerWin)
{
return mOwnerWin->SetPosition(aX, aY);
}
return NS_ERROR_NULL_POINTER;
}
NS_IMETHODIMP nsDocShellTreeOwner::GetPosition(PRInt32* aX, PRInt32* aY)
{
if (!mOwnerWin)
return NS_ERROR_NULL_POINTER;
if (mOwnerWin)
{
return mOwnerWin->GetPosition(aX, aY);
}
return NS_ERROR_NULL_POINTER;
}
NS_IMETHODIMP nsDocShellTreeOwner::SetSize(PRInt32 aCX, PRInt32 aCY, PRBool aRepaint)
{
if (!mOwnerWin)
return NS_ERROR_NULL_POINTER;
if (mOwnerWin)
{
return mOwnerWin->SetSize(aCX, aCY, aRepaint);
}
return NS_ERROR_NULL_POINTER;
}
NS_IMETHODIMP nsDocShellTreeOwner::GetSize(PRInt32* aCX, PRInt32* aCY)
{
if (!mOwnerWin)
return NS_ERROR_NULL_POINTER;
if (mOwnerWin)
{
return mOwnerWin->GetSize(aCX, aCY);
}
return NS_ERROR_NULL_POINTER;
}
NS_IMETHODIMP nsDocShellTreeOwner::SetPositionAndSize(PRInt32 aX, PRInt32 aY,
PRInt32 aCX, PRInt32 aCY, PRBool aRepaint)
{
if (!mOwnerWin)
return NS_ERROR_NULL_POINTER;
if (mOwnerWin)
{
return mOwnerWin->SetPositionAndSize(aX, aY, aCX, aCY, aRepaint);
}
return NS_ERROR_NULL_POINTER;
}
NS_IMETHODIMP nsDocShellTreeOwner::GetPositionAndSize(PRInt32* aX, PRInt32* aY,
PRInt32* aCX, PRInt32* aCY)
{
if (!mOwnerWin)
return NS_ERROR_NULL_POINTER;
if (mOwnerWin)
{
return mOwnerWin->GetPositionAndSize(aX, aY, aCX, aCY);
}
return NS_ERROR_NULL_POINTER;
}
NS_IMETHODIMP nsDocShellTreeOwner::Repaint(PRBool aForce)
{
if (!mOwnerWin)
return NS_ERROR_NULL_POINTER;
return mOwnerWin->Repaint(aForce);
}
NS_IMETHODIMP nsDocShellTreeOwner::GetParentWidget(nsIWidget** aParentWidget)
{
if (!mOwnerWin)
return NS_ERROR_NULL_POINTER;
return mOwnerWin->GetParentWidget(aParentWidget);
}
NS_IMETHODIMP nsDocShellTreeOwner::SetParentWidget(nsIWidget* aParentWidget)
{
if (!mOwnerWin)
return NS_ERROR_NULL_POINTER;
return mOwnerWin->SetParentWidget(aParentWidget);
}
NS_IMETHODIMP nsDocShellTreeOwner::GetParentNativeWindow(nativeWindow* aParentNativeWindow)
{
if (!mOwnerWin)
if (mOwnerWin)
{
return mOwnerWin->GetSiteWindow(aParentNativeWindow);
}
return NS_ERROR_NULL_POINTER;
return mOwnerWin->GetParentNativeWindow(aParentNativeWindow);
}
NS_IMETHODIMP nsDocShellTreeOwner::SetParentNativeWindow(nativeWindow aParentNativeWindow)
{
if (!mOwnerWin)
return NS_ERROR_NULL_POINTER;
return mOwnerWin->SetParentNativeWindow(aParentNativeWindow);
}
NS_IMETHODIMP nsDocShellTreeOwner::GetVisibility(PRBool* aVisibility)
{
if (!mOwnerWin)
return NS_ERROR_NULL_POINTER;
return mOwnerWin->GetVisibility(aVisibility);
}
NS_IMETHODIMP nsDocShellTreeOwner::SetVisibility(PRBool aVisibility)
{
if (!mOwnerWin)
return NS_ERROR_NULL_POINTER;
return mOwnerWin->SetVisibility(aVisibility);
}
NS_IMETHODIMP nsDocShellTreeOwner::GetMainWidget(nsIWidget** aMainWidget)
{
if (!mOwnerWin)
return NS_ERROR_NULL_POINTER;
return mOwnerWin->GetMainWidget(aMainWidget);
}
NS_IMETHODIMP nsDocShellTreeOwner::SetFocus()
{
if (!mOwnerWin)
return NS_ERROR_NULL_POINTER;
if (mOwnerWin)
{
return mOwnerWin->SetFocus();
}
return NS_ERROR_NULL_POINTER;
}
NS_IMETHODIMP nsDocShellTreeOwner::FocusAvailable(nsIBaseWindow* aCurrentFocus,
PRBool* aTookFocus)
{
if (!mOwnerWin)
return NS_ERROR_NULL_POINTER;
return mOwnerWin->FocusAvailable(aCurrentFocus, aTookFocus);
}
NS_IMETHODIMP nsDocShellTreeOwner::GetTitle(PRUnichar** aTitle)
{
if (!mOwnerWin)
return NS_ERROR_NULL_POINTER;
if (mOwnerWin)
{
return mOwnerWin->GetTitle(aTitle);
}
return NS_ERROR_NULL_POINTER;
}
NS_IMETHODIMP nsDocShellTreeOwner::SetTitle(const PRUnichar* aTitle)
{
if (!mOwnerWin)
return NS_ERROR_NULL_POINTER;
if (mOwnerWin)
{
return mOwnerWin->SetTitle(aTitle);
}
return NS_ERROR_NULL_POINTER;
}
//*****************************************************************************
// nsDocShellTreeOwner::nsIWebProgressListener
//*****************************************************************************
NS_IMETHODIMP
nsDocShellTreeOwner::OnProgressChange(nsIWebProgress* aProgress,
nsIRequest* aRequest,
@ -546,14 +530,15 @@ NS_IMETHODIMP nsDocShellTreeOwner::SetWebBrowserChrome(nsIWebBrowserChrome* aWeb
mOwnerWin = nsnull;
mOwnerRequestor = nsnull;
}
else {
nsCOMPtr<nsIBaseWindow> baseWin(do_QueryInterface(aWebBrowserChrome));
else
{
nsCOMPtr<nsIWebBrowserSiteWindow> ownerWin(do_QueryInterface(aWebBrowserChrome));
nsCOMPtr<nsIInterfaceRequestor> requestor(do_QueryInterface(aWebBrowserChrome));
NS_ENSURE_TRUE(baseWin, NS_ERROR_INVALID_ARG);
NS_ENSURE_TRUE(ownerWin, NS_ERROR_INVALID_ARG);
mWebBrowserChrome = aWebBrowserChrome;
mOwnerWin = baseWin;
mOwnerWin = ownerWin;
mOwnerRequestor = requestor;
}
return NS_OK;

View File

@ -36,6 +36,7 @@
#include "nsIDOMDocument.h"
#include "nsIChromeEventHandler.h"
#include "nsIDOMEventReceiver.h"
#include "nsIWebBrowserSiteWindow.h"
#include "nsIWebProgressListener.h"
#include "nsWeakReference.h"
#include "nsIDOMKeyListener.h"
@ -102,7 +103,7 @@ protected:
nsIDocShellTreeItem* mPrimaryContentShell;
nsIWebBrowserChrome* mWebBrowserChrome;
nsIBaseWindow* mOwnerWin;
nsIWebBrowserSiteWindow* mOwnerWin;
nsIInterfaceRequestor* mOwnerRequestor;
// the object that listens for chrome events like context menus and tooltips.