Committing changes to appcores to support window.open.

This commit is contained in:
hyatt%netscape.com 1999-05-04 23:36:18 +00:00
parent 73333ee036
commit 7545a19058
5 changed files with 37 additions and 63 deletions

View File

@ -329,7 +329,6 @@ nsBrowserAppCore::Stop()
PRInt32
newWind(char* urlName) {
nsresult rv;
nsString controllerCID;
char * urlstr=nsnull;
char * progname = nsnull;
@ -365,13 +364,7 @@ newWind(char* urlName) {
goto done;
}
/*
* XXX: Currently, the CID for the "controller" is passed in as an argument
* to CreateTopLevelWindow(...). Once XUL supports "controller"
* components this will be specified in the XUL description...
*/
controllerCID = "43147b80-8a39-11d2-9938-0080c7cb1081";
appShell->CreateTopLevelWindow(nsnull, url, controllerCID, newWindow,
appShell->CreateTopLevelWindow(nsnull, url, PR_TRUE, newWindow,
nsnull, nsnull, 615, 480);
NS_RELEASE(url);
@ -1357,7 +1350,6 @@ nsBrowserAppCore::HandleUnknownContentType(nsIDocumentLoader* loader,
if ( NS_SUCCEEDED(rv) ) {
// Open "Save to disk" dialog.
nsString controllerCID = "43147b80-8a39-11d2-9938-0080c7cb1081";
nsIWebShellWindow *newWindow;
// Make url for dialog xul.
@ -1370,7 +1362,7 @@ nsBrowserAppCore::HandleUnknownContentType(nsIDocumentLoader* loader,
rv = appShell->CreateTopLevelWindow( nsnull,
url,
controllerCID,
PR_TRUE,
newWindow,
nsnull,
dialog,
@ -1487,7 +1479,6 @@ NS_IMETHODIMP
nsBrowserAppCore::NewWindow()
{
nsresult rv;
nsString controllerCID;
char * urlstr = nsnull;
@ -1525,13 +1516,7 @@ nsBrowserAppCore::NewWindow()
goto done;
}
/*
* XXX: Currently, the CID for the "controller" is passed in as an argument
* to CreateTopLevelWindow(...). Once XUL supports "controller"
* components this will be specified in the XUL description...
*/
controllerCID = "43147b80-8a39-11d2-9938-0080c7cb1081";
appShell->CreateTopLevelWindow(nsnull, url, controllerCID, newWindow,
appShell->CreateTopLevelWindow(nsnull, url, PR_TRUE, newWindow,
nsnull, nsnull, 615, 480);
NS_RELEASE(url);
@ -1809,7 +1794,6 @@ nsBrowserAppCore::DoDialog()
/* (adapted from nsToolkitCore. No one's using this function, are they!?)
*/
nsresult rv;
nsString controllerCID;
nsIAppShellService *appShell;
nsIWebShellWindow *window;
@ -1825,10 +1809,7 @@ nsBrowserAppCore::DoDialog()
if (NS_FAILED(rv))
return rv;
// hardwired temporary hack. See nsAppRunner.cpp at main()
controllerCID = "43147b80-8a39-11d2-9938-0080c7cb1081";
appShell->CreateDialogWindow(mWebShellWin, urlObj, controllerCID, window,
appShell->CreateDialogWindow(mWebShellWin, urlObj, PR_TRUE, window,
nsnull, nsnull, 615, 480);
nsServiceManager::ReleaseService(kAppShellServiceCID, appShell);
// window->Resize(300, 200, PR_TRUE); (until Resize gets moved into nsIWebShellWindow)

View File

@ -431,7 +431,6 @@ NS_IMETHODIMP
nsDOMPropsCore::ShowProperties(const nsString& aUrl, nsIDOMWindow* aParent, nsIDOMNode* aNode) {
nsresult rv;
nsString controllerCID;
nsIAppShellService *appShell;
nsCOMPtr<nsIURL> urlObj;
@ -444,15 +443,13 @@ nsDOMPropsCore::ShowProperties(const nsString& aUrl, nsIDOMWindow* aParent, nsID
if (NS_FAILED(rv))
return rv;
// hardwired temporary hack. See nsAppRunner.cpp at main()
controllerCID = "43147b80-8a39-11d2-9938-0080c7cb1081";
nsIWebShellWindow *newWindow;
nsPropertiesDialog *dialog = new nsPropertiesDialog(aNode);
nsCOMPtr<nsIWebShellWindow> parent = DOMWindowToWebShellWindow(aParent);
rv = appShell->CreateTopLevelWindow(parent, urlObj, controllerCID, newWindow,
rv = appShell->CreateTopLevelWindow(parent, urlObj, PR_TRUE, newWindow,
nsnull, dialog, 450, 240);
nsServiceManager::ReleaseService(kAppShellServiceCID, appShell);

View File

@ -1227,8 +1227,6 @@ nsEditorAppCore::EndBatchChanges()
static PRInt32 MakeNewWindow(char* urlName)
{
nsresult rv;
nsString controllerCID;
char * urlstr=nsnull;
//char * progname = nsnull;
//char * width=nsnull, *height=nsnull;
@ -1263,13 +1261,7 @@ static PRInt32 MakeNewWindow(char* urlName)
goto done;
}
/*
* XXX: Currently, the CID for the "controller" is passed in as an argument
* to CreateTopLevelWindow(...). Once XUL supports "controller"
* components this will be specified in the XUL description...
*/
controllerCID = "43147b80-8a39-11d2-9938-0080c7cb1081";
appShell->CreateTopLevelWindow(nsnull, url, controllerCID, newWindow,
appShell->CreateTopLevelWindow(nsnull, url, PR_TRUE, newWindow,
nsnull, nsnull, 615, 480);
NS_RELEASE(url);

View File

@ -618,7 +618,6 @@ NS_IMETHODIMP nsPrefsCore::ShowWindow(nsIDOMWindow* aCurrentFrontWin)
{
// (code adapted from nsToolkitCore::ShowModal. yeesh.)
nsresult rv;
nsString controllerCID;
nsIAppShellService *appShell;
nsIWebShellWindow *window;
@ -638,12 +637,9 @@ NS_IMETHODIMP nsPrefsCore::ShowWindow(nsIDOMWindow* aCurrentFrontWin)
//nsIXULWindowCallbacks *cb = new nsFindDialogCallbacks( aURL, aContentType );
nsIXULWindowCallbacks *cb = nsnull;
// hardwired temporary hack. See nsAppRunner.cpp at main()
controllerCID = "43147b80-8a39-11d2-9938-0080c7cb1081";
nsCOMPtr<nsIWebShellWindow> parent;
DOMWindowToWebShellWindow(aCurrentFrontWin, &parent);
appShell->CreateDialogWindow(parent, urlObj, controllerCID, window,
appShell->CreateDialogWindow(parent, urlObj, PR_TRUE, window,
nsnull, cb, 504, 436);
nsServiceManager::ReleaseService(kAppShellServiceCID, appShell);

View File

@ -21,6 +21,7 @@
#include "nsAppCoresManager.h"
#include "nsAppShellCIDs.h"
#include "nsIAppShellService.h"
#include "nsIEventQueueService.h"
#include "nsIDOMBaseAppCore.h"
#include "nsIDOMWindow.h"
#include "nsIScriptGlobalObject.h"
@ -37,11 +38,15 @@
#include "nsIDOMXULDocument.h"
#include "nsIDocument.h"
#include "nsIDOMElement.h"
#include "nsXPComCIID.h"
class nsIScriptContext;
static NS_DEFINE_IID(kAppShellServiceCID, NS_APPSHELL_SERVICE_CID);
static NS_DEFINE_IID(kIAppShellServiceIID, NS_IAPPSHELL_SERVICE_IID);
static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
static NS_DEFINE_IID(kIEventQueueServiceIID, NS_IEVENTQUEUESERVICE_IID);
static NS_DEFINE_IID(kIDOMBaseAppCoreIID, NS_IDOMBASEAPPCORE_IID);
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kIToolkitCoreIID, NS_IDOMTOOLKITCORE_IID);
@ -137,7 +142,6 @@ NS_IMETHODIMP
nsToolkitCore::ShowDialog(const nsString& aUrl, nsIDOMWindow* aParent) {
nsresult rv;
nsString controllerCID;
nsIAppShellService *appShell;
nsIWebShellWindow *window;
@ -153,12 +157,9 @@ nsToolkitCore::ShowDialog(const nsString& aUrl, nsIDOMWindow* aParent) {
if (NS_FAILED(rv))
return rv;
// hardwired temporary hack. See nsAppRunner.cpp at main()
controllerCID = "43147b80-8a39-11d2-9938-0080c7cb1081";
nsCOMPtr<nsIWebShellWindow> parent;
DOMWindowToWebShellWindow(aParent, &parent);
appShell->CreateDialogWindow(parent, urlObj, controllerCID, window,
appShell->CreateDialogWindow(parent, urlObj, PR_TRUE, window,
nsnull, nsnull, 615, 480);
nsServiceManager::ReleaseService(kAppShellServiceCID, appShell);
@ -172,7 +173,6 @@ NS_IMETHODIMP
nsToolkitCore::ShowWindow(const nsString& aUrl, nsIDOMWindow* aParent) {
nsresult rv;
nsString controllerCID;
nsIAppShellService *appShell;
nsIWebShellWindow *window;
@ -188,12 +188,9 @@ nsToolkitCore::ShowWindow(const nsString& aUrl, nsIDOMWindow* aParent) {
if (NS_FAILED(rv))
return rv;
// hardwired temporary hack. See nsAppRunner.cpp at main()
controllerCID = "43147b80-8a39-11d2-9938-0080c7cb1081";
nsCOMPtr<nsIWebShellWindow> parent;
DOMWindowToWebShellWindow(aParent, &parent);
appShell->CreateTopLevelWindow(parent, urlObj, controllerCID, window,
appShell->CreateTopLevelWindow(parent, urlObj, PR_TRUE, window,
nsnull, nsnull, 615, 480);
nsServiceManager::ReleaseService(kAppShellServiceCID, appShell);
@ -287,7 +284,6 @@ nsToolkitCore::ShowWindowWithArgs(const nsString& aUrl,
const nsString& aArgs) {
nsresult rv;
nsString controllerCID;
nsIAppShellService *appShell;
nsIWebShellWindow *window;
@ -303,14 +299,11 @@ nsToolkitCore::ShowWindowWithArgs(const nsString& aUrl,
if (NS_FAILED(rv))
return rv;
// hardwired temporary hack. See nsAppRunner.cpp at main()
controllerCID = "43147b80-8a39-11d2-9938-0080c7cb1081";
nsCOMPtr<nsIWebShellWindow> parent;
DOMWindowToWebShellWindow(aParent, &parent);
nsCOMPtr<nsArgCallbacks> cb;
cb = nsDontQueryInterface<nsArgCallbacks>( new nsArgCallbacks( aArgs ) );
appShell->CreateTopLevelWindow(parent, urlObj, controllerCID, window,
appShell->CreateTopLevelWindow(parent, urlObj, PR_TRUE, window,
nsnull, cb, 615, 650);
nsServiceManager::ReleaseService(kAppShellServiceCID, appShell);
@ -324,7 +317,6 @@ NS_IMETHODIMP
nsToolkitCore::ShowModalDialog(const nsString& aUrl, nsIDOMWindow* aParent) {
nsresult rv;
nsString controllerCID;
nsIAppShellService *appShell;
nsIWebShellWindow *window;
@ -340,12 +332,24 @@ nsToolkitCore::ShowModalDialog(const nsString& aUrl, nsIDOMWindow* aParent) {
if (NS_FAILED(rv))
return rv;
// hardwired temporary hack. See nsAppRunner.cpp at main()
controllerCID = "43147b80-8a39-11d2-9938-0080c7cb1081";
// First push a nested event queue for event processing from netlib
// onto our UI thread queue stack.
nsIEventQueueService *eQueueService;
nsCOMPtr<nsIEventQueue> innerQueue;
if (NS_FAILED(rv = nsServiceManager::GetService(kEventQueueServiceCID,
kIEventQueueServiceIID,
(nsISupports **)&eQueueService))) {
NS_ERROR("Unable to obtain queue service.");
return rv;
}
#ifdef XP_WIN32 // XXX: Won't work with any other platforms yet.
eQueueService->PushThreadEventQueue();
#endif // XP_WIN32
nsCOMPtr<nsIWebShellWindow> parent;
DOMWindowToWebShellWindow(aParent, &parent);
appShell->CreateDialogWindow(parent, urlObj, controllerCID, window,
appShell->CreateDialogWindow(parent, urlObj, PR_TRUE, window,
nsnull, nsnull, 615, 480);
nsServiceManager::ReleaseService(kAppShellServiceCID, appShell);
@ -358,11 +362,15 @@ nsToolkitCore::ShowModalDialog(const nsString& aUrl, nsIDOMWindow* aParent) {
// arguably this should be done by the new window, within ShowModal...
if (NS_SUCCEEDED(gotParent))
parentWindowWidgetThing->Enable(PR_FALSE);
window->ShowModal();
window->ShowModal(); // XXX This method pops the queue itself. Ugh. There should really be one
// call for all of this.
if (NS_SUCCEEDED(gotParent))
parentWindowWidgetThing->Enable(PR_TRUE);
}
// Release the event queue
nsServiceManager::ReleaseService(kEventQueueServiceCID, eQueueService);
return rv;
}