Updated to use nsIEmbeddingSiteWindow, sr=blizzard@mozilla.org b=68581

git-svn-id: svn://10.0.0.236/trunk@89495 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
locka%iol.ie
2001-03-13 12:21:34 +00:00
parent 94d7c14648
commit 8daaabb0f2
20 changed files with 541 additions and 499 deletions

View File

@@ -243,7 +243,9 @@ EmbedPrivate::Hide(void)
void
EmbedPrivate::Resize(PRUint32 aWidth, PRUint32 aHeight)
{
mWindow->SetPositionAndSize(0, 0, aWidth, aHeight, PR_FALSE);
mWindow->SetDimensions(nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION |
nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_INNER,
0, 0, aWidth, aHeight);
}
void

View File

@@ -98,7 +98,7 @@ NS_IMPL_RELEASE(EmbedWindow)
NS_INTERFACE_MAP_BEGIN(EmbedWindow)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIWebBrowserChrome)
NS_INTERFACE_MAP_ENTRY(nsIWebBrowserChrome)
NS_INTERFACE_MAP_ENTRY(nsIWebBrowserSiteWindow)
NS_INTERFACE_MAP_ENTRY(nsIEmbeddingSiteWindow)
NS_INTERFACE_MAP_ENTRY(nsITooltipListener)
NS_INTERFACE_MAP_ENTRY(nsIPrompt)
NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
@@ -193,6 +193,14 @@ EmbedWindow::CreateBrowserWindow(PRUint32 aChromeFlags,
}
NS_IMETHODIMP
EmbedWindow::DestroyBrowserWindow(void)
{
gtk_signal_emit(GTK_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[DESTROY_BROWSER]);
return NS_OK;
}
NS_IMETHODIMP
EmbedWindow::SizeBrowserTo(PRInt32 aCX, PRInt32 aCY)
{
@@ -219,53 +227,42 @@ EmbedWindow::ExitModalEventLoop(nsresult aStatus)
return NS_ERROR_NOT_IMPLEMENTED;
}
// nsIWebBrowserSiteWindow
// nsIEmbeddingSiteWindow
NS_IMETHODIMP
EmbedWindow::Destroy(void)
EmbedWindow::SetDimensions(PRUint32 aFlags, PRInt32 aX, PRInt32 aY, PRInt32 aCX, PRInt32 aCY)
{
gtk_signal_emit(GTK_OBJECT(mOwner->mOwningWidget),
moz_embed_signals[DESTROY_BROWSER]);
return NS_OK;
if (aFlags & nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION &&
(aFlags & nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_INNER ||
aFlags & nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER)) {
return mBaseWindow->SetPositionAndSize(aX, aY, aCX, aCY, PR_TRUE);
}
else if (aFlags & nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION) {
return mBaseWindow->SetPosition(aX, aY);
}
else if (aFlags & nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_INNER ||
aFlags & nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER) {
return mBaseWindow->SetSize(aCX, aCY, PR_TRUE);
}
return NS_ERROR_INVALID_ARG;
}
NS_IMETHODIMP
EmbedWindow::SetPosition(PRInt32 aX, PRInt32 aY)
EmbedWindow::GetDimensions(PRUint32 aFlags, PRInt32 *aX, PRInt32 *aY, PRInt32 *aCX, PRInt32 *aCY)
{
return mBaseWindow->SetPosition(aX, aY);
}
NS_IMETHODIMP
EmbedWindow::GetPosition(PRInt32 *aX, PRInt32 *aY)
{
return mBaseWindow->GetPosition(aX, aY);
}
NS_IMETHODIMP
EmbedWindow::SetSize(PRInt32 aX, PRInt32 aY, PRBool aRepaint)
{
return mBaseWindow->SetSize(aX, aY, aRepaint);
}
NS_IMETHODIMP
EmbedWindow::GetSize(PRInt32 *aX, PRInt32 *aY)
{
return mBaseWindow->GetSize(aX, aY);
}
NS_IMETHODIMP
EmbedWindow::SetPositionAndSize(PRInt32 aX, PRInt32 aY,
PRInt32 aWidth, PRInt32 aHeight,
PRBool aRepaint)
{
return mBaseWindow->SetPositionAndSize(aX, aY, aWidth, aHeight, aRepaint);
}
NS_IMETHODIMP
EmbedWindow::GetPositionAndSize(PRInt32 *aX, PRInt32 *aY,
PRInt32 *aWidth, PRInt32 *aHeight)
{
return mBaseWindow->GetPositionAndSize(aX, aY, aWidth, aHeight);
if (aFlags & nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION &&
(aFlags & nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_INNER ||
aFlags & nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER)) {
return mBaseWindow->GetPositionAndSize(aX, aY, aCX, aCY);
}
else if (aFlags & nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION) {
return mBaseWindow->GetPosition(aX, aY);
}
else if (aFlags & nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_INNER ||
aFlags & nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER) {
return mBaseWindow->GetSize(aCX, aCY);
}
return NS_ERROR_INVALID_ARG;
}
NS_IMETHODIMP
@@ -297,6 +294,18 @@ EmbedWindow::GetSiteWindow(void **aSiteWindow)
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
EmbedWindow::GetVisibility(PRBool *aVisibility)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
EmbedWindow::SetVisibility(PRBool aVisibility)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
// nsITooltipListener
NS_IMETHODIMP

View File

@@ -23,7 +23,7 @@
#define __EmbedWindow_h
#include <nsIWebBrowserChrome.h>
#include <nsIWebBrowserSiteWindow.h>
#include <nsIEmbeddingSiteWindow.h>
#include <nsITooltipListener.h>
#include <nsIPrompt.h>
#include <nsISupports.h>
@@ -37,7 +37,7 @@
class EmbedPrivate;
class EmbedWindow : public nsIWebBrowserChrome,
public nsIWebBrowserSiteWindow,
public nsIEmbeddingSiteWindow,
public nsITooltipListener,
public nsIPrompt,
public nsIInterfaceRequestor
@@ -56,7 +56,7 @@ class EmbedWindow : public nsIWebBrowserChrome,
NS_DECL_NSIWEBBROWSERCHROME
NS_DECL_NSIWEBBROWSERSITEWINDOW
NS_DECL_NSIEMBEDDINGSITEWINDOW
NS_DECL_NSITOOLTIPLISTENER

View File

