From 6a2e3f3bea6a9bde7f40ddd23cbffba351122ab6 Mon Sep 17 00:00:00 2001 From: "danm%netscape.com" Date: Fri, 26 Feb 1999 02:22:42 +0000 Subject: [PATCH] adding C XUL window construction callback git-svn-id: svn://10.0.0.236/trunk@22029 18797224-902f-48f8-a5cc-f745e15eee43 --- .../xpfe/AppCores/src/nsBrowserAppCore.cpp | 6 +- mozilla/xpfe/AppCores/src/nsToolkitCore.cpp | 54 ++++++++++---- mozilla/xpfe/AppCores/src/nsToolkitCore.h | 8 +++ mozilla/xpfe/appshell/public/Makefile.in | 11 +-- mozilla/xpfe/appshell/public/makefile.win | 3 +- .../xpfe/appshell/public/nsIAppShellService.h | 14 ++-- .../appshell/public/nsIXULWindowCallbacks.h | 45 ++++++++++++ .../xpfe/appshell/src/nsAppShellService.cpp | 70 ++++++++++--------- .../xpfe/appshell/src/nsWebShellWindow.cpp | 39 ++++++----- mozilla/xpfe/appshell/src/nsWebShellWindow.h | 8 ++- mozilla/xpfe/bootstrap/nsAppRunner.cpp | 3 +- 11 files changed, 182 insertions(+), 79 deletions(-) create mode 100644 mozilla/xpfe/appshell/public/nsIXULWindowCallbacks.h diff --git a/mozilla/xpfe/AppCores/src/nsBrowserAppCore.cpp b/mozilla/xpfe/AppCores/src/nsBrowserAppCore.cpp index a91d2ac5ed8..f9b0657b3d0 100644 --- a/mozilla/xpfe/AppCores/src/nsBrowserAppCore.cpp +++ b/mozilla/xpfe/AppCores/src/nsBrowserAppCore.cpp @@ -331,7 +331,8 @@ nsBrowserAppCore::NewWindow() * components this will be specified in the XUL description... */ controllerCID = "43147b80-8a39-11d2-9938-0080c7cb1081"; - appShell->CreateTopLevelWindow(url, controllerCID, newWindow, nsnull, 615, 650); + appShell->CreateTopLevelWindow(nsnull, url, controllerCID, newWindow, + nsnull, nsnull, 615, 650); NS_RELEASE(url); done: @@ -497,7 +498,8 @@ nsBrowserAppCore::DoDialog() * components this will be specified in the XUL description... */ controllerCID = "43147b80-8a39-11d2-9938-0080c7cb1081"; - appShell->CreateDialogWindow(parent, url, controllerCID, newWindow, (nsIStreamObserver *)this, 516, 650); + appShell->CreateDialogWindow(parent, url, controllerCID, newWindow, + (nsIStreamObserver *)this, nsnull, 516, 650); newWindow->Resize(300, 200, PR_TRUE); NS_RELEASE(url); NS_RELEASE(parent); diff --git a/mozilla/xpfe/AppCores/src/nsToolkitCore.cpp b/mozilla/xpfe/AppCores/src/nsToolkitCore.cpp index 44fb9b3d16a..c3791979d7c 100644 --- a/mozilla/xpfe/AppCores/src/nsToolkitCore.cpp +++ b/mozilla/xpfe/AppCores/src/nsToolkitCore.cpp @@ -17,13 +17,18 @@ * Netscape Communications Corporation. All Rights Reserved. */ + #include "nsAppCoresManager.h" #include "nsAppShellCIDs.h" #include "nsIAppShellService.h" #include "nsIDOMBaseAppCore.h" +#include "nsIDOMWindow.h" +#include "nsIScriptGlobalObject.h" #include "nsIServiceManager.h" #include "nsISupports.h" #include "nsIURL.h" +#include "nsIWebShell.h" +#include "nsIWebShellWindow.h" #include "nsIWidget.h" #include "nsToolkitCore.h" @@ -36,6 +41,7 @@ static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); static NS_DEFINE_IID(kIToolkitCoreIID, NS_IDOMTOOLKITCORE_IID); + ///////////////////////////////////////////////////////////////////////// // nsToolkitCore ///////////////////////////////////////////////////////////////////////// @@ -127,28 +133,52 @@ nsToolkitCore::ShowWindow(const nsString& aUrl, nsIDOMWindow* aParent) { nsresult rv; nsString controllerCID; nsIAppShellService *appShell; - nsIURL *url; nsIWidget *window; -printf("in toolkitcore::ShowWindow\n"); - window = nsnull; - rv = NS_NewURL(&url, aUrl); + nsCOMPtr urlObj; + rv = NS_NewURL(getter_AddRefs(urlObj), aUrl); if (NS_FAILED(rv)) return rv; rv = nsServiceManager::GetService(kAppShellServiceCID, kIAppShellServiceIID, (nsISupports**) &appShell); - if (NS_SUCCEEDED(rv)) { - // hardwired temporary hack. See nsAppRunner.cpp at main() - controllerCID = "43147b80-8a39-11d2-9938-0080c7cb1081"; - appShell->CreateTopLevelWindow(url, controllerCID, window, nsnull, 615, 650); - nsServiceManager::ReleaseService(kAppShellServiceCID, appShell); - } - if (window != nsnull) { + if (NS_FAILED(rv)) + return rv; + + // hardwired temporary hack. See nsAppRunner.cpp at main() + controllerCID = "43147b80-8a39-11d2-9938-0080c7cb1081"; + + nsCOMPtr webWindow = DOMWindowToWebShellWindow(aParent); + nsCOMPtr parent; + if (webWindow) + webWindow->GetWidget(*getter_AddRefs(parent)); + + appShell->CreateDialogWindow(parent, urlObj, controllerCID, window, + nsnull, nsnull, 615, 650); + nsServiceManager::ReleaseService(kAppShellServiceCID, appShell); + + if (window != nsnull) window->Show(PR_TRUE); - } return rv; } + +// horribly complicated routine to simply convert from one to the other +nsCOMPtr +nsToolkitCore::DOMWindowToWebShellWindow(nsIDOMWindow *DOMWindow) const { + + nsCOMPtr webWindow; + + nsCOMPtr globalScript(do_QueryInterface(DOMWindow)); + nsCOMPtr webshell; + if (globalScript) + globalScript->GetWebShell(getter_AddRefs(webshell)); + if (webshell) { + nsCOMPtr webshellContainer; + webshell->GetContainer(*getter_AddRefs(webshellContainer)); + webWindow = do_QueryInterface(webshellContainer); + } + return webWindow; +} diff --git a/mozilla/xpfe/AppCores/src/nsToolkitCore.h b/mozilla/xpfe/AppCores/src/nsToolkitCore.h index 1ad8ee02620..48a8eebc39a 100644 --- a/mozilla/xpfe/AppCores/src/nsToolkitCore.h +++ b/mozilla/xpfe/AppCores/src/nsToolkitCore.h @@ -20,6 +20,7 @@ //#include "nsAppCores.h" +#include "nsCOMPtr.h" #include "nscore.h" #include "nsString.h" #include "nsISupports.h" @@ -27,7 +28,9 @@ #include "nsIDOMToolkitCore.h" #include "nsBaseAppCore.h" +class nsIDOMWindow; class nsIScriptContext; +class nsIWebShellWindow; //////////////////////////////////////////////////////////////////////////////// // nsToolbarCore: @@ -48,6 +51,11 @@ class nsToolkitCore : public nsBaseAppCore, NS_IMETHOD GetId(nsString& aId) { return nsBaseAppCore::GetId(aId); } NS_DECL_IDOMTOOLKITCORE + + private: + + nsCOMPtr + DOMWindowToWebShellWindow(nsIDOMWindow *DOMWindow) const; }; #endif // nsToolkitCorePrivate_h___ diff --git a/mozilla/xpfe/appshell/public/Makefile.in b/mozilla/xpfe/appshell/public/Makefile.in index 4c0bca51f54..782f41e5e04 100644 --- a/mozilla/xpfe/appshell/public/Makefile.in +++ b/mozilla/xpfe/appshell/public/Makefile.in @@ -24,12 +24,13 @@ include $(DEPTH)/config/autoconf.mk include $(topsrcdir)/config/config.mk EXPORTS = \ - nsIWebShellWindow.h \ - nsAppShellCIDs.h \ + nsIWebShellWindow.h \ + nsAppShellCIDs.h \ nsIAppShellService.h \ - nsICmdLineService.h \ - nsIWidgetController.h \ - $(NULL) + nsICmdLineService.h \ + nsIWidgetController.h \ + nsIXULWindowCallbacks.h \ + $(NULL) EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS)) diff --git a/mozilla/xpfe/appshell/public/makefile.win b/mozilla/xpfe/appshell/public/makefile.win index 6f1570a18b0..dd959bec482 100644 --- a/mozilla/xpfe/appshell/public/makefile.win +++ b/mozilla/xpfe/appshell/public/makefile.win @@ -22,11 +22,12 @@ IGNORE_MANIFEST=1 MODULE=raptor EXPORTS = \ - nsIWebShellWindow.h \ + nsIWebShellWindow.h \ nsAppShellCIDs.h \ nsIAppShellService.h \ nsICmdLineService.h \ nsIWidgetController.h \ + nsIXULWindowCallbacks.h \ $(NULL) include <$(DEPTH)\config\rules.mak> diff --git a/mozilla/xpfe/appshell/public/nsIAppShellService.h b/mozilla/xpfe/appshell/public/nsIAppShellService.h index ce0effbe3a9..5d91476fb10 100644 --- a/mozilla/xpfe/appshell/public/nsIAppShellService.h +++ b/mozilla/xpfe/appshell/public/nsIAppShellService.h @@ -30,6 +30,7 @@ class nsIURL; class nsIWidget; class nsString; class nsIStreamObserver; +class nsIXULWindowCallbacks; // e5e5af70-8a38-11d2-9938-0080c7cb1080 #define NS_IAPPSHELL_SERVICE_IID \ @@ -48,14 +49,17 @@ public: NS_IMETHOD DispatchNativeEvent(void * aEvent) = 0; NS_IMETHOD Shutdown(void) = 0; - NS_IMETHOD CreateTopLevelWindow(nsIURL* aUrl, + NS_IMETHOD CreateTopLevelWindow(nsIWidget * aParent, + nsIURL* aUrl, nsString& aControllerIID, nsIWidget*& aResult, nsIStreamObserver* anObserver, + nsIXULWindowCallbacks *aCallbacks, PRInt32 aInitialWidth, PRInt32 aInitialHeight) = 0; - NS_IMETHOD CreateDialogWindow(nsIWidget * aParent, - nsIURL* aUrl, - nsString& aControllerIID, - nsIWidget*& aResult, nsIStreamObserver* anObserver, + NS_IMETHOD CreateDialogWindow( nsIWidget * aParent, + nsIURL* aUrl, + nsString& aControllerIID, + nsIWidget*& aResult, nsIStreamObserver* anObserver, + nsIXULWindowCallbacks *aCallbacks, PRInt32 aInitialWidth, PRInt32 aInitialHeight) = 0; NS_IMETHOD CloseTopLevelWindow(nsIWidget* aWindow) = 0; NS_IMETHOD RegisterTopLevelWindow(nsIWidget* aWindow) = 0; diff --git a/mozilla/xpfe/appshell/public/nsIXULWindowCallbacks.h b/mozilla/xpfe/appshell/public/nsIXULWindowCallbacks.h new file mode 100644 index 00000000000..5a741cdb09b --- /dev/null +++ b/mozilla/xpfe/appshell/public/nsIXULWindowCallbacks.h @@ -0,0 +1,45 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * + * The Original Code is Mozilla Communicator client code. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are Copyright (C) 1998 + * Netscape Communications Corporation. All Rights Reserved. + */ + +#ifndef nsIXULWindowCallbacks_h__ +#define nsIXULWindowCallbacks_h__ + +#include "nsISupports.h" + +// Interface ID for nsIXULWindowCallbacks_h__ +// {ACE54DD1-CCF5-11d2-81BC-0060083A0BCF} +#define NS_IXULWINDOWCALLBACKS_IID \ + { 0xace54dd1, 0xccf5, 0x11d2, { 0x81, 0xbc, 0x0, 0x60, 0x8, 0x3a, 0xb, 0xcf } } + +class nsIXULWindowCallbacks : public nsISupports +{ +public: + static const nsIID& IID() { static nsIID iid = NS_IXULWINDOWCALLBACKS_IID; return iid; } + + // this method will be called by the window creation code after + // the UI has been loaded, before the window is visible, and before + // the equivalent JavaScript (XUL "onConstruction" attribute) callback. + NS_IMETHOD ConstructBeforeJavaScript(nsIWebShell *aWebShell) = 0; + + // like ConstructBeforeJavaScript, but called after the onConstruction callback + NS_IMETHOD ConstructAfterJavaScript(nsIWebShell *aWebShell) = 0; +}; + + +#endif /* nsIXULWindowCallbacks_h__ */ diff --git a/mozilla/xpfe/appshell/src/nsAppShellService.cpp b/mozilla/xpfe/appshell/src/nsAppShellService.cpp index 83bc9ea6876..0d057e18c77 100644 --- a/mozilla/xpfe/appshell/src/nsAppShellService.cpp +++ b/mozilla/xpfe/appshell/src/nsAppShellService.cpp @@ -65,14 +65,18 @@ public: NS_IMETHOD GetNativeEvent(void *& aEvent, nsIWidget* aWidget, PRBool &aIsInWindow, PRBool &aIsMouseEvent); NS_IMETHOD DispatchNativeEvent(void * aEvent); NS_IMETHOD Shutdown(void); - NS_IMETHOD CreateTopLevelWindow(nsIURL* aUrl, nsString& aControllerIID, + NS_IMETHOD CreateTopLevelWindow(nsIWidget * aParent, + nsIURL* aUrl, + nsString& aControllerIID, nsIWidget*& aResult, nsIStreamObserver* anObserver, + nsIXULWindowCallbacks *aCallbacks, + PRInt32 aInitialWidth, PRInt32 aInitialHeight); + NS_IMETHOD CreateDialogWindow( nsIWidget * aParent, + nsIURL* aUrl, + nsString& aControllerIID, + nsIWidget*& aResult, nsIStreamObserver* anObserver, + nsIXULWindowCallbacks *aCallbacks, PRInt32 aInitialWidth, PRInt32 aInitialHeight); - NS_IMETHOD CreateDialogWindow(nsIWidget * aParent, - nsIURL* aUrl, - nsString& aControllerIID, - nsIWidget*& aResult, nsIStreamObserver* anObserver, - PRInt32 aInitialWidth, PRInt32 aInitialHeight); NS_IMETHOD CloseTopLevelWindow(nsIWidget* aWindow); NS_IMETHOD RegisterTopLevelWindow(nsIWidget* aWindow); NS_IMETHOD UnregisterTopLevelWindow(nsIWidget* aWindow); @@ -82,7 +86,6 @@ protected: virtual ~nsAppShellService(); nsIAppShell* mAppShell; - nsISupportsArray* mWindowList; }; @@ -197,14 +200,25 @@ nsAppShellService::Shutdown(void) /* * Create a new top level window and display the given URL within it... * - * XXX: - * Currently, the IID of the Controller object for the URL is provided as an - * argument. In the future, this argument will be specified by the XUL document - * itself. + * @param aParent - parent for the window to be created (generally null; + * included for compatibility with dialogs). + * (currently unused). + * @param aURL - location of XUL window contents description + * @param aControllerIID - currently provided as an argument. in the future, + * this will be specified by the XUL document itself. + * (currently unused, but please specify the same + * hardwired IID as others are using). + * @param anObserver - a stream observer to give to the new window + * @param aConstructionCallbacks - methods which will be called during + * window construction. can be null. + * @param aInitialWidth - width of window, in pixels (currently unused) + * @param aInitialHeight - height of window, in pixels (currently unused) */ NS_IMETHODIMP -nsAppShellService::CreateTopLevelWindow(nsIURL* aUrl, nsString& aControllerIID, +nsAppShellService::CreateTopLevelWindow(nsIWidget *aParent, + nsIURL* aUrl, nsString& aControllerIID, nsIWidget*& aResult, nsIStreamObserver* anObserver, + nsIXULWindowCallbacks *aCallbacks, PRInt32 aInitialWidth, PRInt32 aInitialHeight) { nsresult rv; @@ -214,7 +228,9 @@ nsAppShellService::CreateTopLevelWindow(nsIURL* aUrl, nsString& aControllerIID, if (nsnull == window) { rv = NS_ERROR_OUT_OF_MEMORY; } else { - rv = window->Initialize(mAppShell, aUrl, aControllerIID, anObserver, aInitialWidth, aInitialHeight); + rv = window->Initialize(aParent, mAppShell, aUrl, aControllerIID, + anObserver, aCallbacks, + aInitialWidth, aInitialHeight); if (NS_SUCCEEDED(rv)) { aResult = window->GetWidget(); RegisterTopLevelWindow(aResult); @@ -240,17 +256,16 @@ nsAppShellService::CloseTopLevelWindow(nsIWidget* aWindow) } /* - * Create a new top level window and display the given URL within it... - * - * XXX: - * Currently, the IID of the Controller object for the URL is provided as an - * argument. In the future, this argument will be specified by the XUL document - * itself. + * Like CreateTopLevelWindow, but with dialog window borders. This + * method is necessary because of the current misfortune that the window + * is created before its XUL description has been parsed, so the description + * can't affect attributes like window type. */ NS_IMETHODIMP nsAppShellService::CreateDialogWindow(nsIWidget * aParent, nsIURL* aUrl, nsString& aControllerIID, nsIWidget*& aResult, nsIStreamObserver* anObserver, + nsIXULWindowCallbacks *aCallbacks, PRInt32 aInitialWidth, PRInt32 aInitialHeight) { nsresult rv; @@ -260,11 +275,13 @@ nsAppShellService::CreateDialogWindow(nsIWidget * aParent, if (nsnull == window) { rv = NS_ERROR_OUT_OF_MEMORY; } else { - rv = window->Initialize(nsnull, mAppShell, aUrl, aControllerIID, anObserver, + rv = window->Initialize(aParent, mAppShell, aUrl, aControllerIID, + anObserver, aCallbacks, aInitialWidth, aInitialHeight); if (NS_SUCCEEDED(rv)) { - mWindowList->AppendElement((nsIWebShellContainer*)window); aResult = window->GetWidget(); + RegisterTopLevelWindow(aResult); + window->Show(PR_TRUE); } } @@ -286,21 +303,11 @@ nsAppShellService::RegisterTopLevelWindow(nsIWidget* aWindow) if (data == nsnull) rv = NS_ERROR_NULL_POINTER; else { -#if 0 nsWebShellWindow* window = (nsWebShellWindow *) data; - nsIWebShellWindow * webShellWin; - rv = window->QueryInterface(kIWebShellWindowIID, (void **) &webShellWin); - if (NS_SUCCEEDED(rv)) { - mWindowList->AppendElement(webShellWin); - } -#else - nsWebShellWindow* window = (nsWebShellWindow *) data; -// nsCOMPtr wsc(window); DRaM nsIWebShellContainer* wsc; rv = window->QueryInterface(kIWebShellContainerIID, (void **) &wsc); if (NS_SUCCEEDED(rv)) mWindowList->AppendElement(wsc); -#endif } return rv; } @@ -317,7 +324,6 @@ nsAppShellService::UnregisterTopLevelWindow(nsIWidget* aWindow) rv = NS_ERROR_NULL_POINTER; else { nsWebShellWindow* window = (nsWebShellWindow *) data; -// nsCOMPtr wsc(window); DRaM nsIWebShellContainer* wsc; rv = window->QueryInterface(kIWebShellContainerIID, (void **) &wsc); if (NS_SUCCEEDED(rv)) diff --git a/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp b/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp index 1c6908e806b..826c65ad833 100644 --- a/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp +++ b/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp @@ -28,6 +28,7 @@ #include "nsWidgetsCID.h" #include "nsIWidget.h" #include "nsIAppShell.h" +#include "nsIXULWindowCallbacks.h" #include "nsIAppShellService.h" #include "nsIWidgetController.h" @@ -109,6 +110,7 @@ nsWebShellWindow::nsWebShellWindow() mWebShell = nsnull; mWindow = nsnull; mController = nsnull; + mCallbacks = nsnull; } @@ -121,6 +123,7 @@ nsWebShellWindow::~nsWebShellWindow() NS_IF_RELEASE(mWindow); NS_IF_RELEASE(mController); + NS_IF_RELEASE(mCallbacks); } @@ -159,17 +162,10 @@ nsWebShellWindow::QueryInterface(REFNSIID aIID, void** aInstancePtr) } -nsresult nsWebShellWindow::Initialize(nsIAppShell* aShell, nsIURL* aUrl, - nsString& aControllerIID, nsIStreamObserver* anObserver, - PRInt32 aInitialWidth, PRInt32 aInitialHeight) -{ - return Initialize(nsnull, aShell, aUrl, aControllerIID, anObserver, - aInitialWidth, aInitialHeight); -} - nsresult nsWebShellWindow::Initialize(nsIWidget* aParent, nsIAppShell* aShell, nsIURL* aUrl, nsString& aControllerIID, nsIStreamObserver* anObserver, + nsIXULWindowCallbacks *aCallbacks, PRInt32 aInitialWidth, PRInt32 aInitialHeight) { nsresult rv; @@ -239,6 +235,10 @@ nsresult nsWebShellWindow::Initialize(nsIWidget* aParent, } /// webShell->SetPrefs(aPrefs); + NS_IF_RELEASE(mCallbacks); + mCallbacks = aCallbacks; + NS_IF_ADDREF(mCallbacks); + if (nsnull != aUrl) { mWebShell->LoadURL(urlString); } @@ -813,7 +813,7 @@ NS_IMETHODIMP nsWebShellWindow::OnConnectionsComplete() /** - * Get nsIDOMElement corresponding to a given webshell + * Get nsIDOMNode corresponding to a given webshell * @param aShell the given webshell * @return the corresponding DOM element, null if for some reason there is none */ @@ -874,20 +874,23 @@ void nsWebShellWindow::ExecuteJavaScriptString(nsString& aJavaScript) */ void nsWebShellWindow::ExecuteStartupCode() { -// NS_PRECONDITION(aNode, "null argument to LoadCommandsInElement"); - nsCOMPtr webshellNode = GetDOMNodeFromWebShell(mWebShell); - if (!webshellNode) - return; + nsCOMPtr webshellElement; - nsCOMPtr webshellElement(do_QueryInterface(webshellNode)); - if (!webshellElement) - return; + if (webshellNode) + webshellElement = do_QueryInterface(webshellNode); - // Get the onConstruction attribute of the webshellElement. + if (mCallbacks) + mCallbacks->ConstructBeforeJavaScript(mWebShell); + + // Execute the string in the onConstruction attribute of the webshellElement. nsString startupCode; - if (NS_SUCCEEDED(webshellElement->GetAttribute("onConstruction", startupCode))) + if (webshellElement && NS_SUCCEEDED(webshellElement->GetAttribute("onConstruction", startupCode))) ExecuteJavaScriptString(startupCode); + + if (mCallbacks) + mCallbacks->ConstructAfterJavaScript(mWebShell); + } diff --git a/mozilla/xpfe/appshell/src/nsWebShellWindow.h b/mozilla/xpfe/appshell/src/nsWebShellWindow.h index 7575ae7b457..d838971689f 100644 --- a/mozilla/xpfe/appshell/src/nsWebShellWindow.h +++ b/mozilla/xpfe/appshell/src/nsWebShellWindow.h @@ -46,6 +46,7 @@ class nsIDOMHTMLImageElement; class nsIDOMElement; class nsIStreamObserver; class nsIDocument; +class nsIXULWindowCallbacks; class nsIContent; @@ -93,9 +94,9 @@ public: NS_IMETHOD GetWidget(nsIWidget *& aWidget); // nsWebShellWindow methods... - nsresult Initialize(nsIAppShell* aShell, nsIURL* aUrl, nsString& aControllerIID, nsIStreamObserver* anObserver, - PRInt32 aInitialWidth, PRInt32 aInitialHeight); - nsresult Initialize(nsIWidget * aParent, nsIAppShell* aShell, nsIURL* aUrl, nsString& aControllerIID, nsIStreamObserver* anObserver, + nsresult Initialize(nsIWidget * aParent, nsIAppShell* aShell, nsIURL* aUrl, + nsString& aControllerIID, nsIStreamObserver* anObserver, + nsIXULWindowCallbacks *aCallbacks, PRInt32 aInitialWidth, PRInt32 aInitialHeight); nsIWidget* GetWidget(void) { return mWindow; } @@ -177,6 +178,7 @@ protected: nsIWidget* mWindow; nsIWebShell* mWebShell; nsIWidgetController* mController; + nsIXULWindowCallbacks* mCallbacks; nsVoidArray mMenuDelegates; }; diff --git a/mozilla/xpfe/bootstrap/nsAppRunner.cpp b/mozilla/xpfe/bootstrap/nsAppRunner.cpp index bfb53bcb7ac..b34c85d24f9 100644 --- a/mozilla/xpfe/bootstrap/nsAppRunner.cpp +++ b/mozilla/xpfe/bootstrap/nsAppRunner.cpp @@ -231,7 +231,8 @@ int main(int argc, char* argv[]) * components this will be specified in the XUL description... */ controllerCID = "43147b80-8a39-11d2-9938-0080c7cb1081"; - rv = appShell->CreateTopLevelWindow(url, controllerCID, newWindow, nsnull, widthVal, heightVal); + rv = appShell->CreateTopLevelWindow(nsnull, url, controllerCID, newWindow, + nsnull, nsnull, widthVal, heightVal); NS_RELEASE(url); if (NS_FAILED(rv)) goto done;