зеркало из https://github.com/mozilla/gecko-dev.git
Changed nsIBrowserWindow references to reference nsBrowserWindow. nsBrowserWindow is no longer a component. More implementation to get nsBrowserWindow and nsWebBrowserChrome implementations geared towards the embedding code. made nsBrowserWindow implement nsIBaseWindow.
This commit is contained in:
Родитель
54958006d1
Коммит
58e5886488
|
@ -152,7 +152,6 @@ static NS_DEFINE_CID(kWalletServiceCID, NS_WALLETSERVICE_CID);
|
|||
#endif
|
||||
|
||||
static NS_DEFINE_CID(kLookAndFeelCID, NS_LOOKANDFEEL_CID);
|
||||
static NS_DEFINE_CID(kBrowserWindowCID, NS_BROWSER_WINDOW_CID);
|
||||
static NS_DEFINE_CID(kButtonCID, NS_BUTTON_CID);
|
||||
static NS_DEFINE_CID(kFileWidgetCID, NS_FILEWIDGET_CID);
|
||||
static NS_DEFINE_CID(kTextFieldCID, NS_TEXTFIELD_CID);
|
||||
|
@ -165,7 +164,6 @@ static NS_DEFINE_CID(kLabelCID, NS_LABEL_CID);
|
|||
|
||||
static NS_DEFINE_IID(kIXPBaseWindowIID, NS_IXPBASE_WINDOW_IID);
|
||||
static NS_DEFINE_IID(kILookAndFeelIID, NS_ILOOKANDFEEL_IID);
|
||||
static NS_DEFINE_IID(kIBrowserWindowIID, NS_IBROWSER_WINDOW_IID);
|
||||
static NS_DEFINE_IID(kIButtonIID, NS_IBUTTON_IID);
|
||||
static NS_DEFINE_IID(kIDOMDocumentIID, NS_IDOMDOCUMENT_IID);
|
||||
static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
|
||||
|
@ -203,6 +201,244 @@ static nsEventStatus PR_CALLBACK HandleEvent(nsGUIEvent *aEvent);
|
|||
#endif
|
||||
static void* GetItemsNativeData(nsISupports* aObject);
|
||||
|
||||
//******* Cleanup Above here***********/
|
||||
|
||||
//*****************************************************************************
|
||||
// nsBrowserWindow::nsIBaseWindow
|
||||
//*****************************************************************************
|
||||
|
||||
NS_IMETHODIMP nsBrowserWindow::InitWindow(nativeWindow aParentNativeWindow,
|
||||
nsIWidget* parentWidget, PRInt32 x, PRInt32 y, PRInt32 cx, PRInt32 cy)
|
||||
{
|
||||
// Ignore wigdet parents for now. Don't think those are a vaild thing to call.
|
||||
NS_ENSURE_SUCCESS(SetPositionAndSize(x, y, cx, cy, PR_FALSE), NS_ERROR_FAILURE);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsBrowserWindow::Create()
|
||||
{
|
||||
NS_ASSERTION(PR_FALSE, "You can't call this");
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsBrowserWindow::Destroy()
|
||||
{
|
||||
RemoveBrowser(this);
|
||||
|
||||
nsCOMPtr<nsIWebShell> webShell(do_QueryInterface(mDocShell));
|
||||
if(webShell)
|
||||
{
|
||||
//XXXTAB Should do this on the docShell
|
||||
nsCOMPtr<nsIDocumentLoader> docLoader;
|
||||
webShell->GetDocumentLoader(*getter_AddRefs(docLoader));
|
||||
if(docLoader)
|
||||
docLoader->RemoveObserver(this);
|
||||
nsCOMPtr<nsIBaseWindow> docShellWin(do_QueryInterface(mDocShell));
|
||||
docShellWin->Destroy();
|
||||
NS_RELEASE(mDocShell);
|
||||
}
|
||||
|
||||
DestroyWidget(mBack);
|
||||
mBack = nsnull;
|
||||
DestroyWidget(mForward);
|
||||
mForward = nsnull;
|
||||
DestroyWidget(mLocation);
|
||||
mLocation = nsnull;
|
||||
DestroyWidget(mStatus);
|
||||
mStatus = nsnull;
|
||||
|
||||
if(mThrobber)
|
||||
{
|
||||
mThrobber->Destroy();
|
||||
NS_RELEASE(mThrobber);
|
||||
mThrobber = nsnull;
|
||||
}
|
||||
|
||||
DestroyWidget(mWindow);
|
||||
mWindow = nsnull;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsBrowserWindow::SetPosition(PRInt32 aX, PRInt32 aY)
|
||||
{
|
||||
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 nsBrowserWindow::GetPosition(PRInt32* aX, PRInt32* aY)
|
||||
{
|
||||
return GetPositionAndSize(aX, aY, nsnull, nsnull);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsBrowserWindow::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 nsBrowserWindow::GetSize(PRInt32* aCX, PRInt32* aCY)
|
||||
{
|
||||
return GetPositionAndSize(nsnull, nsnull, aCX, aCY);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsBrowserWindow::SetPositionAndSize(PRInt32 aX, PRInt32 aY,
|
||||
PRInt32 aCX, PRInt32 aCY, PRBool aRepaint)
|
||||
{
|
||||
NS_ENSURE_SUCCESS(mWindow->Resize(aX, aY, aCX, aCY, aRepaint),
|
||||
NS_ERROR_FAILURE);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsBrowserWindow::GetPositionAndSize(PRInt32* aX, PRInt32* aY,
|
||||
PRInt32* aCX, PRInt32* aCY)
|
||||
{
|
||||
nsRect bounds;
|
||||
|
||||
NS_ENSURE_SUCCESS(mWindow->GetBounds(bounds), NS_ERROR_FAILURE);
|
||||
|
||||
if(aX)
|
||||
*aX = bounds.x;
|
||||
if(aY)
|
||||
*aY = bounds.y;
|
||||
if(aCX)
|
||||
*aCX = bounds.width;
|
||||
if(aCY)
|
||||
*aCY = bounds.height;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsBrowserWindow::Repaint(PRBool aForce)
|
||||
{
|
||||
//XXX First Check In
|
||||
NS_ASSERTION(PR_FALSE, "Not Yet Implemented");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsBrowserWindow::GetParentWidget(nsIWidget** aParentWidget)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aParentWidget);
|
||||
//XXX First Check In
|
||||
NS_ASSERTION(PR_FALSE, "Not Yet Implemented");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsBrowserWindow::SetParentWidget(nsIWidget* aParentWidget)
|
||||
{
|
||||
NS_ASSERTION(PR_FALSE, "You can't call this");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsBrowserWindow::GetParentNativeWindow(nativeWindow* aParentNativeWindow)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aParentNativeWindow);
|
||||
|
||||
//XXX First Check In
|
||||
NS_ASSERTION(PR_FALSE, "Not Yet Implemented");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsBrowserWindow::SetParentNativeWindow(nativeWindow aParentNativeWindow)
|
||||
{
|
||||
NS_ASSERTION(PR_FALSE, "You can't call this");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsBrowserWindow::GetVisibility(PRBool* aVisibility)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aVisibility);
|
||||
|
||||
//XXX First Check In
|
||||
NS_ASSERTION(PR_FALSE, "Not Yet Implemented");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsBrowserWindow::SetVisibility(PRBool aVisibility)
|
||||
{
|
||||
NS_ENSURE_STATE(mWindow);
|
||||
|
||||
NS_ENSURE_SUCCESS(mWindow->Show(aVisibility), NS_ERROR_FAILURE);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsBrowserWindow::GetMainWidget(nsIWidget** aMainWidget)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aMainWidget);
|
||||
|
||||
//XXX First Check In
|
||||
NS_ASSERTION(PR_FALSE, "Not Yet Implemented");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsBrowserWindow::SetFocus()
|
||||
{
|
||||
//XXX First Check In
|
||||
NS_ASSERTION(PR_FALSE, "Not Yet Implemented");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsBrowserWindow::FocusAvailable(nsIBaseWindow* aCurrentFocus,
|
||||
PRBool* aTookFocus)
|
||||
{
|
||||
//XXX First Check In
|
||||
NS_ASSERTION(PR_FALSE, "Not Yet Implemented");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsBrowserWindow::GetTitle(PRUnichar** aTitle)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aTitle);
|
||||
|
||||
*aTitle = mTitle.ToNewUnicode();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsBrowserWindow::SetTitle(const PRUnichar* aTitle)
|
||||
{
|
||||
NS_ENSURE_STATE(mWindow);
|
||||
|
||||
mTitle = aTitle;
|
||||
|
||||
NS_ENSURE_SUCCESS(mWindow->SetTitle(aTitle), NS_ERROR_FAILURE);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// nsBrowserWindow: Helper Function
|
||||
//*****************************************************************************
|
||||
|
||||
void nsBrowserWindow::DestroyWidget(nsISupports* aWidget)
|
||||
{
|
||||
if(aWidget)
|
||||
{
|
||||
nsCOMPtr<nsIWidget> w(do_QueryInterface(aWidget));
|
||||
if(w)
|
||||
w->Destroy();
|
||||
}
|
||||
}
|
||||
|
||||
//******* Cleanup below here *************/
|
||||
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
static
|
||||
|
@ -310,7 +546,7 @@ nsBrowserWindow::CloseAllWindows()
|
|||
while (0 != gBrowsers.Count()) {
|
||||
nsBrowserWindow* bw = (nsBrowserWindow*) gBrowsers.ElementAt(0);
|
||||
NS_ADDREF(bw);
|
||||
bw->Close();
|
||||
bw->Destroy();
|
||||
NS_RELEASE(bw);
|
||||
}
|
||||
gBrowsers.Clear();
|
||||
|
@ -682,10 +918,10 @@ nsBrowserWindow::DispatchMenuItem(PRInt32 aID)
|
|||
#ifndef HTMLDialogs
|
||||
if (aID == PRVCY_PREFILL) {
|
||||
nsAutoString url("file:///y|/htmldlgs.htm");
|
||||
nsIBrowserWindow* bw = nsnull;
|
||||
nsBrowserWindow* bw = nsnull;
|
||||
mApp->OpenWindow(PRUint32(~0), bw);
|
||||
bw->Show();
|
||||
((nsBrowserWindow *)bw)->GoTo(url.GetUnicode());
|
||||
bw->SetVisibility(PR_TRUE);
|
||||
bw->GoTo(url.GetUnicode());
|
||||
NS_RELEASE(bw);
|
||||
}
|
||||
#endif
|
||||
|
@ -822,7 +1058,7 @@ nsBrowserWindow::DoFileOpen()
|
|||
// Ask the Web widget to load the file URL
|
||||
nsCOMPtr<nsIWebShell> webShell(do_QueryInterface(mDocShell));
|
||||
webShell->LoadURL(nsString(fileURL.GetURLString()).GetUnicode());
|
||||
Show();
|
||||
SetVisibility(PR_TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1049,11 +1285,6 @@ nsBrowserWindow::QueryInterface(const nsIID& aIID,
|
|||
|
||||
*aInstancePtrResult = NULL;
|
||||
|
||||
if (aIID.Equals(kIBrowserWindowIID)) {
|
||||
*aInstancePtrResult = (void*) ((nsIBrowserWindow*)this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kIDocumentLoaderObserverIID)) {
|
||||
*aInstancePtrResult = (void*) ((nsIDocumentLoaderObserver*)this);
|
||||
NS_ADDREF_THIS();
|
||||
|
@ -1075,7 +1306,7 @@ nsBrowserWindow::QueryInterface(const nsIID& aIID,
|
|||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtrResult = (void*) ((nsISupports*)((nsIBrowserWindow*)this));
|
||||
*aInstancePtrResult = (void*) ((nsISupports*)((nsIWebShellContainer*)this));
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1137,7 +1368,7 @@ nsBrowserWindow::Init(nsIAppShell* aAppShell,
|
|||
}
|
||||
webBrowserWin->SetVisibility(PR_TRUE);
|
||||
|
||||
if (NS_CHROME_MENU_BAR_ON & aChromeMask) {
|
||||
if (nsIWebBrowserChrome::menuBarOn & aChromeMask) {
|
||||
rv = CreateMenuBar(r.width);
|
||||
if (NS_OK != rv) {
|
||||
return rv;
|
||||
|
@ -1146,14 +1377,14 @@ nsBrowserWindow::Init(nsIAppShell* aAppShell,
|
|||
r.x = r.y = 0;
|
||||
}
|
||||
|
||||
if (NS_CHROME_TOOL_BAR_ON & aChromeMask) {
|
||||
if (nsIWebBrowserChrome::toolBarOn & aChromeMask) {
|
||||
rv = CreateToolBar(r.width);
|
||||
if (NS_OK != rv) {
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
if (NS_CHROME_STATUS_BAR_ON & aChromeMask) {
|
||||
if (nsIWebBrowserChrome::statusBarOn & aChromeMask) {
|
||||
rv = CreateStatusBar(r.width);
|
||||
if (NS_OK != rv) {
|
||||
return rv;
|
||||
|
@ -1215,7 +1446,7 @@ nsBrowserWindow::Init(nsIAppShell* aAppShell,
|
|||
docLoader->AddObserver(this);
|
||||
}
|
||||
|
||||
if (NS_CHROME_MENU_BAR_ON & aChromeMask) {
|
||||
if (nsIWebBrowserChrome::menuBarOn & aChromeMask) {
|
||||
rv = CreateMenuBar(r.width);
|
||||
if (NS_OK != rv) {
|
||||
return rv;
|
||||
|
@ -1224,14 +1455,14 @@ nsBrowserWindow::Init(nsIAppShell* aAppShell,
|
|||
r.x = r.y = 0;
|
||||
}
|
||||
|
||||
if (NS_CHROME_TOOL_BAR_ON & aChromeMask) {
|
||||
if (nsIWebBrowserChrome::toolBarOn & aChromeMask) {
|
||||
rv = CreateToolBar(r.width);
|
||||
if (NS_OK != rv) {
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
if (NS_CHROME_STATUS_BAR_ON & aChromeMask) {
|
||||
if (nsIWebBrowserChrome::statusBarOn & aChromeMask) {
|
||||
rv = CreateStatusBar(r.width);
|
||||
if (NS_OK != rv) {
|
||||
return rv;
|
||||
|
@ -1459,7 +1690,7 @@ nsBrowserWindow::Layout(PRInt32 aWidth, PRInt32 aHeight)
|
|||
nsRect rr(0, 0, aWidth, aHeight);
|
||||
|
||||
// position location bar (it's stretchy)
|
||||
if (NS_CHROME_TOOL_BAR_ON & mChromeMask) {
|
||||
if (nsIWebBrowserChrome::toolBarOn & mChromeMask) {
|
||||
nsIWidget* locationWidget = nsnull;
|
||||
if (mLocation &&
|
||||
NS_SUCCEEDED(mLocation->QueryInterface(kIWidgetIID,
|
||||
|
@ -1526,7 +1757,7 @@ nsBrowserWindow::Layout(PRInt32 aWidth, PRInt32 aHeight)
|
|||
nsIWidget* statusWidget = nsnull;
|
||||
|
||||
if (mStatus && NS_OK == mStatus->QueryInterface(kIWidgetIID,(void**)&statusWidget)) {
|
||||
if (mChromeMask & NS_CHROME_STATUS_BAR_ON) {
|
||||
if (mChromeMask & nsIWebBrowserChrome::statusBarOn) {
|
||||
statusWidget->Resize(0, aHeight - txtHeight,
|
||||
aWidth, txtHeight,
|
||||
PR_TRUE);
|
||||
|
@ -1543,7 +1774,7 @@ nsBrowserWindow::Layout(PRInt32 aWidth, PRInt32 aHeight)
|
|||
|
||||
// inset the web widget
|
||||
|
||||
if (NS_CHROME_TOOL_BAR_ON & mChromeMask) {
|
||||
if (nsIWebBrowserChrome::toolBarOn & mChromeMask) {
|
||||
rr.height -= BUTTON_HEIGHT;
|
||||
rr.y += BUTTON_HEIGHT;
|
||||
}
|
||||
|
@ -1605,69 +1836,6 @@ nsBrowserWindow::GetWindowBounds(nsRect& aBounds)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBrowserWindow::Show()
|
||||
{
|
||||
NS_PRECONDITION(nsnull != mWindow, "null window");
|
||||
mWindow->Show(PR_TRUE);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBrowserWindow::Hide()
|
||||
{
|
||||
NS_PRECONDITION(nsnull != mWindow, "null window");
|
||||
mWindow->Show(PR_FALSE);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static void DestroyWidget(nsISupports* aWidget)
|
||||
{
|
||||
if (aWidget) {
|
||||
nsIWidget* w;
|
||||
nsresult rv = aWidget->QueryInterface(kIWidgetIID, (void**) &w);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
w->Destroy();
|
||||
NS_RELEASE(w);
|
||||
}
|
||||
NS_RELEASE(aWidget);
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBrowserWindow::Close()
|
||||
{
|
||||
RemoveBrowser(this);
|
||||
|
||||
nsCOMPtr<nsIWebShell> webShell(do_QueryInterface(mDocShell));
|
||||
if (nsnull != webShell) {
|
||||
nsCOMPtr<nsIDocumentLoader> docLoader;
|
||||
webShell->GetDocumentLoader(*getter_AddRefs(docLoader));
|
||||
if (docLoader) {
|
||||
docLoader->RemoveObserver(this);
|
||||
}
|
||||
nsCOMPtr<nsIBaseWindow> docShellWin(do_QueryInterface(mDocShell));
|
||||
docShellWin->Destroy();
|
||||
NS_RELEASE(mDocShell);
|
||||
}
|
||||
|
||||
DestroyWidget(mBack); mBack = nsnull;
|
||||
DestroyWidget(mForward); mForward = nsnull;
|
||||
DestroyWidget(mLocation); mLocation = nsnull;
|
||||
DestroyWidget(mStatus); mStatus = nsnull;
|
||||
|
||||
if (mThrobber) {
|
||||
mThrobber->Destroy();
|
||||
NS_RELEASE(mThrobber);
|
||||
mThrobber = nsnull;
|
||||
}
|
||||
|
||||
DestroyWidget(mWindow); mWindow = nsnull;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBrowserWindow::ShowModally(PRBool aPrepare)
|
||||
{
|
||||
|
@ -1712,55 +1880,6 @@ nsBrowserWindow::GetContentWebShell(nsIWebShell **aResult)
|
|||
}
|
||||
|
||||
//----------------------------------------
|
||||
NS_IMETHODIMP
|
||||
nsBrowserWindow::IsIntrinsicallySized(PRBool& aResult)
|
||||
{
|
||||
aResult = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBrowserWindow::SetTitle(const PRUnichar* aTitle)
|
||||
{
|
||||
EnsureWebBrowserChrome();
|
||||
return mWebBrowserChrome->SetTitle(aTitle);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBrowserWindow::GetTitle(PRUnichar** aResult)
|
||||
{
|
||||
*aResult = mTitle.ToNewUnicode();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBrowserWindow::SetStatus(const PRUnichar* aStatus)
|
||||
{
|
||||
if (nsnull != mStatus) {
|
||||
PRUint32 size;
|
||||
mStatus->SetText(aStatus,size);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBrowserWindow::GetStatus(const PRUnichar** aResult)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBrowserWindow::SetDefaultStatus(const PRUnichar* aStatus)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBrowserWindow::GetDefaultStatus(const PRUnichar** aResult)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBrowserWindow::SetProgress(PRInt32 aProgress, PRInt32 aProgressMax)
|
||||
{
|
||||
|
@ -1881,7 +2000,7 @@ nsBrowserWindow::NewWebShell(PRUint32 aChromeMask,
|
|||
{
|
||||
// Default is to startup hidden
|
||||
if (aVisible) {
|
||||
browser->Show();
|
||||
browser->SetVisibility(PR_TRUE);
|
||||
}
|
||||
nsIWebShell *shell;
|
||||
rv = browser->GetWebShell(shell);
|
||||
|
@ -1889,7 +2008,7 @@ nsBrowserWindow::NewWebShell(PRUint32 aChromeMask,
|
|||
}
|
||||
else
|
||||
{
|
||||
browser->Close();
|
||||
browser->Destroy();
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -2318,8 +2437,8 @@ nsBrowserWindow::ShowPrintPreview(PRInt32 aID)
|
|||
nsBrowserWindow* bw = new nsNativeBrowserWindow;
|
||||
bw->SetApp(mApp);
|
||||
bw->Init(mAppShell, nsRect(0, 0, 600, 400),
|
||||
NS_CHROME_MENU_BAR_ON, PR_TRUE, docv, printContext);
|
||||
bw->Show();
|
||||
nsIWebBrowserChrome::menuBarOn, PR_TRUE, docv, printContext);
|
||||
bw->SetVisibility(PR_TRUE);
|
||||
|
||||
NS_RELEASE(printContext);
|
||||
}
|
||||
|
@ -3438,107 +3557,4 @@ NS_IMETHODIMP nsBrowserWindow::EnsureWebBrowserChrome()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
// Factory code for creating nsBrowserWindow's
|
||||
|
||||
class nsBrowserWindowFactory : public nsIFactory
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIFACTORY
|
||||
|
||||
nsBrowserWindowFactory();
|
||||
virtual ~nsBrowserWindowFactory();
|
||||
};
|
||||
|
||||
nsBrowserWindowFactory::nsBrowserWindowFactory()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsBrowserWindowFactory::~nsBrowserWindowFactory()
|
||||
{
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsBrowserWindowFactory::QueryInterface(const nsIID &aIID, void **aResult)
|
||||
{
|
||||
if (aResult == NULL) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
// Always NULL result, in case of failure
|
||||
*aResult = NULL;
|
||||
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aResult = (void *)(nsISupports*)this;
|
||||
} else if (aIID.Equals(kIFactoryIID)) {
|
||||
*aResult = (void *)(nsIFactory*)this;
|
||||
}
|
||||
|
||||
if (*aResult == NULL) {
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
NS_ADDREF_THIS(); // Increase reference count for caller
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsBrowserWindowFactory);
|
||||
NS_IMPL_RELEASE(nsBrowserWindowFactory);
|
||||
|
||||
nsresult
|
||||
nsBrowserWindowFactory::CreateInstance(nsISupports *aOuter,
|
||||
const nsIID &aIID,
|
||||
void **aResult)
|
||||
{
|
||||
nsresult rv;
|
||||
nsBrowserWindow *inst;
|
||||
|
||||
if (aResult == NULL) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
*aResult = NULL;
|
||||
if (nsnull != aOuter) {
|
||||
rv = NS_ERROR_NO_AGGREGATION;
|
||||
goto done;
|
||||
}
|
||||
|
||||
NS_NEWXPCOM(inst, nsNativeBrowserWindow);
|
||||
if (inst == NULL) {
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
goto done;
|
||||
}
|
||||
|
||||
NS_ADDREF(inst);
|
||||
rv = inst->QueryInterface(aIID, aResult);
|
||||
NS_RELEASE(inst);
|
||||
|
||||
done:
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsBrowserWindowFactory::LockFactory(PRBool aLock)
|
||||
{
|
||||
// Not implemented in simplest case.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult NS_NewBrowserWindowFactory(nsIFactory** aFactory);
|
||||
nsresult
|
||||
NS_NewBrowserWindowFactory(nsIFactory** aFactory)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
nsBrowserWindowFactory* inst;
|
||||
NS_NEWXPCOM(inst, nsBrowserWindowFactory);
|
||||
if (nsnull == inst) {
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
else {
|
||||
NS_ADDREF(inst);
|
||||
}
|
||||
*aFactory = inst;
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -25,9 +25,13 @@
|
|||
// Local Includes
|
||||
#include "nsWebBrowserChrome.h"
|
||||
|
||||
// Helper Classes
|
||||
|
||||
// Interfaces Needed
|
||||
#include "nsIBaseWindow.h"
|
||||
|
||||
|
||||
#include "nsIWebBrowser.h"
|
||||
#include "nsIBrowserWindow.h"
|
||||
#include "nsIStreamListener.h"
|
||||
#include "nsIProgressEventSink.h"
|
||||
#include "nsIWebShell.h"
|
||||
|
@ -62,7 +66,7 @@ class nsWebCrawler;
|
|||
/**
|
||||
* Abstract base class for our test app's browser windows
|
||||
*/
|
||||
class nsBrowserWindow : public nsIBrowserWindow,
|
||||
class nsBrowserWindow : public nsIBaseWindow,
|
||||
public nsIDocumentLoaderObserver,
|
||||
public nsIProgressEventSink,
|
||||
public nsIWebShellContainer,
|
||||
|
@ -76,6 +80,14 @@ public:
|
|||
// nsISupports
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIBaseWindow
|
||||
NS_DECL_NSIBASEWINDOW
|
||||
|
||||
protected:
|
||||
void DestroyWidget(nsISupports* aWidget);
|
||||
|
||||
public:
|
||||
|
||||
// nsIBrowserWindow
|
||||
NS_IMETHOD Init(nsIAppShell* aAppShell,
|
||||
const nsRect& aBounds,
|
||||
|
@ -92,20 +104,9 @@ public:
|
|||
PRBool aWidthTransient, PRBool aHeightTransient);
|
||||
NS_IMETHOD GetContentBounds(nsRect& aBounds);
|
||||
NS_IMETHOD GetWindowBounds(nsRect& aBounds);
|
||||
NS_IMETHOD IsIntrinsicallySized(PRBool& aResult);
|
||||
NS_IMETHOD ShowAfterCreation() { return Show(); }
|
||||
NS_IMETHOD Show();
|
||||
NS_IMETHOD Hide();
|
||||
NS_IMETHOD Close();
|
||||
NS_IMETHOD ShowModally(PRBool aPrepare);
|
||||
NS_IMETHOD SetChrome(PRUint32 aNewChromeMask);
|
||||
NS_IMETHOD GetChrome(PRUint32& aChromeMaskResult);
|
||||
NS_IMETHOD SetTitle(const PRUnichar* aTitle);
|
||||
NS_IMETHOD GetTitle(PRUnichar** aResult);
|
||||
NS_IMETHOD SetStatus(const PRUnichar* aStatus);
|
||||
NS_IMETHOD GetStatus(const PRUnichar** aResult);
|
||||
NS_IMETHOD SetDefaultStatus(const PRUnichar* aStatus);
|
||||
NS_IMETHOD GetDefaultStatus(const PRUnichar** aResult);
|
||||
NS_IMETHOD SetProgress(PRInt32 aProgress, PRInt32 aProgressMax);
|
||||
NS_IMETHOD ShowMenuBar(PRBool aShow);
|
||||
NS_IMETHOD GetWebShell(nsIWebShell*& aResult);
|
||||
|
|
|
@ -174,9 +174,9 @@ void nsNativeViewerApp::DispatchMenuItemWithoutWindow(PRInt32 menuResult)
|
|||
gTheApp->OpenWindow();
|
||||
break;
|
||||
case cmd_Open:
|
||||
nsIBrowserWindow * newWindow;
|
||||
nsBrowserWindow * newWindow;
|
||||
gTheApp->OpenWindow((PRUint32)0, newWindow);
|
||||
((nsBrowserWindow*)newWindow)->DoFileOpen();
|
||||
newWindow->DoFileOpen();
|
||||
break;
|
||||
case cmd_Quit:
|
||||
gTheApp->Exit();
|
||||
|
|
|
@ -98,21 +98,18 @@
|
|||
#include <fullsoft.h>
|
||||
#endif
|
||||
|
||||
extern nsresult NS_NewBrowserWindowFactory(nsIFactory** aFactory);
|
||||
extern nsresult NS_NewXPBaseWindowFactory(nsIFactory** aFactory);
|
||||
extern "C" void NS_SetupRegistry();
|
||||
|
||||
static NS_DEFINE_IID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
|
||||
static NS_DEFINE_IID(kAppShellCID, NS_APPSHELL_CID);
|
||||
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
|
||||
static NS_DEFINE_IID(kBrowserWindowCID, NS_BROWSER_WINDOW_CID);
|
||||
static NS_DEFINE_IID(kXPBaseWindowCID, NS_XPBASE_WINDOW_CID);
|
||||
static NS_DEFINE_IID(kCookieServiceCID, NS_COOKIESERVICE_CID);
|
||||
|
||||
static NS_DEFINE_IID(kIEventQueueServiceIID, NS_IEVENTQUEUESERVICE_IID);
|
||||
static NS_DEFINE_IID(kIAppShellIID, NS_IAPPSHELL_IID);
|
||||
static NS_DEFINE_IID(kIPrefIID, NS_IPREF_IID);
|
||||
static NS_DEFINE_IID(kIBrowserWindowIID, NS_IBROWSER_WINDOW_IID);
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kIXPBaseWindowIID, NS_IXPBASE_WINDOW_IID);
|
||||
|
||||
|
@ -280,10 +277,6 @@ nsViewerApp::SetupRegistry()
|
|||
|
||||
// Register our browser window factory
|
||||
nsIFactory* bwf;
|
||||
NS_NewBrowserWindowFactory(&bwf);
|
||||
nsComponentManager::RegisterFactory(kBrowserWindowCID, 0, 0, bwf, PR_FALSE);
|
||||
NS_RELEASE(bwf);
|
||||
|
||||
NS_NewXPBaseWindowFactory(&bwf);
|
||||
nsComponentManager::RegisterFactory(kXPBaseWindowCID, 0, 0, bwf, PR_FALSE);
|
||||
NS_RELEASE(bwf);
|
||||
|
@ -694,19 +687,16 @@ nsViewerApp::OpenWindow()
|
|||
// XXX Some piece of code needs to properly hold the reference to this
|
||||
// browser window. For the time being the reference is released by the
|
||||
// browser event handling code during processing of the NS_DESTROY event...
|
||||
nsBrowserWindow* bw = nsnull;
|
||||
nsresult rv = nsComponentManager::CreateInstance(kBrowserWindowCID, nsnull,
|
||||
kIBrowserWindowIID,
|
||||
(void**) &bw);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
nsBrowserWindow* bw = new nsNativeBrowserWindow();
|
||||
NS_ENSURE_TRUE(bw, NS_ERROR_FAILURE);
|
||||
NS_ADDREF(bw);
|
||||
|
||||
bw->SetApp(this);
|
||||
bw->SetShowLoadTimes(mShowLoadTimes);
|
||||
bw->Init(mAppShell, nsRect(0, 0, mWidth, mHeight),
|
||||
PRUint32(~0), mAllowPlugins);
|
||||
bw->Show();
|
||||
nsIBrowserWindow* bwCurrent;
|
||||
bw->SetVisibility(PR_TRUE);
|
||||
nsBrowserWindow* bwCurrent;
|
||||
mCrawler->GetBrowserWindow(&bwCurrent);
|
||||
if (!bwCurrent) {
|
||||
mCrawler->SetBrowserWindow(bw);
|
||||
|
@ -745,8 +735,8 @@ nsViewerApp::OpenWindow()
|
|||
NS_IMETHODIMP
|
||||
nsViewerApp::CloseWindow(nsBrowserWindow* aBrowserWindow)
|
||||
{
|
||||
aBrowserWindow->Close();
|
||||
nsIBrowserWindow* bw;
|
||||
aBrowserWindow->Destroy();
|
||||
nsBrowserWindow* bw;
|
||||
mCrawler->GetBrowserWindow(&bw);
|
||||
if (bw == aBrowserWindow) {
|
||||
mCrawler->SetBrowserWindow(nsnull);
|
||||
|
@ -764,18 +754,15 @@ nsViewerApp::ViewSource(nsString& aURL)
|
|||
// XXX Some piece of code needs to properly hold the reference to this
|
||||
// browser window. For the time being the reference is released by the
|
||||
// browser event handling code during processing of the NS_DESTROY event...
|
||||
nsBrowserWindow* bw = nsnull;
|
||||
nsresult rv = nsComponentManager::CreateInstance(kBrowserWindowCID, nsnull,
|
||||
kIBrowserWindowIID,
|
||||
(void**) &bw);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
nsBrowserWindow* bw = new nsNativeBrowserWindow();
|
||||
NS_ENSURE_TRUE(bw, NS_ERROR_FAILURE);
|
||||
NS_ADDREF(bw);
|
||||
|
||||
bw->SetApp(this);
|
||||
bw->Init(mAppShell, nsRect(0, 0, 620, 400), PRUint32(~0), mAllowPlugins);
|
||||
bw->mDocShell->SetViewMode(nsIDocShell::viewSource);
|
||||
bw->SetTitle(nsAutoString("View Source").GetUnicode());
|
||||
bw->Show();
|
||||
bw->SetVisibility(PR_TRUE);
|
||||
bw->GoTo(aURL.GetUnicode(),"view-source");
|
||||
NS_RELEASE(bw);
|
||||
|
||||
|
@ -783,16 +770,13 @@ nsViewerApp::ViewSource(nsString& aURL)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsViewerApp::OpenWindow(PRUint32 aNewChromeMask, nsIBrowserWindow*& aNewWindow)
|
||||
nsViewerApp::OpenWindow(PRUint32 aNewChromeMask, nsBrowserWindow*& aNewWindow)
|
||||
{
|
||||
// Create browser window
|
||||
nsBrowserWindow* bw = nsnull;
|
||||
nsresult rv = nsComponentManager::CreateInstance(kBrowserWindowCID, nsnull,
|
||||
kIBrowserWindowIID,
|
||||
(void**) &bw);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
nsBrowserWindow* bw = new nsNativeBrowserWindow();
|
||||
NS_ENSURE_TRUE(bw, NS_ERROR_FAILURE);
|
||||
NS_ADDREF(bw);
|
||||
|
||||
bw->SetApp(this);
|
||||
bw->Init(mAppShell, nsRect(0, 0, 620, 400), aNewChromeMask, mAllowPlugins);
|
||||
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
class nsIEventQueueService;
|
||||
class nsIPref;
|
||||
class nsBrowserWindow;
|
||||
class nsIBrowserWindow;
|
||||
|
||||
class nsViewerApp : public nsISupports, public nsDispatchListener
|
||||
{
|
||||
|
@ -53,7 +52,7 @@ public:
|
|||
NS_IMETHOD OpenWindow();
|
||||
NS_IMETHOD CloseWindow(nsBrowserWindow* aBrowserWindow);
|
||||
NS_IMETHOD ViewSource(nsString& aURL);
|
||||
NS_IMETHOD OpenWindow(PRUint32 aNewChromeMask, nsIBrowserWindow*& aNewWindow);
|
||||
NS_IMETHOD OpenWindow(PRUint32 aNewChromeMask, nsBrowserWindow*& aNewWindow);
|
||||
NS_IMETHOD CreateRobot(nsBrowserWindow* aWindow);
|
||||
NS_IMETHOD CreateSiteWalker(nsBrowserWindow* aWindow);
|
||||
NS_IMETHOD CreateJSConsole(nsBrowserWindow* aWindow);
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
// Local Includes
|
||||
#include "nsWebBrowserChrome.h"
|
||||
#include "nsBrowserWindow.h"
|
||||
#include "nsWebCrawler.h"
|
||||
#include "nsViewerApp.h"
|
||||
|
||||
// Helper Classes
|
||||
#include "nsIGenericFactory.h"
|
||||
|
@ -30,6 +32,7 @@
|
|||
|
||||
|
||||
// Interfaces needed to be included
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
|
||||
// CIDs
|
||||
|
||||
|
@ -126,8 +129,22 @@ NS_IMETHODIMP nsWebBrowserChrome::GetChromeMask(PRUint32* aChromeMask)
|
|||
NS_IMETHODIMP nsWebBrowserChrome::GetNewBrowser(PRUint32 aChromeMask,
|
||||
nsIWebBrowser** aWebBrowser)
|
||||
{
|
||||
NS_ERROR("Haven't Implemented this yet");
|
||||
return NS_ERROR_FAILURE;
|
||||
if(mBrowserWindow->mWebCrawler && (mBrowserWindow->mWebCrawler->Crawling() ||
|
||||
mBrowserWindow->mWebCrawler->LoadingURLList()))
|
||||
{
|
||||
// Do not fly javascript popups when we are crawling
|
||||
*aWebBrowser = nsnull;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
nsBrowserWindow* browser = nsnull;
|
||||
mBrowserWindow->mApp->OpenWindow(aChromeMask, browser);
|
||||
|
||||
NS_ENSURE_TRUE(browser, NS_ERROR_FAILURE);
|
||||
|
||||
*aWebBrowser = browser->mWebBrowser;
|
||||
NS_IF_ADDREF(*aWebBrowser);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebBrowserChrome::FindNamedBrowserChrome(const PRUnichar* aName,
|
||||
|
@ -188,8 +205,23 @@ NS_IMETHODIMP nsWebBrowserChrome::ShowModal()
|
|||
NS_IMETHODIMP nsWebBrowserChrome::GetNewWindow(PRInt32 aChromeFlags,
|
||||
nsIDocShellTreeItem** aDocShellTreeItem)
|
||||
{
|
||||
NS_ERROR("Haven't Implemented this yet");
|
||||
return NS_ERROR_FAILURE;
|
||||
if(mBrowserWindow->mWebCrawler && (mBrowserWindow->mWebCrawler->Crawling() ||
|
||||
mBrowserWindow->mWebCrawler->LoadingURLList()))
|
||||
{
|
||||
// Do not fly javascript popups when we are crawling
|
||||
*aDocShellTreeItem = nsnull;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
nsBrowserWindow* browser = nsnull;
|
||||
mBrowserWindow->mApp->OpenWindow(nsIWebBrowserChrome::allChrome, browser);
|
||||
|
||||
NS_ENSURE_TRUE(browser, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> newDocShellAsItem(do_QueryInterface(browser->mDocShell));
|
||||
*aDocShellTreeItem = newDocShellAsItem;
|
||||
NS_IF_ADDREF(*aDocShellTreeItem);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
|
@ -213,64 +245,57 @@ NS_IMETHODIMP nsWebBrowserChrome::Create()
|
|||
|
||||
NS_IMETHODIMP nsWebBrowserChrome::Destroy()
|
||||
{
|
||||
NS_ASSERTION(PR_FALSE, "You can't call this");
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
return mBrowserWindow->Destroy();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebBrowserChrome::SetPosition(PRInt32 x, PRInt32 y)
|
||||
NS_IMETHODIMP nsWebBrowserChrome::SetPosition(PRInt32 aX, PRInt32 aY)
|
||||
{
|
||||
//XXX First Check In
|
||||
NS_ASSERTION(PR_FALSE, "Not Yet Implemented");
|
||||
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* x, PRInt32* y)
|
||||
NS_IMETHODIMP nsWebBrowserChrome::GetPosition(PRInt32* aX, PRInt32* aY)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(x && y);
|
||||
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);
|
||||
|
||||
//XXX First Check In
|
||||
NS_ASSERTION(PR_FALSE, "Not Yet Implemented");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebBrowserChrome::SetSize(PRInt32 cx, PRInt32 cy, PRBool fRepaint)
|
||||
NS_IMETHODIMP nsWebBrowserChrome::GetSize(PRInt32* aCX, PRInt32* aCY)
|
||||
{
|
||||
//XXX First Check In
|
||||
NS_ASSERTION(PR_FALSE, "Not Yet Implemented");
|
||||
return NS_OK;
|
||||
return GetPositionAndSize(nsnull, nsnull, aCX, aCY);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebBrowserChrome::GetSize(PRInt32* cx, PRInt32* cy)
|
||||
NS_IMETHODIMP nsWebBrowserChrome::SetPositionAndSize(PRInt32 aX, PRInt32 aY,
|
||||
PRInt32 aCX, PRInt32 aCY, PRBool aRepaint)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(cx && cy);
|
||||
|
||||
//XXX First Check In
|
||||
NS_ASSERTION(PR_FALSE, "Not Yet Implemented");
|
||||
return NS_OK;
|
||||
return mBrowserWindow->SetPositionAndSize(aX, aY, aCX, aCY, aRepaint);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebBrowserChrome::SetPositionAndSize(PRInt32 x, PRInt32 y, PRInt32 cx,
|
||||
PRInt32 cy, PRBool fRepaint)
|
||||
NS_IMETHODIMP nsWebBrowserChrome::GetPositionAndSize(PRInt32* aX, PRInt32* aY,
|
||||
PRInt32* aCX, PRInt32* aCY)
|
||||
{
|
||||
//XXX First Check In
|
||||
NS_ASSERTION(PR_FALSE, "Not Yet Implemented");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebBrowserChrome::GetPositionAndSize(PRInt32* x, PRInt32* y, PRInt32* cx,
|
||||
PRInt32* cy)
|
||||
{
|
||||
|
||||
//XXX First Check In
|
||||
NS_ASSERTION(PR_FALSE, "Not Yet Implemented");
|
||||
return NS_OK;
|
||||
return mBrowserWindow->GetPositionAndSize(aX, aY, aCX, aCY);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebBrowserChrome::Repaint(PRBool aForce)
|
||||
{
|
||||
//XXX First Check In
|
||||
NS_ASSERTION(PR_FALSE, "Not Yet Implemented");
|
||||
return NS_OK;
|
||||
return mBrowserWindow->Repaint(aForce);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebBrowserChrome::GetParentWidget(nsIWidget** aParentWidget)
|
||||
|
@ -304,18 +329,12 @@ NS_IMETHODIMP nsWebBrowserChrome::SetParentNativeWindow(nativeWindow aParentNati
|
|||
|
||||
NS_IMETHODIMP nsWebBrowserChrome::GetVisibility(PRBool* aVisibility)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aVisibility);
|
||||
|
||||
//XXX First Check In
|
||||
NS_ASSERTION(PR_FALSE, "Not Yet Implemented");
|
||||
return NS_OK;
|
||||
return mBrowserWindow->GetVisibility(aVisibility);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebBrowserChrome::SetVisibility(PRBool aVisibility)
|
||||
{
|
||||
//XXX First Check In
|
||||
NS_ASSERTION(PR_FALSE, "Not Yet Implemented");
|
||||
return NS_OK;
|
||||
return mBrowserWindow->SetVisibility(aVisibility);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebBrowserChrome::GetMainWidget(nsIWidget** aMainWidget)
|
||||
|
@ -328,40 +347,30 @@ NS_IMETHODIMP nsWebBrowserChrome::GetMainWidget(nsIWidget** aMainWidget)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP nsWebBrowserChrome::SetFocus()
|
||||
{
|
||||
//XXX First Check In
|
||||
NS_ASSERTION(PR_FALSE, "Not Yet Implemented");
|
||||
return NS_OK;
|
||||
{
|
||||
return mBrowserWindow->SetFocus();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebBrowserChrome::FocusAvailable(nsIBaseWindow* aCurrentFocus,
|
||||
PRBool* aTookFocus)
|
||||
{
|
||||
//XXX First Check In
|
||||
NS_ASSERTION(PR_FALSE, "Not Yet Implemented");
|
||||
return NS_OK;
|
||||
return mBrowserWindow->FocusAvailable(aCurrentFocus, aTookFocus);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebBrowserChrome::GetTitle(PRUnichar** aTitle)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aTitle);
|
||||
|
||||
//XXX First Check In
|
||||
NS_ASSERTION(PR_FALSE, "Not Yet Implemented");
|
||||
return NS_OK;
|
||||
return mBrowserWindow->GetTitle(aTitle);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebBrowserChrome::SetTitle(const PRUnichar* aTitle)
|
||||
{
|
||||
NS_ENSURE_STATE(mBrowserWindow->mWindow);
|
||||
|
||||
mBrowserWindow->mTitle = aTitle;
|
||||
|
||||
nsAutoString newTitle(aTitle);
|
||||
|
||||
newTitle.Append(" - Raptor");
|
||||
|
||||
mBrowserWindow->mWindow->SetTitle(newTitle);
|
||||
mBrowserWindow->SetTitle(newTitle.GetUnicode());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
#include "nsWebCrawler.h"
|
||||
#include "nsViewerApp.h"
|
||||
#include "nsIWebShell.h"
|
||||
#include "nsIBrowserWindow.h"
|
||||
#include "nsIContentViewer.h"
|
||||
#include "nsIDocumentViewer.h"
|
||||
#include "nsIDocument.h"
|
||||
|
@ -778,7 +777,7 @@ nsWebCrawler::FindMoreURLs()
|
|||
}
|
||||
|
||||
void
|
||||
nsWebCrawler::SetBrowserWindow(nsIBrowserWindow* aWindow)
|
||||
nsWebCrawler::SetBrowserWindow(nsBrowserWindow* aWindow)
|
||||
{
|
||||
NS_IF_RELEASE(mBrowser);
|
||||
mBrowser = aWindow;
|
||||
|
@ -786,7 +785,7 @@ nsWebCrawler::SetBrowserWindow(nsIBrowserWindow* aWindow)
|
|||
}
|
||||
|
||||
void
|
||||
nsWebCrawler::GetBrowserWindow(nsIBrowserWindow** aWindow)
|
||||
nsWebCrawler::GetBrowserWindow(nsBrowserWindow** aWindow)
|
||||
{
|
||||
NS_IF_ADDREF(mBrowser);
|
||||
*aWindow = mBrowser;
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#define nsWebCrawler_h___
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIBrowserWindow.h"
|
||||
#include "nsBrowserWindow.h"
|
||||
#include "nsIDocumentLoader.h"
|
||||
#include "nsIDocumentLoaderObserver.h"
|
||||
#include "nsVoidArray.h"
|
||||
|
@ -59,8 +59,8 @@ public:
|
|||
// Add a domain that must be avoided
|
||||
void AddAvoidDomain(const nsString& aDomain);
|
||||
|
||||
void SetBrowserWindow(nsIBrowserWindow* aWindow);
|
||||
void GetBrowserWindow(nsIBrowserWindow** aWindow);
|
||||
void SetBrowserWindow(nsBrowserWindow* aWindow);
|
||||
void GetBrowserWindow(nsBrowserWindow** aWindow);
|
||||
|
||||
// Set the delay (by default, the timer is set to one second)
|
||||
void SetDelay(PRInt32 aSeconds) {
|
||||
|
@ -143,7 +143,7 @@ protected:
|
|||
void PerformRegressionTest(const nsString& aOutputName);
|
||||
|
||||
nsCOMPtr<nsIDocumentLoader> mDocLoader;
|
||||
nsIBrowserWindow* mBrowser;
|
||||
nsBrowserWindow* mBrowser;
|
||||
nsViewerApp* mViewer;
|
||||
nsITimer* mTimer;
|
||||
FILE* mRecord;
|
||||
|
|
Загрузка…
Ссылка в новой задаче