@@ -94,7 +94,7 @@ NS_INTERFACE_MAP_BEGIN(GtkMozEmbedChrome)
NS_INTERFACE_MAP_ENTRY(nsIWebBrowserChrome)
NS_INTERFACE_MAP_ENTRY(nsIURIContentListener)
NS_INTERFACE_MAP_ENTRY(nsIDocShellTreeOwner)
NS_INTERFACE_MAP_ENTRY(nsIWebBrowserSiteWindow)
NS_INTERFACE_MAP_ENTRY(nsIEmbeddingSiteWindow)
NS_INTERFACE_MAP_ENTRY(nsIPrompt)
NS_INTERFACE_MAP_ENTRY(nsIBaseWindow)
NS_INTERFACE_MAP_ENTRY(nsITooltipListener)
@@ -440,6 +440,14 @@ NS_IMETHODIMP GtkMozEmbedChrome::CreateBrowserWindow(PRUint32 chromeMask,
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP GtkMozEmbedChrome::DestroyBrowserWindow(void)
{
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("GtkMozEmbedChrome::DestroyBrowserWindow\n"));
if (mChromeListener)
mChromeListener->Destroy();
return NS_OK;
}
#if 0
/* Just commenting out for now because it looks like somebody went to
a lot of work here. This method has been removed from nsIWebBrowserChrome
@@ -725,76 +733,37 @@ GtkMozEmbedChrome::GetPersistence(PRBool* aPersistPosition,
// nsIWebBrowserSiteWindow interface
NS_IMETHODIMP GtkMozEmbedChrome::Destroy(void)
NS_IMETHODIMP GtkMozEmbedChrome::SetDimensions(PRUint32 aFlags, PRInt32 x, PRInt32 y, PRInt32 cx, PRInt32 cy)
{
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("GtkMozEmbedChrome::Destory\n"));
if (mChromeListener)
mChromeListener->Destroy();
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("GtkMozEmbedChrome::SetDimensions\n"));
if (aFlags & DIM_FLAGS_POSITION) {
mBounds.x = x;
mBounds.y = y;
}
// Treat inner and outer dimensions the same
if (aFlags & DIM_FLAGS_SIZE_INNER || aFlags & DIM_FLAGS_SIZE_OUTER) {
mBounds.width = cx;
mBounds.height = cy;
}
return NS_OK;
}
NS_IMETHODIMP GtkMozEmbedChrome::SetPosition(PRInt32 x, PRInt32 y)
NS_IMETHODIMP GtkMozEmbedChrome::GetDimensions(PRUint32 aFlags, PRInt32 *x, PRInt32 *y, PRInt32 *cx, PRInt32 *cy)
{
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("GtkMozEmbedChrome::SetPosition\n"));
mBounds.x = x;
mBounds.y = y;
return NS_OK;
}
NS_IMETHODIMP GtkMozEmbedChrome::GetPosition(PRInt32 *x, PRInt32 *y)
{
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("GtkMozEmbedChrome::GetPosition\n"));
if (x)
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("GtkMozEmbedChrome::GetDimensions\n"));
if (aFlags & DIM_FLAGS_POSITION) {
NS_ENSURE_ARG_POINTER(x);
NS_ENSURE_ARG_POINTER(y);
*x = mBounds.x;
if (y)
*y = mBounds.y;
return NS_OK;
}
NS_IMETHODIMP GtkMozEmbedChrome::SetSize(PRInt32 cx, PRInt32 cy, PRBool fRepaint)
{
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("GtkMozEmbedChrome::SetSize\n"));
mBounds.width = cx;
mBounds.height = cy;
return NS_OK;
}
NS_IMETHODIMP GtkMozEmbedChrome::GetSize(PRInt32 *cx, PRInt32 *cy)
{
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("GtkMozEmbedChrome::GetSize\n"));
if (cx)
}
// Treat inner and outer dimensions the same
if (aFlags & DIM_FLAGS_SIZE_INNER | aFlags & DIM_FLAGS_SIZE_OUTER) {
NS_ENSURE_ARG_POINTER(cx);
NS_ENSURE_ARG_POINTER(cy);
*cx = mBounds.width;
if (cy)
*cy = mBounds.height;
return NS_OK;
}
NS_IMETHODIMP GtkMozEmbedChrome::SetPositionAndSize(PRInt32 x, PRInt32 y,
PRInt32 cx, PRInt32 cy,
PRBool fRepaint)
{
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("GtkMozEmbedChrome::SetPositionAndSize %d %d %d %d\n",
x, y, cx, cy));
mBounds.x = x;
mBounds.y = y;
mBounds.width = cx;
mBounds.height = cy;
return NS_OK;
}
NS_IMETHODIMP GtkMozEmbedChrome::GetPositionAndSize(PRInt32 *x, PRInt32 *y,
PRInt32 *cx, PRInt32 *cy)
{
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("GtkMozEmbedChrome::GetPositionAndSize %d %d %d %d\n",
mBounds.x, mBounds.y, mBounds.width, mBounds.height));
NS_ENSURE_ARG_POINTER(x);
NS_ENSURE_ARG_POINTER(y);
NS_ENSURE_ARG_POINTER(cx);
NS_ENSURE_ARG_POINTER(cy);
*x = mBounds.x;
*y = mBounds.y;
*cx = mBounds.width;
*cy = mBounds.height;
}
return NS_OK;
}
@@ -803,6 +772,23 @@ NS_IMETHODIMP GtkMozEmbedChrome::GetSiteWindow(void * *aParentNativeWindow)
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("GtkMozEmbedChrome::GetSiteWindow\n"));
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP GtkMozEmbedChrome::GetVisibility(PRBool *aVisibility)
{
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("GtkMozEmbedChrome::GetVisibility\n"));
NS_ENSURE_ARG_POINTER(aVisibility);
*aVisibility = mVisibility;
return NS_OK;
}
NS_IMETHODIMP GtkMozEmbedChrome::SetVisibility(PRBool aVisibility)
{
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("GtkMozEmbedChrome::SetVisibility\n"));
if (mChromeListener)
mChromeListener->Visibility(aVisibility);
mVisibility = aVisibility;
return NS_OK;
}
NS_IMETHODIMP GtkMozEmbedChrome::SetFocus(void)
{
@@ -1141,6 +1127,12 @@ GtkMozEmbedChrome::Create(void)
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
GtkMozEmbedChrome::Destroy(void)
{
return DestroyBrowserWindow();
}
NS_IMETHODIMP
GtkMozEmbedChrome::Repaint(PRBool force)
{
@@ -1171,22 +1163,6 @@ GtkMozEmbedChrome::SetParentNativeWindow(nativeWindow aParentNativeWindow)
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
GtkMozEmbedChrome::GetVisibility(PRBool *aVisibility)
{
NS_ENSURE_ARG_POINTER(aVisibility);
*aVisibility = mVisibility;
return NS_OK;
}
NS_IMETHODIMP
GtkMozEmbedChrome::SetVisibility(PRBool aVisibility)
{
mVisibility = aVisibility;
if (mChromeListener)
mChromeListener->Visibility(aVisibility);
return NS_OK;
}
NS_IMETHODIMP
GtkMozEmbedChrome::GetMainWidget(nsIWidget * *aMainWidget)
@@ -1199,3 +1175,46 @@ GtkMozEmbedChrome::FocusAvailable(nsIBaseWindow *aCurrentFocus, PRBool *aTookFoc
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP GtkMozEmbedChrome::GetPosition(PRInt32 *x, PRInt32 *y)
{
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("GtkMozEmbedChrome::GetPosition\n"));
return GetDimensions(DIM_FLAGS_POSITION, x, y, nsnull, nsnull);
}
NS_IMETHODIMP GtkMozEmbedChrome::SetPosition(PRInt32 x, PRInt32 y)
{
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("GtkMozEmbedChrome::SetPosition\n"));
return SetDimensions(DIM_FLAGS_POSITION, x, y, 0, 0);
}
NS_IMETHODIMP GtkMozEmbedChrome::GetSize(PRInt32 *cx, PRInt32 *cy)
{
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("GtkMozEmbedChrome::GetSize\n"));
return GetDimensions(DIM_FLAGS_SIZE_INNER, nsnull, nsnull, cx, cy);
}
NS_IMETHODIMP GtkMozEmbedChrome::SetSize(PRInt32 cx, PRInt32 cy, PRBool fRepaint)
{
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("GtkMozEmbedChrome::GetSize\n"));
return SetDimensions(DIM_FLAGS_SIZE_INNER, 0, 0, cx, cy);
}
NS_IMETHODIMP GtkMozEmbedChrome::SetPositionAndSize(PRInt32 x, PRInt32 y,
PRInt32 cx, PRInt32 cy,
PRBool fRepaint)
{
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("GtkMozEmbedChrome::SetPositionAndSize %d %d %d %d\n",
x, y, cx, cy));
return SetDimensions(DIM_FLAGS_POSITION | DIM_FLAGS_SIZE_INNER, x, y, cx, cy);
}
NS_IMETHODIMP GtkMozEmbedChrome::GetPositionAndSize(PRInt32 *x, PRInt32 *y,
PRInt32 *cx, PRInt32 *cy)
{
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("GtkMozEmbedChrome::GetPositionAndSize %d %d %d %d\n",
mBounds.x, mBounds.y, mBounds.width, mBounds.height));
return GetDimensions(DIM_FLAGS_POSITION | DIM_FLAGS_SIZE_INNER, x, y, cx, cy);
}

View File

@@ -28,7 +28,7 @@
// we will implement these interfaces
#include "nsIGtkEmbed.h"
#include "nsIWebBrowserChrome.h"
#include "nsIWebBrowserSiteWindow.h"
#include "nsIEmbeddingSiteWindow.h"
#include "nsIURIContentListener.h"
#include "nsIWebProgressListener.h"
#include "nsIWebProgress.h"
@@ -56,7 +56,7 @@
class GtkMozEmbedChrome : public nsIGtkEmbed,
public nsIWebBrowserChrome,
public nsIWebBrowserSiteWindow,
public nsIEmbeddingSiteWindow,
public nsIURIContentListener,
public nsIDocShellTreeOwner,
public nsIInterfaceRequestor,
@@ -93,7 +93,7 @@ public:
NS_DECL_NSIDOCSHELLTREEOWNER
NS_DECL_NSIWEBBROWSERSITEWINDOW
NS_DECL_NSIEMBEDDINGSITEWINDOW
NS_DECL_NSIPROMPT
@@ -104,15 +104,20 @@ public:
nsIWidget * parentWidget,
PRInt32 x, PRInt32 y, PRInt32 cx, PRInt32 cy);
NS_IMETHOD Create(void);
NS_IMETHOD Destroy(void);
NS_IMETHOD Repaint(PRBool force);
NS_IMETHOD GetParentWidget(nsIWidget * *aParentWidget);
NS_IMETHOD SetParentWidget(nsIWidget * aParentWidget);
NS_IMETHOD GetParentNativeWindow(nativeWindow *aParentNativeWindow);
NS_IMETHOD SetParentNativeWindow(nativeWindow aParentNativeWindow);
NS_IMETHOD GetVisibility(PRBool *aVisibility);
NS_IMETHOD SetVisibility(PRBool aVisibility);
NS_IMETHOD GetMainWidget(nsIWidget * *aMainWidget);
NS_IMETHOD FocusAvailable(nsIBaseWindow *aCurrentFocus, PRBool *aTookFocus);
NS_IMETHOD SetPosition(PRInt32 x, PRInt32 y);
NS_IMETHOD GetPosition(PRInt32 *x, PRInt32 *y);
NS_IMETHOD GetSize(PRInt32 *cx, PRInt32 *cy);
NS_IMETHOD SetSize(PRInt32 cx, PRInt32 cy, PRBool fRepaint);
NS_IMETHOD SetPositionAndSize(PRInt32 x, PRInt32 y, PRInt32 cx, PRInt32 cy, PRBool fRepaint);
NS_IMETHOD GetPositionAndSize(PRInt32 *x, PRInt32 *y, PRInt32 *cx, PRInt32 *cy);
private:
GtkWidget *mOwningGtkWidget;

View File

@@ -378,11 +378,12 @@ GtkMozEmbedPrivate::Resize(GtkWidget *aWidget)
aWidget->allocation.width,
aWidget->allocation.height,
PR_TRUE);
nsCOMPtr<nsIWebBrowserSiteWindow> embedSiteWindow = do_QueryInterface(mEmbed);
embedSiteWindow->SetPositionAndSize(0, 0,
aWidget->allocation.width,
aWidget->allocation.height,
PR_TRUE);
nsCOMPtr<nsIEmbeddingSiteWindow> embedSiteWindow = do_QueryInterface(mEmbed);
embedSiteWindow->SetDimensions(nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION |
nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_INNER,
0, 0,
aWidget->allocation.width,
aWidget->allocation.height);
return NS_OK;
}

View File

@@ -48,11 +48,12 @@
// Interfaces needed to be included
// Defines
#define USE_BALLOONS_FOR_TOOL_TIPS 0 // Using balloons for this is really obnoxious
// Constants
const PRInt32 kGrowIconSize = 15;
// Static Variables
vector<CWebBrowserChrome*> CWebBrowserChrome::mgBrowserList;
class CWebBrowserPrompter : public nsIPrompt
{
@@ -89,15 +90,10 @@ CWebBrowserChrome::CWebBrowserChrome() :
mBrowserWindow(nsnull), mBrowserShell(nsnull), mPreviousBalloonState(false)
{
NS_INIT_REFCNT();
mgBrowserList.push_back(this);
}
CWebBrowserChrome::~CWebBrowserChrome()
{
vector<CWebBrowserChrome*>::iterator iter = find(mgBrowserList.begin(), mgBrowserList.end(), this);
if (iter != mgBrowserList.end())
mgBrowserList.erase(iter);
}
//*****************************************************************************
@@ -112,7 +108,7 @@ NS_INTERFACE_MAP_BEGIN(CWebBrowserChrome)
NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
NS_INTERFACE_MAP_ENTRY(nsIWebBrowserChrome)
NS_INTERFACE_MAP_ENTRY(nsIWebProgressListener)
NS_INTERFACE_MAP_ENTRY(nsIWebBrowserSiteWindow)
NS_INTERFACE_MAP_ENTRY(nsIEmbeddingSiteWindow)
NS_INTERFACE_MAP_ENTRY(nsIPrompt)
NS_INTERFACE_MAP_ENTRY(nsIContextMenuListener)
NS_INTERFACE_MAP_ENTRY(nsITooltipListener)
@@ -217,13 +213,6 @@ NS_IMETHODIMP CWebBrowserChrome::CreateBrowserWindow(PRUint32 chromeMask, PRInt3
{
// CreateWindow can throw an we're being called from mozilla, so we need to catch
theWindow = CBrowserWindow::CreateWindow(chromeMask, aCX, aCY);
// HACK Alert: Because nsIWebBrowserSiteWindow does not have a visibility attribute,
// our window will never be told to show itself. If we want it ever to show, we have
// to do it here. Once <http://bugzilla.mozilla.org/show_bug.cgi?id=68581> is fixed,
// remove this.
theWindow->SetVisibility(PR_TRUE);
}
catch (...)
{
@@ -235,7 +224,12 @@ NS_IMETHODIMP CWebBrowserChrome::CreateBrowserWindow(PRUint32 chromeMask, PRInt3
return aBrowserShell->GetWebBrowser(aWebBrowser);
}
/* boolean isWindowModal (); */
NS_IMETHODIMP CWebBrowserChrome::DestroyBrowserWindow()
{
delete mBrowserWindow;
return NS_OK;
}
NS_IMETHODIMP CWebBrowserChrome::IsWindowModal(PRBool *_retval)
{
*_retval = PR_FALSE;
@@ -243,42 +237,6 @@ NS_IMETHODIMP CWebBrowserChrome::IsWindowModal(PRBool *_retval)
}
#if 0
/* Just commenting out for now because it looks like somebody went to
a lot of work here. This method has been removed from nsIWebBrowserChrome
per the 5 Feb 01 API review, to be handled one level further down
in nsDocShellTreeOwner.
*/
NS_IMETHODIMP CWebBrowserChrome::FindNamedBrowserItem(const PRUnichar* aName,
nsIDocShellTreeItem ** aBrowserItem)
{
NS_ENSURE_ARG(aName);
NS_ENSURE_ARG_POINTER(aBrowserItem);
*aBrowserItem = nsnull;
vector<CWebBrowserChrome*>::iterator iter = mgBrowserList.begin();
while (iter < mgBrowserList.end())
{
CWebBrowserChrome* aChrome = *iter++;
if (aChrome == this)
continue; // Our tree has already been searched???
NS_ENSURE_TRUE(aChrome->BrowserShell(), NS_ERROR_FAILURE);
nsCOMPtr<nsIWebBrowser> webBrowser;
aChrome->BrowserShell()->GetWebBrowser(getter_AddRefs(webBrowser));
nsCOMPtr<nsIDocShellTreeItem> docShellAsItem(do_QueryInterface(webBrowser));
NS_ENSURE_TRUE(docShellAsItem, NS_ERROR_FAILURE);
docShellAsItem->FindItemWithName(aName, NS_STATIC_CAST(nsIWebBrowserChrome*, this), aBrowserItem);
if (*aBrowserItem)
break;
}
return NS_OK; // Return OK even if we didn't find it???
}
#endif
NS_IMETHODIMP CWebBrowserChrome::SizeBrowserTo(PRInt32 aCX, PRInt32 aCY)
{
mBrowserWindow->ResizeWindowTo(aCX, aCY + kGrowIconSize);
@@ -371,106 +329,134 @@ CWebBrowserChrome::OnSecurityChange(nsIWebProgress *aWebProgress,
//*****************************************************************************
// CWebBrowserChrome::nsIWebBrowserSiteWindow
// CWebBrowserChrome::nsIEmbeddingSiteWindow
//*****************************************************************************
NS_IMETHODIMP CWebBrowserChrome::Destroy()
NS_IMETHODIMP CWebBrowserChrome::SetDimensions(PRUint32 flags, PRInt32 x, PRInt32 y, PRInt32 cx, PRInt32 cy)
{
delete mBrowserWindow;
return NS_OK;
NS_ENSURE_STATE(mBrowserWindow);
nsresult rv = NS_OK;
CBrowserShell *browserShell;
if (flags & nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION) // setting position
{
if (flags & nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_INNER)
{
// Don't allow setting the position of the embedded area
rv = NS_ERROR_UNEXPECTED;
}
else // (flags & nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER)
{
mBrowserWindow->MoveWindowTo(x, y);
}
}
else // setting size
{
if (flags & nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_INNER)
{
browserShell = mBrowserWindow->GetBrowserShell();
NS_ENSURE_TRUE(browserShell, NS_ERROR_NULL_POINTER);
SDimension16 curSize;
browserShell->GetFrameSize(curSize);
mBrowserWindow->ResizeWindowBy(cx - curSize.width, cy - curSize.height);
}
else // (flags & nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER)
{
if (mBrowserWindow->HasAttribute(windAttr_Resizable /*windAttr_SizeBox*/))
cy += 15;
mBrowserWindow->ResizeWindowTo(cx, cy);
}
}
return rv;
}
NS_IMETHODIMP CWebBrowserChrome::SetPosition(PRInt32 x, PRInt32 y)
NS_IMETHODIMP CWebBrowserChrome::GetDimensions(PRUint32 flags, PRInt32 *x, PRInt32 *y, PRInt32 *cx, PRInt32 *cy)
{
NS_ENSURE_TRUE(mBrowserWindow, NS_ERROR_NOT_INITIALIZED);
NS_ENSURE_STATE(mBrowserWindow);
mBrowserWindow->MoveWindowTo(x, y);
return NS_OK;
}
NS_IMETHODIMP CWebBrowserChrome::GetPosition(PRInt32* x, PRInt32* y)
{
NS_ENSURE_TRUE(mBrowserWindow, NS_ERROR_NOT_INITIALIZED);
Rect bounds;
mBrowserWindow->GetGlobalBounds(bounds);
if (x)
*x = bounds.left;
if (y)
*y = bounds.top;
return NS_OK;
}
NS_IMETHODIMP CWebBrowserChrome::SetSize(PRInt32 cx, PRInt32 cy, PRBool fRepaint)
{
NS_ENSURE_TRUE(mBrowserWindow, NS_ERROR_NOT_INITIALIZED);
mBrowserWindow->ResizeWindowTo(cx, cy + kGrowIconSize);
return NS_OK;
}
NS_IMETHODIMP CWebBrowserChrome::GetSize(PRInt32* cx, PRInt32* cy)
{
NS_ENSURE_TRUE(mBrowserWindow, NS_ERROR_NOT_INITIALIZED);
Rect bounds;
mBrowserWindow->GetGlobalBounds(bounds);
if (cx)
*cx = bounds.right - bounds.left;
if (cy)
*cy = bounds.bottom - bounds.top - kGrowIconSize;
return NS_OK;
}
NS_IMETHODIMP CWebBrowserChrome::SetPositionAndSize(PRInt32 x, PRInt32 y, PRInt32 cx, PRInt32 cy, PRBool fRepaint)
{
NS_ENSURE_TRUE(mBrowserWindow, NS_ERROR_NOT_INITIALIZED);
Rect bounds;
bounds.top = y;
bounds.left = x;
bounds.bottom = y + cy + kGrowIconSize;
bounds.right = x + cx;
mBrowserWindow->DoSetBounds(bounds);
return NS_OK;
}
NS_IMETHODIMP CWebBrowserChrome::GetPositionAndSize(PRInt32* x, PRInt32* y, PRInt32* cx, PRInt32* cy)
{
NS_ENSURE_ARG_POINTER(x && y && cx && cy);
NS_ENSURE_TRUE(mBrowserWindow, NS_ERROR_NOT_INITIALIZED);
Rect bounds;
mBrowserWindow->GetGlobalBounds(bounds);
*x = bounds.left;
*y = bounds.top;
*cx = bounds.right - bounds.left;
*cy = bounds.bottom - bounds.top - kGrowIconSize;
return NS_OK;
}
NS_IMETHODIMP CWebBrowserChrome::GetSiteWindow(void ** aParentNativeWindow)
{
NS_ENSURE_ARG_POINTER(aParentNativeWindow);
//XXX First Check In
NS_ASSERTION(PR_FALSE, "Not Yet Implemented");
return NS_OK;
nsresult rv = NS_OK;
CBrowserShell *browserShell;
Rect bounds;
if (flags & nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION) // getting position
{
if (flags & nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_INNER)
{
browserShell = mBrowserWindow->GetBrowserShell();
NS_ENSURE_TRUE(browserShell, NS_ERROR_NULL_POINTER);
SPoint32 curPos;
browserShell->GetFrameLocation(curPos);
if (x)
*x = curPos.h;
if (y)
*y = curPos.v;
}
else // (flags & nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER)
{
mBrowserWindow->GetGlobalBounds(bounds);
if (x)
*x = bounds.left;
if (y)
*y = bounds.top;
}
}
else // getting size
{
if (flags & nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_INNER)
{
browserShell = mBrowserWindow->GetBrowserShell();
NS_ENSURE_TRUE(browserShell, NS_ERROR_NULL_POINTER);
SDimension16 curSize;
browserShell->GetFrameSize(curSize);
if (cx)
*cx = curSize.width;
if (cy)
*cy = curSize.height;
}
else // (flags & nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER)
{
mBrowserWindow->GetGlobalBounds(bounds);
if (cx)
*cx = bounds.right - bounds.left;
if (cy)
{
*cy = bounds.bottom - bounds.top;
if (mBrowserWindow->HasAttribute(windAttr_Resizable /*windAttr_SizeBox*/))
*cy -= 15;
}
}
}
return rv;
}
NS_IMETHODIMP CWebBrowserChrome::SetFocus()
{
//XXX First Check In
NS_ASSERTION(PR_FALSE, "Not Yet Implemented");
return NS_OK;
NS_ASSERTION(PR_FALSE, "Not Yet Implemented");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP CWebBrowserChrome::GetTitle(PRUnichar** aTitle)
NS_IMETHODIMP CWebBrowserChrome::GetVisibility(PRBool *aVisibility)
{
NS_ENSURE_STATE(mBrowserWindow);
NS_ENSURE_ARG_POINTER(aVisibility);
*aVisibility = mBrowserWindow->IsVisible();
return NS_OK;
}
NS_IMETHODIMP CWebBrowserChrome::SetVisibility(PRBool aVisibility)
{
NS_ENSURE_STATE(mBrowserWindow);
mBrowserWindow->SetVisibility(aVisibility);
return NS_OK;
}
NS_IMETHODIMP CWebBrowserChrome::GetTitle(PRUnichar * *aTitle)
{
NS_ENSURE_ARG_POINTER(aTitle);
NS_ENSURE_STATE(mBrowserWindow);
NS_ENSURE_ARG_POINTER(aTitle);
Str255 pStr;
nsAutoString titleStr;
@@ -482,18 +468,23 @@ NS_IMETHODIMP CWebBrowserChrome::GetTitle(PRUnichar** aTitle)
return NS_OK;
}
NS_IMETHODIMP CWebBrowserChrome::SetTitle(const PRUnichar* aTitle)
NS_IMETHODIMP CWebBrowserChrome::SetTitle(const PRUnichar * aTitle)
{
NS_ENSURE_STATE(mBrowserWindow);
NS_ENSURE_ARG(aTitle);
Str255 pStr;
CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsLiteralString(aTitle), pStr);
mBrowserWindow->SetDescriptor(pStr);
return NS_OK;
}
NS_IMETHODIMP CWebBrowserChrome::GetSiteWindow(void * *aSiteWindow)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
//*****************************************************************************
// CWebBrowserChrome::nsIPrompt
//*****************************************************************************
@@ -1055,10 +1046,14 @@ CBrowserShell*& CWebBrowserChrome::BrowserShell()
NS_IMETHODIMP
CWebBrowserChrome::OnShowTooltip(PRInt32 aXCoords, PRInt32 aYCoords, const PRUnichar *aTipText)
{
nsAutoString tipText ( aTipText );
const char* printable = tipText.ToNewCString();
printf("--------- SHOW TOOLTIP AT %ld %ld, |%s|\n", aXCoords, aYCoords, printable );
nsCAutoString printable;
CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsLiteralString(aTipText), printable);
#ifdef DEBUG
printf("--------- SHOW TOOLTIP AT %ld %ld, |%s|\n", aXCoords, aYCoords, (const char *)printable );
#endif
#if USE_BALLOONS_FOR_TOOL_TIPS
Point where;
::GetMouse ( &where );
::LocalToGlobal ( &where );
@@ -1071,17 +1066,22 @@ CWebBrowserChrome::OnShowTooltip(PRInt32 aXCoords, PRInt32 aYCoords, const PRUni
mPreviousBalloonState = ::HMGetBalloons();
::HMSetBalloons ( true );
OSErr err = ::HMShowBalloon ( &helpRec, where, NULL, NULL, 0, 0, 0 );
nsMemory::Free( (void*)printable );
#endif
return NS_OK;
}
NS_IMETHODIMP
CWebBrowserChrome::OnHideTooltip()
{
#ifdef DEBUG
printf("--------- HIDE TOOLTIP\n");
#endif
#if USE_BALLOONS_FOR_TOOL_TIPS
::HMRemoveBalloon();
::HMSetBalloons ( mPreviousBalloonState );
return NS_OK;
#endif
return NS_OK;
}

View File

@@ -24,7 +24,7 @@ nsCWebBrowser.idl
nsIWebBrowser.idl
nsIWebBrowserChrome.idl
nsIWebBrowserSetup.idl
nsIEmbeddingSiteWindow.idl
nsIWebBrowserPersist.idl
nsIWebBrowserFocus.idl
nsIWebBrowserSiteWindow.idl
nsIWebBrowserFind.idl

View File

@@ -37,7 +37,7 @@ XPIDLSRCS = \
nsIWebBrowserSetup.idl \
nsICommandHandler.idl \
nsIContextMenuListener.idl \
nsIWebBrowserSiteWindow.idl \
nsIEmbeddingSiteWindow.idl \
nsITooltipListener.idl \
nsIWebBrowserPersist.idl \
nsIWebBrowserFocus.idl \

View File

@@ -22,34 +22,34 @@
DEPTH=..\..\..
MODULE=webBrowser_core
XPIDLSRCS= \
.\nsIContextMenuListener.idl \
.\nsITooltipListener.idl \
.\nsCWebBrowser.idl \
.\nsIWebBrowser.idl \
.\nsIWebBrowserChrome.idl \
.\nsICommandHandler.idl \
.\nsIWebBrowserSetup.idl \
.\nsIWebBrowserPersist.idl \
.\nsIWebBrowserSiteWindow.idl \
.\nsIWebBrowserFocus.idl \
.\nsIWebBrowserFind.idl \
$(NULL)
XPIDLSRCS= \
.\nsIContextMenuListener.idl \
.\nsITooltipListener.idl \
.\nsCWebBrowser.idl \
.\nsIWebBrowser.idl \
.\nsIWebBrowserChrome.idl \
.\nsICommandHandler.idl \
.\nsIWebBrowserSetup.idl \
.\nsIWebBrowserPersist.idl \
.\nsIEmbeddingSiteWindow.idl \
.\nsIWebBrowserFocus.idl \
.\nsIWebBrowserFind.idl \
$(NULL)
LIBRARY_NAME=nsWebBrowser_s
CPP_OBJS= \
.\$(OBJDIR)\nsDocShellTreeOwner.obj \
.\$(OBJDIR)\nsWBURIContentListener.obj \
.\$(OBJDIR)\nsWebBrowser.obj \
.\$(OBJDIR)\nsCommandHandler.obj \
.\$(OBJDIR)\nsWebBrowserPersist.obj \
.\$(OBJDIR)\nsDOMWalker.obj \
.\$(OBJDIR)\nsWebBrowserFind.obj \
$(NULL)
CPP_OBJS= \
.\$(OBJDIR)\nsDocShellTreeOwner.obj \
.\$(OBJDIR)\nsWBURIContentListener.obj \
.\$(OBJDIR)\nsWebBrowser.obj \
.\$(OBJDIR)\nsCommandHandler.obj \
.\$(OBJDIR)\nsWebBrowserPersist.obj \
.\$(OBJDIR)\nsDOMWalker.obj \
.\$(OBJDIR)\nsWebBrowserFind.obj \
$(NULL)
include <$(DEPTH)\config\rules.mak>
include <$(DEPTH)\config\config.mak>
install:: $(LIBRARY)
$(MAKE_INSTALL) $(LIBRARY) $(DIST)\lib
$(MAKE_INSTALL) $(LIBRARY) $(DIST)\lib

View File

@@ -433,7 +433,7 @@ NS_IMETHODIMP nsDocShellTreeOwner::Destroy()
{
if (mOwnerWin)
{
return mOwnerWin->Destroy();
return mWebBrowserChrome->DestroyBrowserWindow();
}
return NS_ERROR_NULL_POINTER;
}
@@ -442,7 +442,8 @@ NS_IMETHODIMP nsDocShellTreeOwner::SetPosition(PRInt32 aX, PRInt32 aY)
{
if (mOwnerWin)
{
return mOwnerWin->SetPosition(aX, aY);
return mOwnerWin->SetDimensions(nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION,
aX, aY, 0, 0);
}
return NS_ERROR_NULL_POINTER;
}
@@ -451,7 +452,8 @@ NS_IMETHODIMP nsDocShellTreeOwner::GetPosition(PRInt32* aX, PRInt32* aY)
{
if (mOwnerWin)
{
return mOwnerWin->GetPosition(aX, aY);
return mOwnerWin->GetDimensions(nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION,
aX, aY, nsnull, nsnull);
}
return NS_ERROR_NULL_POINTER;
}
@@ -460,7 +462,8 @@ NS_IMETHODIMP nsDocShellTreeOwner::SetSize(PRInt32 aCX, PRInt32 aCY, PRBool aRep
{
if (mOwnerWin)
{
return mOwnerWin->SetSize(aCX, aCY, aRepaint);
return mOwnerWin->SetDimensions(nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER,
0, 0, aCX, aCY);
}
return NS_ERROR_NULL_POINTER;
}
@@ -469,7 +472,8 @@ NS_IMETHODIMP nsDocShellTreeOwner::GetSize(PRInt32* aCX, PRInt32* aCY)
{
if (mOwnerWin)
{
return mOwnerWin->GetSize(aCX, aCY);
return mOwnerWin->GetDimensions(nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER,
nsnull, nsnull, aCX, aCY);
}
return NS_ERROR_NULL_POINTER;
}
@@ -479,7 +483,9 @@ NS_IMETHODIMP nsDocShellTreeOwner::SetPositionAndSize(PRInt32 aX, PRInt32 aY,
{
if (mOwnerWin)
{
return mOwnerWin->SetPositionAndSize(aX, aY, aCX, aCY, aRepaint);
return mOwnerWin->SetDimensions(nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER |
nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION,
aX, aY, aCX, aCY);
}
return NS_ERROR_NULL_POINTER;
}
@@ -489,7 +495,9 @@ NS_IMETHODIMP nsDocShellTreeOwner::GetPositionAndSize(PRInt32* aX, PRInt32* aY,
{
if (mOwnerWin)
{
return mOwnerWin->GetPositionAndSize(aX, aY, aCX, aCY);
return mOwnerWin->GetDimensions(nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER |
nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION,
aX, aY, aCX, aCY);
}
return NS_ERROR_NULL_POINTER;
}
@@ -525,11 +533,19 @@ NS_IMETHODIMP nsDocShellTreeOwner::SetParentNativeWindow(nativeWindow aParentNat
NS_IMETHODIMP nsDocShellTreeOwner::GetVisibility(PRBool* aVisibility)
{
if (mOwnerWin)
{
return mOwnerWin->GetVisibility(aVisibility);
}
return NS_ERROR_NULL_POINTER;
}
NS_IMETHODIMP nsDocShellTreeOwner::SetVisibility(PRBool aVisibility)
{
if (mOwnerWin)
{
return mOwnerWin->SetVisibility(aVisibility);
}
return NS_ERROR_NULL_POINTER;
}
@@ -676,7 +692,7 @@ NS_IMETHODIMP nsDocShellTreeOwner::SetWebBrowserChrome(nsIWebBrowserChrome* aWeb
}
else
{
nsCOMPtr<nsIWebBrowserSiteWindow> ownerWin(do_QueryInterface(aWebBrowserChrome));
nsCOMPtr<nsIEmbeddingSiteWindow> ownerWin(do_QueryInterface(aWebBrowserChrome));
nsCOMPtr<nsIInterfaceRequestor> requestor(do_QueryInterface(aWebBrowserChrome));
// it's ok for ownerWin or requestor to be null.

View File

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

View File

@@ -30,20 +30,8 @@
* hide or show it and change/query various other properties.
*/
[scriptable, uuid(3E5432CD-9568-4bd1-8CBE-D50ABA110743)]
interface nsIWebBrowserSiteWindow : nsISupports
interface nsIEmbeddingSiteWindow : nsISupports
{
/**
* Tell the window that it should destroy itself. This call should not be
* necessary as it will happen implictly when final release occurs on the
* object. If for some reaons you want the window destroyed prior to
* release due to cycle or ordering issues, then this call provides that
* ability.
*
* @return <code>NS_OK</code> if everything destroyed is properly.
* <code>NS_ERROR_UNEXPECTED</code> if window could not be destroyed.
*/
void destroy();
/*
Window dimension flags for controlling what you are getting and setting.
Note that the inner and outer flags are mutually exclusive and it

View File

@@ -32,98 +32,105 @@ interface nsIDocShellTreeItem;
[scriptable, uuid(BA434C60-9D52-11d3-AFB0-00A024FFC08C)]
interface nsIWebBrowserChrome : nsISupports
{
const unsigned long STATUS_SCRIPT = 0x00000001;
const unsigned long STATUS_SCRIPT_DEFAULT = 0x00000002;
const unsigned long STATUS_LINK = 0x00000003;
const unsigned long STATUS_SCRIPT = 0x00000001;
const unsigned long STATUS_SCRIPT_DEFAULT = 0x00000002;
const unsigned long STATUS_LINK = 0x00000003;
/*
Called when the status text in the chrome needs to be updated.
The statusType indicates what is setting the text, the text is nsnull
when there is no longer any status
/*
Called when the status text in the chrome needs to be updated.
The statusType indicates what is setting the text, the text is nsnull
when there is no longer any status
*/
void setStatus(in unsigned long statusType, in wstring status);
/*
This is the currently loaded webBrowser. The browser chrome may be
told to set the webBrowser object to a new object via setting of this
attribute. In this case the implementer is responsible for taking the
new webBrowser object and doing any necessary initialization or setup
as if it had created the webBrowser itself. This includes positioning
setting up listeners etc.
*/
void setStatus(in unsigned long statusType, in wstring status);
/*
This is the currently loaded webBrowser. The browser chrome may be
told to set the webBrowser object to a new object via setting of this
attribute. In this case the implementer is responsible for taking the
new webBrowser object and doing any necessary initialization or setup
as if it had created the webBrowser itself. This includes positioning
setting up listeners etc.
*/
attribute nsIWebBrowser webBrowser;
/*
Definitions for the chrome flags
*/
const unsigned long CHROME_DEFAULT = 0x00000001;
const unsigned long CHROME_WINDOW_BORDERS = 0x00000002;
const unsigned long CHROME_WINDOW_CLOSE = 0x00000004;
const unsigned long CHROME_WINDOW_RESIZE = 0x00000008;
const unsigned long CHROME_MENUBAR = 0x00000010;
const unsigned long CHROME_TOOLBAR = 0x00000020;
const unsigned long CHROME_LOCATIONBAR = 0x00000040;
const unsigned long CHROME_STATUSBAR = 0x00000080;
const unsigned long CHROME_PERSONAL_TOOLBAR = 0x00000100;
const unsigned long CHROME_SCROLLBARS = 0x00000200;
const unsigned long CHROME_TITLEBAR = 0x00000400;
const unsigned long CHROME_EXTRA = 0x00000800;
attribute nsIWebBrowser webBrowser;
/*
Definitions for the chrome flags
*/
const unsigned long CHROME_DEFAULT = 0x00000001;
const unsigned long CHROME_WINDOW_BORDERS = 0x00000002;
const unsigned long CHROME_WINDOW_CLOSE = 0x00000004;
const unsigned long CHROME_WINDOW_RESIZE = 0x00000008;
const unsigned long CHROME_MENUBAR = 0x00000010;
const unsigned long CHROME_TOOLBAR = 0x00000020;
const unsigned long CHROME_LOCATIONBAR = 0x00000040;
const unsigned long CHROME_STATUSBAR = 0x00000080;
const unsigned long CHROME_PERSONAL_TOOLBAR = 0x00000100;
const unsigned long CHROME_SCROLLBARS = 0x00000200;
const unsigned long CHROME_TITLEBAR = 0x00000400;
const unsigned long CHROME_EXTRA = 0x00000800;
// createBrowserWindow specific flags
const unsigned long CHROME_WITH_SIZE = 0x00001000;
const unsigned long CHROME_WITH_POSITION = 0x00002000;
const unsigned long CHROME_WINDOW_RAISED = 0x02000000;
const unsigned long CHROME_WINDOW_LOWERED = 0x04000000;
const unsigned long CHROME_CENTER_SCREEN = 0x08000000;
const unsigned long CHROME_DEPENDENT = 0x10000000;
// Note: The modal style bit just affects the way the window looks and does
// mean it's actually modal.
const unsigned long CHROME_MODAL = 0x20000000;
const unsigned long CHROME_OPENAS_DIALOG = 0x40000000;
const unsigned long CHROME_OPENAS_CHROME = 0x80000000;
const unsigned long CHROME_ALL = 0x00000ffe;
/*
The chrome flags for this browser chrome
*/
attribute unsigned long chromeFlags;
/*
Asks the implementer of this interface to create a new webbrowser
object and return the nsIWebBrowser interface to it. The chrome
flags indicate the style of the surrounding frame window and
associated chrome. The position parameters should be ignored
unless the CHROME_WITH_POSITION chrome flags is set. The size
parameters should be ignored unless the CHROME_WITH_SIZE chrome flag
is set.
*/
const unsigned long CHROME_WINDOW_RAISED = 0x02000000;
const unsigned long CHROME_WINDOW_LOWERED = 0x04000000;
const unsigned long CHROME_CENTER_SCREEN = 0x08000000;
const unsigned long CHROME_DEPENDENT = 0x10000000;
// Note: The modal style bit just affects the way the window looks and does
// mean it's actually modal.
const unsigned long CHROME_MODAL = 0x20000000;
const unsigned long CHROME_OPENAS_DIALOG = 0x40000000;
const unsigned long CHROME_OPENAS_CHROME = 0x80000000;
const unsigned long CHROME_ALL = 0x00000ffe;
/*
The chrome flags for this browser chrome
*/
attribute unsigned long chromeFlags;
/*
Asks the implementer of this interface to create a new webbrowser
object and return the nsIWebBrowser interface to it. The chrome
flags indicate the style of the surrounding frame window and
associated chrome. The position parameters should be ignored
unless the CHROME_WITH_POSITION chrome flags is set. The size
parameters should be ignored unless the CHROME_WITH_SIZE chrome flag
is set.
*/
nsIWebBrowser createBrowserWindow(in unsigned long chromeFlags,
in long aX, in long aY, in long aCX, in long aCY);
/*
Tells the chrome to size itself such that the browser will be the
specified size.
*/
void sizeBrowserTo(in long aCX, in long aCY);
/*
Shows the window as a modal window.
*/
void showAsModal();
/*
Asks the implementer to destroy the window associated with this
webbrowser object.
*/
void destroyBrowserWindow();
/**
Is the window modal (that is, currently executing a modal loop)?
@return true if it's a modal window
*/
boolean isWindowModal();
/**
Exit a modal event loop if we're in one. The implementation
should also exit out of the loop if the window is destroyed.
@param aStatus - the result code to return from showAsModal
*/
void exitModalEventLoop(in nsresult aStatus);
/*
Tells the chrome to size itself such that the browser will be the
specified size.
*/
void sizeBrowserTo(in long aCX, in long aCY);
/*
Shows the window as a modal window.
*/
void showAsModal();
/**
Is the window modal (that is, currently executing a modal loop)?
@return true if it's a modal window
*/
boolean isWindowModal();
/**
Exit a modal event loop if we're in one. The implementation
should also exit out of the loop if the window is destroyed.
@param aStatus - the result code to return from showAsModal
*/
void exitModalEventLoop(in nsresult aStatus);
};

View File

@@ -59,7 +59,7 @@ NS_INTERFACE_MAP_BEGIN(WebBrowserChrome)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIWebBrowserChrome)
NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
NS_INTERFACE_MAP_ENTRY(nsIWebBrowserChrome)
NS_INTERFACE_MAP_ENTRY(nsIWebBrowserSiteWindow)
NS_INTERFACE_MAP_ENTRY(nsIEmbeddingSiteWindow)
NS_INTERFACE_MAP_ENTRY(nsIWebProgressListener) //optional
// NS_INTERFACE_MAP_ENTRY(nsIPrompt)
NS_INTERFACE_MAP_END
@@ -179,6 +179,12 @@ NS_IMETHODIMP WebBrowserChrome::CreateBrowserWindow(PRUint32 chromeMask,
}
NS_IMETHODIMP WebBrowserChrome::DestroyBrowserWindow()
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP WebBrowserChrome::SizeBrowserTo(PRInt32 aCX, PRInt32 aCY)
{
return NS_ERROR_NOT_IMPLEMENTED;
@@ -252,43 +258,17 @@ WebBrowserChrome::OnSecurityChange(nsIWebProgress *aWebProgress,
//*****************************************************************************
// WebBrowserChrome::nsIWebBrowserSiteWindow
// WebBrowserChrome::nsIEmbeddingSiteWindow
//*****************************************************************************
NS_IMETHODIMP WebBrowserChrome::Destroy()
NS_IMETHODIMP WebBrowserChrome::SetDimensions(PRUint32 aFlags, PRInt32 x, PRInt32 y, PRInt32 cx, PRInt32 cy)
{
NS_ASSERTION(PR_FALSE, "You can't call this");
return NS_ERROR_UNEXPECTED;
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP WebBrowserChrome::SetPosition(PRInt32 x, PRInt32 y)
NS_IMETHODIMP WebBrowserChrome::GetDimensions(PRUint32 aFlags, PRInt32 *x, PRInt32 *y, PRInt32 *cx, PRInt32 *cy)
{
return mBaseWindow->SetPosition(x, y);
}
NS_IMETHODIMP WebBrowserChrome::GetPosition(PRInt32* x, PRInt32* y)
{
return mBaseWindow->GetPosition(x, y);
}
NS_IMETHODIMP WebBrowserChrome::SetSize(PRInt32 cx, PRInt32 cy, PRBool fRepaint)
{
return mBaseWindow->SetSize(cx, cy, fRepaint);
}
NS_IMETHODIMP WebBrowserChrome::GetSize(PRInt32* cx, PRInt32* cy)
{
return mBaseWindow->GetSize(cx, cy);
}
NS_IMETHODIMP WebBrowserChrome::SetPositionAndSize(PRInt32 x, PRInt32 y, PRInt32 cx, PRInt32 cy, PRBool fRepaint)
{
return mBaseWindow->SetPositionAndSize(x, y, cx, cy, fRepaint);
}
NS_IMETHODIMP WebBrowserChrome::GetPositionAndSize(PRInt32* x, PRInt32* y, PRInt32* cx, PRInt32* cy)
{
return mBaseWindow->GetPositionAndSize(x, y, cx, cy);
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP WebBrowserChrome::SetFocus()
@@ -296,6 +276,16 @@ NS_IMETHODIMP WebBrowserChrome::SetFocus()
return mBaseWindow->SetFocus();
}
NS_IMETHODIMP WebBrowserChrome::GetVisibility(PRBool *aVisibility)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP WebBrowserChrome::SetVisibility(PRBool aVisibility)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP WebBrowserChrome::GetTitle(PRUnichar** aTitle)
{
NS_ENSURE_ARG_POINTER(aTitle);

View File

@@ -31,7 +31,7 @@
#include "nsIContentViewer.h"
#include "nsIContentViewerFile.h"
#include "nsIBaseWindow.h"
#include "nsIWebBrowserSiteWindow.h"
#include "nsIEmbeddingSiteWindow.h"
#include "nsIWebNavigation.h"
#include "nsIWebProgressListener.h"
#include "nsIInterfaceRequestor.h"
@@ -43,7 +43,7 @@
class WebBrowserChrome : public nsIWebBrowserChrome,
public nsIWebProgressListener,
public nsIWebBrowserSiteWindow,
public nsIEmbeddingSiteWindow,
// public nsIPrompt,
public nsIInterfaceRequestor
{
@@ -55,7 +55,7 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSIWEBBROWSERCHROME
NS_DECL_NSIWEBPROGRESSLISTENER
NS_DECL_NSIWEBBROWSERSITEWINDOW
NS_DECL_NSIEMBEDDINGSITEWINDOW
// NS_DECL_NSIPROMPT
NS_DECL_NSIINTERFACEREQUESTOR

View File

@@ -63,13 +63,13 @@ NS_IMPL_ADDREF(nsWebBrowserChrome)
NS_IMPL_RELEASE(nsWebBrowserChrome)
NS_INTERFACE_MAP_BEGIN(nsWebBrowserChrome)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIWebBrowserChrome)
NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
NS_INTERFACE_MAP_ENTRY(nsIWebBrowserChrome)
NS_INTERFACE_MAP_ENTRY(nsIWebProgressListener)
NS_INTERFACE_MAP_ENTRY(nsIWebBrowserSiteWindow)
NS_INTERFACE_MAP_ENTRY(nsIPrompt)
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIWebBrowserChrome)
NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
NS_INTERFACE_MAP_ENTRY(nsIWebBrowserChrome)
NS_INTERFACE_MAP_ENTRY(nsIWebProgressListener)
NS_INTERFACE_MAP_ENTRY(nsIEmbeddingSiteWindow)
NS_INTERFACE_MAP_ENTRY(nsIPrompt)
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
NS_INTERFACE_MAP_END
//*****************************************************************************
@@ -147,6 +147,11 @@ NS_IMETHODIMP nsWebBrowserChrome::CreateBrowserWindow(PRUint32 aChromeMask,
return NS_OK;
}
NS_IMETHODIMP nsWebBrowserChrome::DestroyBrowserWindow()
{
return mBrowserWindow->Destroy();
}
#if 0
/* Just commenting out for now because it looks like somebody went to
a lot of work here. This method has been removed from nsIWebBrowserChrome
@@ -206,57 +211,41 @@ NS_IMETHODIMP nsWebBrowserChrome::ExitModalEventLoop(nsresult aStatus)
}
//*****************************************************************************
// nsWebBrowserChrome::nsIWebBrowserSiteWindow
// nsWebBrowserChrome::nsIEmbeddingSiteWindow
//*****************************************************************************
NS_IMETHODIMP nsWebBrowserChrome::Destroy()
NS_IMETHODIMP nsWebBrowserChrome::SetDimensions(PRUint32 aFlags, PRInt32 aX, PRInt32 aY, PRInt32 aCX, PRInt32 aCY)
{
return mBrowserWindow->Destroy();
PRInt32 x, y, cx, cy;
mBrowserWindow->GetPositionAndSize(&x, &y, &cx, &cy);
if (aFlags & DIM_FLAGS_POSITION)
{
x = aX;
y = aY;
}
if (aFlags & DIM_FLAGS_SIZE_INNER || aFlags & DIM_FLAGS_SIZE_OUTER)
{
cx = aCX;
cy = aCY;
}
return mBrowserWindow->SetPositionAndSize(aX, aY, aCX, aCY, PR_TRUE);
}
NS_IMETHODIMP nsWebBrowserChrome::SetPosition(PRInt32 aX, PRInt32 aY)
NS_IMETHODIMP nsWebBrowserChrome::GetDimensions(PRUint32 aFlags, PRInt32 *aX, PRInt32 *aY, PRInt32 *aCX, PRInt32 *aCY)
{
PRInt32 cx=0;
PRInt32 cy=0;
NS_ENSURE_SUCCESS(GetSize(&cx, &cy), NS_ERROR_FAILURE);
NS_ENSURE_SUCCESS(SetPositionAndSize(aX, aY, cx, cy, PR_FALSE),
NS_ERROR_FAILURE);
return NS_OK;
}
NS_IMETHODIMP nsWebBrowserChrome::GetPosition(PRInt32* aX, PRInt32* aY)
{
return GetPositionAndSize(aX, aY, nsnull, nsnull);
}
NS_IMETHODIMP nsWebBrowserChrome::SetSize(PRInt32 aCX, PRInt32 aCY, PRBool aRepaint)
{
PRInt32 x=0;
PRInt32 y=0;
NS_ENSURE_SUCCESS(GetPosition(&x, &y), NS_ERROR_FAILURE);
NS_ENSURE_SUCCESS(SetPositionAndSize(x, y, aCX, aCY, aRepaint),
NS_ERROR_FAILURE);
return NS_OK;
}
NS_IMETHODIMP nsWebBrowserChrome::GetSize(PRInt32* aCX, PRInt32* aCY)
{
return GetPositionAndSize(nsnull, nsnull, aCX, aCY);
}
NS_IMETHODIMP nsWebBrowserChrome::SetPositionAndSize(PRInt32 aX, PRInt32 aY,
PRInt32 aCX, PRInt32 aCY, PRBool aRepaint)
{
return mBrowserWindow->SetPositionAndSize(aX, aY, aCX, aCY, aRepaint);
}
NS_IMETHODIMP nsWebBrowserChrome::GetPositionAndSize(PRInt32* aX, PRInt32* aY,
PRInt32* aCX, PRInt32* aCY)
{
return mBrowserWindow->GetPositionAndSize(aX, aY, aCX, aCY);
PRInt32 x, y, cx, cy;
mBrowserWindow->GetPositionAndSize(&x, &y, &cx, &cy);
if (aFlags & DIM_FLAGS_POSITION)
{
*aX = x;
*aY = y;
}
if (aFlags & DIM_FLAGS_SIZE_INNER || aFlags & DIM_FLAGS_SIZE_OUTER)
{
*aCX = cx;
*aCY = cy;
}
return NS_OK;
}
NS_IMETHODIMP nsWebBrowserChrome::GetSiteWindow(void ** aParentNativeWindow)
@@ -268,6 +257,16 @@ NS_IMETHODIMP nsWebBrowserChrome::GetSiteWindow(void ** aParentNativeWindow)
return NS_OK;
}
NS_IMETHODIMP nsWebBrowserChrome::GetVisibility(PRBool *aVisibility)
{
return mBrowserWindow->GetVisibility(aVisibility);
}
NS_IMETHODIMP nsWebBrowserChrome::SetVisibility(PRBool aVisibility)
{
return mBrowserWindow->SetVisibility(aVisibility);
}
NS_IMETHODIMP nsWebBrowserChrome::SetFocus()
{
return mBrowserWindow->SetFocus();

View File

@@ -29,7 +29,7 @@
// Interfaces Needed
#include "nsIWebBrowserChrome.h"
#include "nsIDocShellTreeOwner.h"
#include "nsIWebBrowserSiteWindow.h"
#include "nsIEmbeddingSiteWindow.h"
#include "nsIInterfaceRequestor.h"
#include "nsIWebProgressListener.h"
#include "nsTimer.h"
@@ -39,7 +39,7 @@
class nsBrowserWindow;
class nsWebBrowserChrome : public nsIWebBrowserChrome,
public nsIWebBrowserSiteWindow,
public nsIEmbeddingSiteWindow,
public nsIWebProgressListener,
public nsIInterfaceRequestor,
public nsIPrompt,
@@ -51,7 +51,7 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSIWEBBROWSERCHROME
NS_DECL_NSIWEBBROWSERSITEWINDOW
NS_DECL_NSIEMBEDDINGSITEWINDOW
NS_DECL_NSIWEBPROGRESSLISTENER
NS_DECL_NSIINTERFACEREQUESTOR
NS_DECL_NSIPROMPT

View File

@@ -376,6 +376,12 @@ NS_IMETHODIMP nsContentTreeOwner::CreateBrowserWindow(PRUint32 aChromeFlags,
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsContentTreeOwner::DestroyBrowserWindow()
{
NS_ERROR("Haven't Implemented this yet");
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsContentTreeOwner::SizeBrowserTo(PRInt32 aCX, PRInt32 aCY)
{
NS_ERROR("Haven't Implemented this yet");