From 378b2f48b99666bcf36234f2729385e30d1bd9fe Mon Sep 17 00:00:00 2001 From: "danm%netscape.com" Date: Sat, 7 Apr 2001 03:33:56 +0000 Subject: [PATCH] removing use of nsNetSupportDialog. bug 72112 continued. r=hyatt,morse,mstoltz,various --- caps/src/nsScriptSecurityManager.cpp | 21 +- extensions/cookie/nsPermissions.cpp | 11 +- extensions/wallet/src/nsWalletService.cpp | 10 +- extensions/wallet/src/singsign.cpp | 1 - extensions/wallet/src/wallet.cpp | 13 +- mailnews/absync/src/nsAbSync.cpp | 13 +- mailnews/base/src/nsMessenger.cpp | 3 +- mailnews/base/src/nsMsgAccountManager.cpp | 2 - mailnews/base/util/nsMsgIncomingServer.cpp | 9 +- mailnews/base/util/nsMsgProtocol.cpp | 3 +- mailnews/compose/src/nsMsgPrompts.cpp | 19 +- mailnews/compose/src/nsSmtpProtocol.cpp | 2 - mailnews/compose/src/nsSmtpService.cpp | 11 +- mailnews/imap/src/nsImapIncomingServer.cpp | 16 +- mailnews/imap/src/nsImapMailFolder.cpp | 2 - mailnews/news/src/nsNewsFolder.cpp | 17 +- modules/plugin/base/src/nsPluginHostImpl.cpp | 16 +- modules/plugin/nglsrc/nsPluginHostImpl.cpp | 16 +- profile/pref-migrator/src/nsPrefMigration.cpp | 2 - xpfe/appshell/src/nsAppShellFactory.cpp | 8 - xpfe/appshell/src/nsWebShellWindow.cpp | 386 +----------------- xpfe/bootstrap/nsSetupRegistry.cpp | 2 - .../bookmarks/src/nsBookmarksService.cpp | 9 +- 23 files changed, 139 insertions(+), 453 deletions(-) diff --git a/caps/src/nsScriptSecurityManager.cpp b/caps/src/nsScriptSecurityManager.cpp index b4bde9d45bf..23dc784fc99 100644 --- a/caps/src/nsScriptSecurityManager.cpp +++ b/caps/src/nsScriptSecurityManager.cpp @@ -50,7 +50,6 @@ #include "nsTextFormatter.h" #include "nsIIOService.h" #include "nsIStringBundle.h" -#include "nsINetSupportDialogService.h" #include "nsNetUtil.h" #include "nsDirectoryService.h" #include "nsDirectoryServiceDefs.h" @@ -64,8 +63,9 @@ #include "nscore.h" #include "nsIDocShell.h" #include "nsIDocShellTreeItem.h" +#include "nsIPrompt.h" +#include "nsIWindowWatcher.h" -static NS_DEFINE_CID(kNetSupportDialogCID, NS_NETSUPPORTDIALOG_CID); static NS_DEFINE_IID(kIIOServiceIID, NS_IIOSERVICE_IID); static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID); static NS_DEFINE_IID(kIStringBundleServiceIID, NS_ISTRINGBUNDLESERVICE_IID); @@ -1142,14 +1142,15 @@ CheckConfirmDialog(JSContext* cx, const PRUnichar *szMessage, const PRUnichar *s if (!prompter) { - //-- Couldn't get prompter from the current window, so get the propmt service. - NS_WITH_SERVICE(nsIPrompt, backupPrompter, kNetSupportDialogCID, &res); - if (NS_FAILED(res)) - { - *checkValue = 0; - return PR_FALSE; - } - prompter = backupPrompter; + //-- Couldn't get prompter from the current window, so get the prompt service. + nsCOMPtr wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1")); + if (wwatch) + wwatch->GetNewPrompter(0, getter_AddRefs(prompter)); + } + if (!prompter) + { + *checkValue = 0; + return PR_FALSE; } PRInt32 buttonPressed = 1; /* in case user exits dialog by clicking X */ diff --git a/extensions/cookie/nsPermissions.cpp b/extensions/cookie/nsPermissions.cpp index 33cf30128a6..5dfa4df27fd 100644 --- a/extensions/cookie/nsPermissions.cpp +++ b/extensions/cookie/nsPermissions.cpp @@ -28,13 +28,13 @@ #include "nsUtils.h" #include "nsXPIDLString.h" #include "nsIFileSpec.h" -#include "nsINetSupportDialogService.h" +#include "nsIPrompt.h" +#include "nsIWindowWatcher.h" #include "nsVoidArray.h" #include "xp_core.h" #include "prmem.h" #include "nsAppDirectoryServiceDefs.h" -static NS_DEFINE_CID(kNetSupportDialogCID, NS_NETSUPPORTDIALOG_CID); static const char *kCookiesPermFileName = "cookperm.txt"; typedef struct _permission_HostStruct { @@ -62,8 +62,11 @@ permission_CheckConfirmYN(nsIPrompt *aPrompter, PRUnichar * szMessage, PRUnichar if (aPrompter) dialog = aPrompter; - else - dialog = do_GetService(kNetSupportDialogCID); + else { + nsCOMPtr wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1")); + if (wwatch) + wwatch->GetNewPrompter(0, getter_AddRefs(dialog)); + } if (!dialog) { *checkValue = 0; return PR_FALSE; diff --git a/extensions/wallet/src/nsWalletService.cpp b/extensions/wallet/src/nsWalletService.cpp index faccd01a4e6..cfa8ee6bcc7 100644 --- a/extensions/wallet/src/nsWalletService.cpp +++ b/extensions/wallet/src/nsWalletService.cpp @@ -41,16 +41,15 @@ #include "nsIFormControl.h" #include "nsIDocShell.h" #include "nsIDOMWindowInternal.h" -#include "nsINetSupportDialogService.h" #include "nsIInterfaceRequestor.h" #include "nsIPrompt.h" #include "nsIChannel.h" +#include "nsIWindowWatcher.h" // for making the leap from nsIDOMWindowInternal -> nsIPresShell #include "nsIScriptGlobalObject.h" static NS_DEFINE_IID(kDocLoaderServiceCID, NS_DOCUMENTLOADER_SERVICE_CID); -static NS_DEFINE_CID(kNetSupportDialogCID, NS_NETSUPPORTDIALOG_CID); nsWalletlibService::nsWalletlibService() @@ -373,8 +372,11 @@ nsWalletlibService::OnEndDocumentLoad(nsIDocumentLoader* aLoader, nsIRequest *re channel->GetNotificationCallbacks(getter_AddRefs(interfaces)); if (interfaces) interfaces->GetInterface(NS_GET_IID(nsIPrompt), getter_AddRefs(prompter)); - if (!prompter) - prompter = do_GetService(kNetSupportDialogCID); + if (!prompter) { + nsCOMPtr wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1")); + if (wwatch) + wwatch->GetNewPrompter(0, getter_AddRefs(prompter)); + } if (prompter) { SINGSIGN_RestoreSignonData(prompter, URLName, nameString, &valueString, elementNumber++); } diff --git a/extensions/wallet/src/singsign.cpp b/extensions/wallet/src/singsign.cpp index 54a7c52d14a..c20ce0ea32b 100644 --- a/extensions/wallet/src/singsign.cpp +++ b/extensions/wallet/src/singsign.cpp @@ -40,7 +40,6 @@ #include "nsIPref.h" #include "nsFileStream.h" #include "nsSpecialSystemDirectory.h" -#include "nsINetSupportDialogService.h" #include "nsIServiceManager.h" #include "nsIIOService.h" #include "nsIURL.h" diff --git a/extensions/wallet/src/wallet.cpp b/extensions/wallet/src/wallet.cpp index c9d21b5d8c9..d5629b7e13f 100644 --- a/extensions/wallet/src/wallet.cpp +++ b/extensions/wallet/src/wallet.cpp @@ -42,11 +42,12 @@ #include "nsIDOMHTMLOptionElement.h" #include "nsIURL.h" #include "nsIDOMWindowCollection.h" +#include "nsIPrompt.h" +#include "nsIWindowWatcher.h" #include "nsFileStream.h" #include "nsAppDirectoryServiceDefs.h" -#include "nsINetSupportDialogService.h" #include "nsIStringBundle.h" #include "nsILocale.h" #include "nsIFileSpec.h" @@ -65,8 +66,6 @@ static NS_DEFINE_IID(kIDOMHTMLOptionElementIID, NS_IDOMHTMLOPTIONELEMENT_IID); -static NS_DEFINE_CID(kNetSupportDialogCID, NS_NETSUPPORTDIALOG_CID); - #include "prlong.h" #include "prinrval.h" @@ -3974,8 +3973,12 @@ WLLT_OnSubmit(nsIContent* currentForm, nsIDOMWindowInternal* window) { /* save login if appropriate */ if (currentFormNode == formNode) { - NS_WITH_SERVICE(nsIPrompt, dialog, kNetSupportDialogCID, &rv); - if (NS_SUCCEEDED(rv)) { + nsCOMPtr dialog; + nsCOMPtr wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1")); + if (wwatch) + wwatch->GetNewPrompter(0, getter_AddRefs(dialog)); + + if (dialog) { SINGSIGN_RememberSignonData(dialog, URLName, signonData, window); } } diff --git a/mailnews/absync/src/nsAbSync.cpp b/mailnews/absync/src/nsAbSync.cpp index 14de597566c..d716003990e 100644 --- a/mailnews/absync/src/nsAbSync.cpp +++ b/mailnews/absync/src/nsAbSync.cpp @@ -39,12 +39,13 @@ #include "nsString.h" #include "nsTextFormatter.h" #include "nsIStringBundle.h" -#include "nsINetSupportDialogService.h" #include "nsMsgI18N.h" #include "nsIScriptGlobalObject.h" #include "nsIInterfaceRequestor.h" #include "nsIDocShellTreeItem.h" #include "nsIDocShellTreeNode.h" +#include "nsIPrompt.h" +#include "nsIWindowWatcher.h" static NS_DEFINE_CID(kCAbSyncPostEngineCID, NS_ABSYNC_POST_ENGINE_CID); static NS_DEFINE_CID(kPrefCID, NS_PREF_CID); @@ -53,7 +54,6 @@ static NS_DEFINE_CID(kAddressBookDBCID, NS_ADDRDATABASE_CID); static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID); static NS_DEFINE_CID(kAbCardPropertyCID, NS_ABCARDPROPERTY_CID); static NS_DEFINE_CID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID); -static NS_DEFINE_CID(kNetSupportDialogCID, NS_NETSUPPORTDIALOG_CID); /* Implementation file */ NS_IMPL_ISUPPORTS1(nsAbSync, nsIAbSync) @@ -310,8 +310,13 @@ nsAbSync::DisplayErrorMessage(const PRUnichar * msg) // If we failed before, fall back to the non-parented modal dialog if (NS_FAILED(rv)) { - NS_WITH_SERVICE(nsIPrompt, dialog, kNetSupportDialogCID, &rv); - if (NS_FAILED(rv)) return rv; + nsCOMPtr dialog; + nsCOMPtr wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1")); + if (wwatch) + wwatch->GetNewPrompter(0, getter_AddRefs(dialog)); + + if (!dialog) + return NS_ERROR_FAILURE; rv = dialog->Alert(nsnull, msg); } diff --git a/mailnews/base/src/nsMessenger.cpp b/mailnews/base/src/nsMessenger.cpp index 08b388b2163..a693431e2f2 100644 --- a/mailnews/base/src/nsMessenger.cpp +++ b/mailnews/base/src/nsMessenger.cpp @@ -36,6 +36,7 @@ // necko #include "nsMimeTypes.h" #include "nsIURL.h" +#include "nsIPrompt.h" #include "nsIStreamListener.h" #include "nsIStreamConverterService.h" #include "nsNetUtil.h" @@ -101,7 +102,6 @@ // Save As #include "nsIFilePicker.h" #include "nsIStringBundle.h" -#include "nsINetSupportDialogService.h" // Find / Find Again #include "nsIFindComponent.h" @@ -112,7 +112,6 @@ static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID); static NS_DEFINE_CID(kMsgSendLaterCID, NS_MSGSENDLATER_CID); static NS_DEFINE_CID(kMsgCopyServiceCID, NS_MSGCOPYSERVICE_CID); static NS_DEFINE_CID(kMsgPrintEngineCID, NS_MSG_PRINTENGINE_CID); -static NS_DEFINE_CID(kNetSupportDialogCID, NS_NETSUPPORTDIALOG_CID); /* This is the next generation string retrieval call */ diff --git a/mailnews/base/src/nsMsgAccountManager.cpp b/mailnews/base/src/nsMsgAccountManager.cpp index 09c74ddfc8d..6dbe28bf062 100644 --- a/mailnews/base/src/nsMsgAccountManager.cpp +++ b/mailnews/base/src/nsMsgAccountManager.cpp @@ -41,7 +41,6 @@ #include "nscore.h" #include "nsCRT.h" // for nsCRT::strtok #include "prprf.h" -#include "nsINetSupportDialogService.h" #include "nsIMsgFolderCache.h" #include "nsFileStream.h" #include "nsMsgUtils.h" @@ -77,7 +76,6 @@ static NS_DEFINE_CID(kMsgAccountCID, NS_MSGACCOUNT_CID); static NS_DEFINE_CID(kMsgIdentityCID, NS_MSGIDENTITY_CID); static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID); static NS_DEFINE_CID(kMsgBiffManagerCID, NS_MSGBIFFMANAGER_CID); -static NS_DEFINE_CID(kCNetSupportDialogCID, NS_NETSUPPORTDIALOG_CID); static NS_DEFINE_CID(kStandardUrlCID, NS_STANDARDURL_CID); static NS_DEFINE_CID(kSmtpServiceCID, NS_SMTPSERVICE_CID); static NS_DEFINE_CID(kMsgFolderCacheCID, NS_MSGFOLDERCACHE_CID); diff --git a/mailnews/base/util/nsMsgIncomingServer.cpp b/mailnews/base/util/nsMsgIncomingServer.cpp index 57a5a1fc3d2..a3465445fc4 100644 --- a/mailnews/base/util/nsMsgIncomingServer.cpp +++ b/mailnews/base/util/nsMsgIncomingServer.cpp @@ -47,7 +47,7 @@ #include "nsIWebShellWindow.h" #include "nsIPrompt.h" #include "nsIWalletService.h" -#include "nsINetSupportDialogService.h" +#include "nsIWindowWatcher.h" #include "nsIStringBundle.h" #include "nsIRDFService.h" @@ -61,7 +61,6 @@ static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID); static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID); static NS_DEFINE_CID(kWalletServiceCID, NS_WALLETSERVICE_CID); -static NS_DEFINE_CID(kNetSupportDialogCID, NS_NETSUPPORTDIALOG_CID); static NS_DEFINE_CID(kMsgFilterServiceCID, NS_MSGFILTERSERVICE_CID); #define OFFLINE_STATUS_CHANGED_TOPIC "network:offline-status-changed" @@ -704,8 +703,10 @@ nsMsgIncomingServer::GetPasswordWithUI(const PRUnichar * aPromptMessage, const } else { - dialog = do_GetService(kNetSupportDialogCID, &rv); - if (NS_FAILED(rv)) return rv; + nsCOMPtr wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1")); + if (wwatch) + wwatch->GetNewPrompter(0, getter_AddRefs(dialog)); + if (!dialog) return NS_ERROR_FAILURE; } if (NS_SUCCEEDED(rv) && dialog) { diff --git a/mailnews/base/util/nsMsgProtocol.cpp b/mailnews/base/util/nsMsgProtocol.cpp index c225f9872a5..eba047319a8 100644 --- a/mailnews/base/util/nsMsgProtocol.cpp +++ b/mailnews/base/util/nsMsgProtocol.cpp @@ -32,12 +32,11 @@ #include "nsIFileChannel.h" #include "nsFileStream.h" #include "nsIFileTransportService.h" -#include "nsINetSupportDialogService.h" #include "nsIDNSService.h" #include "nsIMsgWindow.h" #include "nsIMsgStatusFeedback.h" +#include "nsIPrompt.h" -static NS_DEFINE_CID(kNetSupportDialogCID, NS_NETSUPPORTDIALOG_CID); static NS_DEFINE_CID(kSocketTransportServiceCID, NS_SOCKETTRANSPORTSERVICE_CID); static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID); NS_IMPL_ISUPPORTS4(nsMsgProtocol, diff --git a/mailnews/compose/src/nsMsgPrompts.cpp b/mailnews/compose/src/nsMsgPrompts.cpp index 598b79e3dce..ca7b51300ca 100644 --- a/mailnews/compose/src/nsMsgPrompts.cpp +++ b/mailnews/compose/src/nsMsgPrompts.cpp @@ -22,14 +22,13 @@ #include "nsMsgCopy.h" #include "nsIPref.h" #include "nsMsgPrompts.h" -#include "nsINetSupportDialogService.h" #include "nsIMsgStringService.h" +#include "nsIPrompt.h" +#include "nsIWindowWatcher.h" #include "nsMsgComposeStringBundle.h" #include "nsXPIDLString.h" #include "nsMsgCompCID.h" -static NS_DEFINE_CID(kNetSupportDialogCID, NS_NETSUPPORTDIALOG_CID); - nsresult nsMsgDisplayMessageByID(nsIPrompt * aPrompt, PRInt32 msgID) { @@ -56,7 +55,11 @@ nsMsgDisplayMessageByString(nsIPrompt * aPrompt, const PRUnichar * msg) return NS_ERROR_INVALID_ARG; if (!prompt) - prompt = do_GetService(kNetSupportDialogCID); + { + nsCOMPtr wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1")); + if (wwatch) + wwatch->GetNewPrompter(0, getter_AddRefs(prompt)); + } if (prompt) rv = prompt->Alert(nsnull, msg); @@ -89,8 +92,12 @@ nsMsgAskBooleanQuestionByString(nsIPrompt * aPrompt, const PRUnichar * msg, PRBo return NS_ERROR_INVALID_ARG; if (!dialog) - dialog = do_GetService(kNetSupportDialogCID); - + { + nsCOMPtr wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1")); + if (wwatch) + wwatch->GetNewPrompter(0, getter_AddRefs(dialog)); + } + if (dialog) { rv = dialog->Confirm(nsnull, msg, &result); diff --git a/mailnews/compose/src/nsSmtpProtocol.cpp b/mailnews/compose/src/nsSmtpProtocol.cpp index 60898242704..5fbba339318 100644 --- a/mailnews/compose/src/nsSmtpProtocol.cpp +++ b/mailnews/compose/src/nsSmtpProtocol.cpp @@ -34,7 +34,6 @@ #include "nsIMsgMailNewsUrl.h" #include "nsMsgBaseCID.h" #include "nsMsgCompCID.h" -#include "nsINetSupportDialogService.h" #include "nsIPrompt.h" #include "nsString.h" #include "nsTextFormatter.h" @@ -70,7 +69,6 @@ static PRLogModuleInfo *SMTPLogModule = nsnull; static NS_DEFINE_CID(kHeaderParserCID, NS_MSGHEADERPARSER_CID); -static NS_DEFINE_CID(kCNetSupportDialogCID, NS_NETSUPPORTDIALOG_CID); extern "C" { diff --git a/mailnews/compose/src/nsSmtpService.cpp b/mailnews/compose/src/nsSmtpService.cpp index 47ce5b3d96f..0572e29ea5e 100644 --- a/mailnews/compose/src/nsSmtpService.cpp +++ b/mailnews/compose/src/nsSmtpService.cpp @@ -37,7 +37,8 @@ #include "nsCOMPtr.h" #include "nsIMsgIdentity.h" #include "nsMsgComposeStringBundle.h" -#include "nsINetSupportDialogService.h" +#include "nsIPrompt.h" +#include "nsIWindowWatcher.h" typedef struct _findServerByKeyEntry { const char *key; @@ -54,7 +55,6 @@ static NS_DEFINE_CID(kCSmtpUrlCID, NS_SMTPURL_CID); static NS_DEFINE_CID(kCMailtoUrlCID, NS_MAILTOURL_CID); static NS_DEFINE_CID(kSmtpServiceCID, NS_SMTPSERVICE_CID); static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID); -static NS_DEFINE_CID(kNetSupportDialogCID, NS_NETSUPPORTDIALOG_CID); // foward declarations... nsresult @@ -188,7 +188,12 @@ nsresult NS_MsgBuildSmtpUrl(nsIFileSpec * aFilePath, smtpUrl->SetNotificationCallbacks(aNotificationCallbacks); nsCOMPtr smtpPrompt(do_GetInterface(aNotificationCallbacks)); if (!smtpPrompt) - smtpPrompt = do_GetService(kNetSupportDialogCID); + { + nsCOMPtr wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1")); + if (wwatch) + wwatch->GetNewPrompter(0, getter_AddRefs(smtpPrompt)); + } + smtpUrl->SetPrompt(smtpPrompt); url->RegisterListener(aUrlListener); } diff --git a/mailnews/imap/src/nsImapIncomingServer.cpp b/mailnews/imap/src/nsImapIncomingServer.cpp index 48a4372246b..8942c0e113e 100644 --- a/mailnews/imap/src/nsImapIncomingServer.cpp +++ b/mailnews/imap/src/nsImapIncomingServer.cpp @@ -55,7 +55,6 @@ #include "nsImapUtils.h" #include "nsIRDFService.h" #include "nsRDFCID.h" -#include "nsINetSupportDialogService.h" #include "nsEnumeratorUtils.h" #include "nsIEventQueueService.h" #include "nsIMsgMailNewsUrl.h" @@ -63,6 +62,8 @@ #include "nsMsgI18N.h" #include "nsAutoLock.h" #include "nsIImapMockChannel.h" +#include "nsIPrompt.h" +#include "nsIWindowWatcher.h" // for the memory cache... #include "nsINetDataCacheManager.h" #include "nsINetDataCache.h" @@ -74,7 +75,6 @@ static NS_DEFINE_CID(kCImapHostSessionList, NS_IIMAPHOSTSESSIONLIST_CID); static NS_DEFINE_CID(kImapProtocolCID, NS_IMAPPROTOCOL_CID); static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID); -static NS_DEFINE_CID(kNetSupportDialogCID, NS_NETSUPPORTDIALOG_CID); static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID); static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID); static NS_DEFINE_CID(kMsgLogonRedirectorServiceCID, NS_MSGLOGONREDIRECTORSERVICE_CID); @@ -1718,7 +1718,11 @@ nsImapIncomingServer::FEAlert(const PRUnichar* aString, nsIMsgWindow * aMsgWindo aMsgWindow->GetPromptDialog(getter_AddRefs(dialog)); if (!dialog) // if we didn't get one, use the default.... - dialog = do_GetService(kNetSupportDialogCID); + { + nsCOMPtr wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1")); + if (wwatch) + wwatch->GetNewPrompter(0, getter_AddRefs(dialog)); + } if (dialog) rv = dialog->Alert(nsnull, aString); @@ -1734,7 +1738,11 @@ NS_IMETHODIMP nsImapIncomingServer::FEAlertFromServer(const char *aString, nsIM aMsgWindow->GetPromptDialog(getter_AddRefs(dialog)); if (!dialog) // if we didn't get one, use the default.... - dialog = do_GetService(kNetSupportDialogCID); + { + nsCOMPtr wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1")); + if (wwatch) + wwatch->GetNewPrompter(0, getter_AddRefs(dialog)); + } if (aString) { diff --git a/mailnews/imap/src/nsImapMailFolder.cpp b/mailnews/imap/src/nsImapMailFolder.cpp index 5bb32328ba3..3e42368a7ce 100644 --- a/mailnews/imap/src/nsImapMailFolder.cpp +++ b/mailnews/imap/src/nsImapMailFolder.cpp @@ -57,7 +57,6 @@ #include "nsIPrompt.h" #include "nsIDocShell.h" #include "nsIInterfaceRequestor.h" -#include "nsINetSupportDialogService.h" #include "nsSpecialSystemDirectory.h" #include "nsXPIDLString.h" #include "nsIImapFlagAndUidState.h" @@ -73,7 +72,6 @@ #include "nsQuickSort.h" static NS_DEFINE_CID(kMsgAccountManagerCID, NS_MSGACCOUNTMANAGER_CID); -static NS_DEFINE_CID(kNetSupportDialogCID, NS_NETSUPPORTDIALOG_CID); static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID); static NS_DEFINE_CID(kCMailDB, NS_MAILDB_CID); static NS_DEFINE_CID(kImapProtocolCID, NS_IMAPPROTOCOL_CID); diff --git a/mailnews/news/src/nsNewsFolder.cpp b/mailnews/news/src/nsNewsFolder.cpp index b3dd3c2a052..cf6cccfb3a1 100644 --- a/mailnews/news/src/nsNewsFolder.cpp +++ b/mailnews/news/src/nsNewsFolder.cpp @@ -60,6 +60,7 @@ #include "nsIDocShell.h" #include "nsIWebShell.h" #include "nsIPrompt.h" +#include "nsIWindowWatcher.h" #include "nsXPIDLString.h" @@ -68,7 +69,6 @@ #include "nsINntpUrl.h" #include "nsNewsSummarySpec.h" -#include "nsINetSupportDialogService.h" #include "nsIInterfaceRequestor.h" #include "nsReadableUtils.h" @@ -85,7 +85,6 @@ static NS_DEFINE_CID(kMsgMailSessionCID, NS_MSGMAILSESSION_CID); static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID); static NS_DEFINE_CID(kWalletServiceCID, NS_WALLETSERVICE_CID); static NS_DEFINE_CID(kStandardUrlCID, NS_STANDARDURL_CID); -static NS_DEFINE_CID(kNetSupportDialogCID, NS_NETSUPPORTDIALOG_CID); // ###tw This really ought to be the most // efficient file reading size for the current @@ -1461,8 +1460,11 @@ nsMsgNewsFolder::GetGroupPasswordWithUI(const PRUnichar * aPromptMessage, const if (NS_FAILED(rv)) return rv; } else { - dialog = do_GetService(kNetSupportDialogCID, &rv); - if (NS_FAILED(rv)) return rv; + nsCOMPtr wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1")); + if (wwatch) + wwatch->GetNewPrompter(0, getter_AddRefs(dialog)); + + if (!dialog) return NS_ERROR_FAILURE; } NS_ASSERTION(dialog,"we didn't get a net prompt"); @@ -1527,8 +1529,11 @@ nsMsgNewsFolder::GetGroupUsernameWithUI(const PRUnichar * aPromptMessage, const if (NS_FAILED(rv)) return rv; } else { - dialog = do_GetService(kNetSupportDialogCID, &rv); - if (NS_FAILED(rv)) return rv; + nsCOMPtr wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1")); + if (wwatch) + wwatch->GetNewPrompter(0, getter_AddRefs(dialog)); + + if (!dialog) return NS_ERROR_FAILURE; } NS_ASSERTION(dialog,"we didn't get a net prompt"); diff --git a/modules/plugin/base/src/nsPluginHostImpl.cpp b/modules/plugin/base/src/nsPluginHostImpl.cpp index 7f170a1aede..8d1db163808 100644 --- a/modules/plugin/base/src/nsPluginHostImpl.cpp +++ b/modules/plugin/base/src/nsPluginHostImpl.cpp @@ -67,8 +67,8 @@ // for the dialog #include "nsIStringBundle.h" -#include "nsINetSupportDialogService.h" #include "nsIPrompt.h" +#include "nsIWindowWatcher.h" #include "nsHashtable.h" #include "nsILocale.h" @@ -149,7 +149,6 @@ static NS_DEFINE_IID(kIOutputStreamIID, NS_IOUTPUTSTREAM_IID); static NS_DEFINE_CID(kRegistryCID, NS_REGISTRY_CID); // for the dialog -static NS_DEFINE_CID(kNetSupportDialogCID, NS_NETSUPPORTDIALOG_CID); static NS_DEFINE_IID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID); static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID); @@ -206,9 +205,12 @@ void DisplayNoDefaultPluginDialog(const char *mimeType) } } - nsCOMPtr prefs(do_GetService(kPrefServiceCID)); - nsCOMPtr prompt(do_GetService(kNetSupportDialogCID)); + nsCOMPtr prompt; + nsCOMPtr wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1")); + if (wwatch) + wwatch->GetNewPrompter(0, getter_AddRefs(prompt)); + nsCOMPtr io(do_GetService(kIOServiceCID)); nsCOMPtr strings(do_GetService(kStringBundleServiceCID)); nsCOMPtr bundle; @@ -4384,7 +4386,11 @@ NS_IMETHODIMP nsPluginHostImpl::HandleBadPlugin(PRLibrary* aLibrary) if(mDontShowBadPluginMessage) return rv; - nsCOMPtr prompt(do_GetService(kNetSupportDialogCID)); + nsCOMPtr prompt; + nsCOMPtr wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1")); + if (wwatch) + wwatch->GetNewPrompter(0, getter_AddRefs(prompt)); + nsCOMPtr io(do_GetService(kIOServiceCID)); nsCOMPtr strings(do_GetService(kStringBundleServiceCID)); diff --git a/modules/plugin/nglsrc/nsPluginHostImpl.cpp b/modules/plugin/nglsrc/nsPluginHostImpl.cpp index 7f170a1aede..8d1db163808 100644 --- a/modules/plugin/nglsrc/nsPluginHostImpl.cpp +++ b/modules/plugin/nglsrc/nsPluginHostImpl.cpp @@ -67,8 +67,8 @@ // for the dialog #include "nsIStringBundle.h" -#include "nsINetSupportDialogService.h" #include "nsIPrompt.h" +#include "nsIWindowWatcher.h" #include "nsHashtable.h" #include "nsILocale.h" @@ -149,7 +149,6 @@ static NS_DEFINE_IID(kIOutputStreamIID, NS_IOUTPUTSTREAM_IID); static NS_DEFINE_CID(kRegistryCID, NS_REGISTRY_CID); // for the dialog -static NS_DEFINE_CID(kNetSupportDialogCID, NS_NETSUPPORTDIALOG_CID); static NS_DEFINE_IID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID); static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID); @@ -206,9 +205,12 @@ void DisplayNoDefaultPluginDialog(const char *mimeType) } } - nsCOMPtr prefs(do_GetService(kPrefServiceCID)); - nsCOMPtr prompt(do_GetService(kNetSupportDialogCID)); + nsCOMPtr prompt; + nsCOMPtr wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1")); + if (wwatch) + wwatch->GetNewPrompter(0, getter_AddRefs(prompt)); + nsCOMPtr io(do_GetService(kIOServiceCID)); nsCOMPtr strings(do_GetService(kStringBundleServiceCID)); nsCOMPtr bundle; @@ -4384,7 +4386,11 @@ NS_IMETHODIMP nsPluginHostImpl::HandleBadPlugin(PRLibrary* aLibrary) if(mDontShowBadPluginMessage) return rv; - nsCOMPtr prompt(do_GetService(kNetSupportDialogCID)); + nsCOMPtr prompt; + nsCOMPtr wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1")); + if (wwatch) + wwatch->GetNewPrompter(0, getter_AddRefs(prompt)); + nsCOMPtr io(do_GetService(kIOServiceCID)); nsCOMPtr strings(do_GetService(kStringBundleServiceCID)); diff --git a/profile/pref-migrator/src/nsPrefMigration.cpp b/profile/pref-migrator/src/nsPrefMigration.cpp index 72e40aeacf3..820a53562a3 100644 --- a/profile/pref-migrator/src/nsPrefMigration.cpp +++ b/profile/pref-migrator/src/nsPrefMigration.cpp @@ -28,7 +28,6 @@ #include "nsIAppShellComponentImpl.h" #include "nsIComponentManager.h" #include "nsIServiceManager.h" -#include "nsINetSupportDialogService.h" #include "nsIWindowMediator.h" #include "nsICommonDialogs.h" #include "nsIScriptGlobalObject.h" @@ -227,7 +226,6 @@ static NS_DEFINE_IID(kPrefMigrationCID, NS_PREFMIGRATION_CID); static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID); static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID); -static NS_DEFINE_CID(kNetSupportDialogCID, NS_NETSUPPORTDIALOG_CID); static NS_DEFINE_CID(kWindowMediatorCID, NS_WINDOWMEDIATOR_CID); static NS_DEFINE_CID(kCommonDialogsCID, NS_CommonDialog_CID); static NS_DEFINE_CID(kDialogParamBlockCID, NS_DialogParamBlock_CID); diff --git a/xpfe/appshell/src/nsAppShellFactory.cpp b/xpfe/appshell/src/nsAppShellFactory.cpp index 53e14e59bf9..3a44b43e29e 100644 --- a/xpfe/appshell/src/nsAppShellFactory.cpp +++ b/xpfe/appshell/src/nsAppShellFactory.cpp @@ -26,7 +26,6 @@ #include "nsAppShellCIDs.h" #include "nsICmdLineService.h" #include "nsIFileLocator.h" -#include "nsINetSupportDialogService.h" #include "nsIWindowMediator.h" #include "rdf.h" #include "nsICommonDialogs.h" @@ -37,7 +36,6 @@ #include "nsIAppShellService.h" #include "nsCommandLineService.h" -#include "nsNetSupportDialog.h" #include "nsAppShellService.h" #include "nsXPConnectFactory.h" #include "nsWindowMediator.h" @@ -61,7 +59,6 @@ nsresult NS_NewXPConnectFactoryFactory(nsIFactory** aResult); NS_GENERIC_FACTORY_CONSTRUCTOR(nsCmdLineService); NS_GENERIC_FACTORY_CONSTRUCTOR(nsAppShellService); NS_GENERIC_FACTORY_CONSTRUCTOR(XPConnectFactoryImpl); -NS_GENERIC_FACTORY_CONSTRUCTOR(nsNetSupportDialog); NS_GENERIC_FACTORY_CONSTRUCTOR(nsWindowMediator); NS_GENERIC_FACTORY_CONSTRUCTOR(nsCommonDialogs); NS_GENERIC_FACTORY_CONSTRUCTOR(nsDialogParamBlock); @@ -85,11 +82,6 @@ static nsModuleComponentInfo gAppShellModuleInfo[] = NULL, XPConnectFactoryImplConstructor, }, - { "Net Support Dialogs", - NS_NETSUPPORTDIALOG_CID, - NULL, - nsNetSupportDialogConstructor, - }, { "Window Mediator", NS_WINDOWMEDIATOR_CID, NS_RDF_DATASOURCE_CONTRACTID_PREFIX "window-mediator", diff --git a/xpfe/appshell/src/nsWebShellWindow.cpp b/xpfe/appshell/src/nsWebShellWindow.cpp index f2f4c9d8c27..d95dda448c7 100644 --- a/xpfe/appshell/src/nsWebShellWindow.cpp +++ b/xpfe/appshell/src/nsWebShellWindow.cpp @@ -47,6 +47,7 @@ static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID); #include "nsIDOMEventTarget.h" #include "nsIDOMFocusListener.h" #include "nsIWebNavigation.h" +#include "nsIWindowWatcher.h" #include "nsIXULPopupListener.h" #include "nsIDOMXULElement.h" @@ -126,7 +127,6 @@ static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID); #endif #include "nsIPopupSetFrame.h" -#include "nsIWalletService.h" /* Define Class IDs */ static NS_DEFINE_CID(kWindowCID, NS_WINDOW_CID); @@ -145,7 +145,6 @@ static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID); static NS_DEFINE_CID(kLayoutDocumentLoaderFactoryCID, NS_LAYOUT_DOCUMENT_LOADER_FACTORY_CID); static NS_DEFINE_CID(kXULPopupListenerCID, NS_XULPOPUPLISTENER_CID); -static NS_DEFINE_CID(kSingleSignOnPromptCID, NS_SINGLESIGNONPROMPT_CID); #ifdef DEBUG_rods @@ -154,8 +153,6 @@ static NS_DEFINE_CID(kSingleSignOnPromptCID, NS_SINGLESIGNONPROMPT_CID); #include "nsICommonDialogs.h" static NS_DEFINE_CID( kCommonDialogsCID, NS_CommonDialog_CID ); -#include "nsIWalletService.h" -static NS_DEFINE_CID(kWalletServiceCID, NS_WALLETSERVICE_CID); #include "nsIWebShell.h" static NS_DEFINE_CID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID); @@ -1742,379 +1739,34 @@ NS_IMETHODIMP nsWebShellWindow::Destroy() return nsXULWindow::Destroy(); } -//////////////////////////////////////////////////////////////////////////////// -// XXX What a mess we have here w.r.t. our prompting interfaces. As far as I -// can tell, the situation looks something like this: -// -// - clients get the nsIPrompt from the web shell window -// - the web shell window passes control to nsCommonDialogs -// - nsCommonDialogs calls into js with the current dom window -// - the dom window gets the nsIPrompt of its tree owner -// - somewhere along the way a real dialog comes up -// -// This little transducer maps the nsIPrompt interface to the nsICommonDialogs -// interface. Ideally, nsIPrompt would be implemented by nsIDOMWindowInternal which -// would eliminate the need for this. - -class nsDOMWindowPrompter : public nsIPrompt -{ -public: - NS_DECL_ISUPPORTS - NS_DECL_NSIPROMPT - - nsDOMWindowPrompter(nsIDOMWindowInternal* window); - virtual ~nsDOMWindowPrompter() {} - - nsresult Init(); - -protected: - nsCOMPtr mDOMWindow; - nsCOMPtr mCommonDialogs; - - nsresult GetLocaleString(const PRUnichar*, PRUnichar**); -}; - -static nsresult -NS_NewDOMWindowPrompter(nsIPrompt* *result, nsIDOMWindowInternal* window) -{ - nsresult rv; - nsDOMWindowPrompter* prompter = new nsDOMWindowPrompter(window); - if (prompter == nsnull) - return NS_ERROR_OUT_OF_MEMORY; - NS_ADDREF(prompter); - rv = prompter->Init(); - if (NS_FAILED(rv)) { - NS_RELEASE(prompter); - return rv; - } - *result = prompter; - return NS_OK; -} - -NS_IMPL_THREADSAFE_ISUPPORTS1(nsDOMWindowPrompter, nsIPrompt) - -nsDOMWindowPrompter::nsDOMWindowPrompter(nsIDOMWindowInternal* window) - : mDOMWindow(window) -{ - NS_INIT_REFCNT(); -} - -nsresult -nsDOMWindowPrompter::Init() -{ - nsresult rv; - mCommonDialogs = do_GetService(kCommonDialogsCID, &rv); - return rv; -} - -nsresult -nsDOMWindowPrompter::GetLocaleString(const PRUnichar* aString, PRUnichar** aResult) -{ - nsresult rv; - - nsCOMPtr stringService = do_GetService(kStringBundleServiceCID); - nsCOMPtr stringBundle; - nsILocale *locale = nsnull; - - rv = stringService->CreateBundle(kWebShellLocaleProperties, locale, getter_AddRefs(stringBundle)); - if (NS_FAILED(rv)) return NS_ERROR_FAILURE; - - rv = stringBundle->GetStringFromName(aString, aResult); - - return rv; -} - -NS_IMETHODIMP -nsDOMWindowPrompter::Alert(const PRUnichar* dialogTitle, - const PRUnichar* text) -{ - nsresult rv; - - if (dialogTitle == nsnull) { - PRUnichar *title; - rv = GetLocaleString(NS_ConvertASCIItoUCS2("Alert").get(), &title); - if (NS_FAILED(rv)) return NS_ERROR_FAILURE; - - rv = mCommonDialogs->Alert(mDOMWindow, title, text); - nsCRT::free(title); - title = nsnull; - } - else { - rv = mCommonDialogs->Alert(mDOMWindow, dialogTitle, text); - } - - return rv; -} - -NS_IMETHODIMP -nsDOMWindowPrompter::AlertCheck(const PRUnichar* dialogTitle, - const PRUnichar* text, - const PRUnichar* checkMsg, - PRBool *checkValue) -{ - nsresult rv; - - if (dialogTitle == nsnull) { - PRUnichar *title; - rv = GetLocaleString(NS_LITERAL_STRING("Alert").get(), &title); - if (NS_FAILED(rv)) return NS_ERROR_FAILURE; - - rv = mCommonDialogs->AlertCheck(mDOMWindow, title, text, checkMsg, checkValue); - nsCRT::free(title); - title = nsnull; - } - else { - rv = mCommonDialogs->AlertCheck(mDOMWindow, dialogTitle, text, checkMsg, checkValue); - } - - return rv; -} - -NS_IMETHODIMP -nsDOMWindowPrompter::Confirm(const PRUnichar* dialogTitle, - const PRUnichar* text, - PRBool *_retval) -{ - nsresult rv; - if (dialogTitle == nsnull) { - PRUnichar *title; - rv = GetLocaleString(NS_ConvertASCIItoUCS2("Confirm").get(), &title); - if (NS_FAILED(rv)) return NS_ERROR_FAILURE; - - rv = mCommonDialogs->Confirm(mDOMWindow, title, text, _retval); - nsCRT::free(title); - title = nsnull; - } - else { - rv = mCommonDialogs->Confirm(mDOMWindow, dialogTitle, text, _retval); - } - - return rv; -} - -NS_IMETHODIMP -nsDOMWindowPrompter::ConfirmCheck(const PRUnichar* dialogTitle, - const PRUnichar* text, - const PRUnichar* checkMsg, - PRBool *checkValue, - PRBool *_retval) -{ - nsresult rv; - - if (dialogTitle == nsnull) { - PRUnichar *title; - rv = GetLocaleString(NS_ConvertASCIItoUCS2("ConfirmCheck").get(), &title); - if (NS_FAILED(rv)) return NS_ERROR_FAILURE; - - rv = mCommonDialogs->ConfirmCheck(mDOMWindow, title, text, checkMsg, checkValue, _retval); - nsCRT::free(title); - title = nsnull; - } - else { - rv = mCommonDialogs->ConfirmCheck(mDOMWindow, dialogTitle, text, checkMsg, checkValue, _retval); - } - - return rv; -} - -NS_IMETHODIMP -nsDOMWindowPrompter::Prompt(const PRUnichar* dialogTitle, - const PRUnichar* text, - const PRUnichar* passwordRealm, - PRUint32 savePassword, - const PRUnichar* defaultText, - PRUnichar* *result, - PRBool *_retval) -{ - nsresult rv; - - if (dialogTitle == nsnull) { - PRUnichar *title; - rv = GetLocaleString(NS_ConvertASCIItoUCS2("Prompt").get(), &title); - if (NS_FAILED(rv)) return NS_ERROR_FAILURE; - - rv = mCommonDialogs->Prompt(mDOMWindow, title, text, - defaultText, result, _retval); - nsCRT::free(title); - title = nsnull; - } - else { - rv = mCommonDialogs->Prompt(mDOMWindow, dialogTitle, text, - defaultText, result, _retval); - } - - return rv; -} - -NS_IMETHODIMP -nsDOMWindowPrompter::PromptUsernameAndPassword(const PRUnichar* dialogTitle, - const PRUnichar* text, - const PRUnichar* passwordRealm, - PRUint32 savePassword, - PRUnichar* *user, - PRUnichar* *pwd, - PRBool *_retval) -{ - nsresult rv; - - if (dialogTitle == nsnull) { - PRUnichar *title; - rv = GetLocaleString(NS_ConvertASCIItoUCS2("PromptUsernameAndPassword").get(), &title); - if (NS_FAILED(rv)) return NS_ERROR_FAILURE; - - rv = mCommonDialogs->PromptUsernameAndPassword(mDOMWindow, title, text, - user, pwd, _retval); - nsCRT::free(title); - title = nsnull; - } - else { - rv = mCommonDialogs->PromptUsernameAndPassword(mDOMWindow, dialogTitle, text, - user, pwd, _retval); - } - - return rv; -} - -NS_IMETHODIMP -nsDOMWindowPrompter::PromptPassword(const PRUnichar* dialogTitle, - const PRUnichar* text, - const PRUnichar* passwordRealm, - PRUint32 savePassword, - PRUnichar* *pwd, - PRBool *_retval) -{ - // ignore passwordRealm and savePassword here? - nsresult rv; - - if (dialogTitle == nsnull) { - PRUnichar *title; - rv = GetLocaleString(NS_ConvertASCIItoUCS2("PromptPassword").get(), &title); - if (NS_FAILED(rv)) return NS_ERROR_FAILURE; - - rv = mCommonDialogs->PromptPassword(mDOMWindow, title, text, - pwd, _retval); - - nsCRT::free(title); - title = nsnull; - } - else { - rv = mCommonDialogs->PromptPassword(mDOMWindow, dialogTitle, text, - pwd, _retval); - } - - return rv; -} - -NS_IMETHODIMP -nsDOMWindowPrompter::Select(const PRUnichar *dialogTitle, - const PRUnichar* inMsg, - PRUint32 inCount, - const PRUnichar **inList, - PRInt32 *outSelection, - PRBool *_retval) -{ - nsresult rv; - - if (dialogTitle == nsnull) { - PRUnichar *title; - rv = GetLocaleString(NS_ConvertASCIItoUCS2("Select").get(), &title); - if (NS_FAILED(rv)) return NS_ERROR_FAILURE; - - rv = mCommonDialogs->Select(mDOMWindow, title, inMsg, - inCount, inList, outSelection, _retval); - nsCRT::free(title); - title = nsnull; - } - else { - rv = mCommonDialogs->Select(mDOMWindow, dialogTitle, inMsg, - inCount, inList, outSelection, _retval); - } - - return rv; -} - -NS_IMETHODIMP -nsDOMWindowPrompter::UniversalDialog(const PRUnichar *inTitleMessage, - const PRUnichar *inDialogTitle, /* e.g., alert, confirm, prompt, prompt password */ - const PRUnichar *inMsg, /* main message for dialog */ - const PRUnichar *inCheckboxMsg, /* message for checkbox */ - const PRUnichar *inButton0Text, /* text for first button */ - const PRUnichar *inButton1Text, /* text for second button */ - const PRUnichar *inButton2Text, /* text for third button */ - const PRUnichar *inButton3Text, /* text for fourth button */ - const PRUnichar *inEditfield1Msg, /*message for first edit field */ - const PRUnichar *inEditfield2Msg, /* message for second edit field */ - PRUnichar **inoutEditfield1Value, /* initial and final value for first edit field */ - PRUnichar **inoutEditfield2Value, /* initial and final value for second edit field */ - const PRUnichar *inIConURL, /* url of icon to be displayed in dialog */ - /* examples are - "chrome://global/skin/question-icon.gif" for question mark, - "chrome://global/skin/alert-icon.gif" for exclamation mark - */ - PRBool *inoutCheckboxState, /* initial and final state of check box */ - PRInt32 inNumberButtons, /* total number of buttons (0 to 4) */ - PRInt32 inNumberEditfields, /* total number of edit fields (0 to 2) */ - PRInt32 inEditField1Password, /* is first edit field a password field */ - PRInt32 *outButtonPressed) /* number of button that was pressed (0 to 3) */ -{ - nsresult rv; - NS_ASSERTION(inDialogTitle, "UniversalDialog must have a dialog title supplied"); - rv = mCommonDialogs->UniversalDialog(mDOMWindow, - inTitleMessage, - inDialogTitle, - inMsg, - inCheckboxMsg, - inButton0Text, - inButton1Text, - inButton2Text, - inButton3Text, - inEditfield1Msg, - inEditfield2Msg, - inoutEditfield1Value, - inoutEditfield2Value, - inIConURL, - inoutCheckboxState, - inNumberButtons, - inNumberEditfields, - inEditField1Password, - outButtonPressed); - return rv; -} - -//////////////////////////////////////////////////////////////////////////////// - NS_IMETHODIMP nsWebShellWindow::GetPrompter(nsIPrompt* *result) { nsresult rv; if (mPrompter == nsnull) { - nsIWebShell* tempWebShell; - GetWebShell(tempWebShell); - nsCOMPtr webShell(dont_AddRef(tempWebShell)); - nsCOMPtr domWindow; - rv = ConvertWebShellToDOMWindow(webShell, getter_AddRefs(domWindow)); - if (NS_FAILED(rv)) { - NS_ERROR("Unable to retrieve the DOM window from the new web shell."); - return rv; - } - nsCOMPtr prompt; - rv = NS_NewDOMWindowPrompter(getter_AddRefs(prompt), domWindow); - if (NS_FAILED(rv)) return rv; - // wrap the nsDOMWindowPrompter in a nsISingleSignOnPrompt: - nsCOMPtr siPrompt = do_CreateInstance(kSingleSignOnPromptCID, &rv); - if (NS_SUCCEEDED(rv)) { - // then single sign-on is installed - rv = siPrompt->SetPromptDialogs(prompt); - if (NS_FAILED(rv)) return rv; - mPrompter = siPrompt; + // get our corresponding DOMWindow + nsCOMPtr webshell; + GetWebShell(*getter_AddRefs(webshell)); + nsCOMPtr domiwindow; + rv = ConvertWebShellToDOMWindow(webshell, getter_AddRefs(domiwindow)); + nsCOMPtr domWindow(do_QueryInterface(domiwindow)); + if (!domWindow) { + NS_ERROR("Unable to retrieve the DOM window from the new web shell."); + return NS_ERROR_FAILURE; } - else { - // if single sign-on isn't installed, just use the DOM window prompter directly + + nsCOMPtr prompt; + + nsCOMPtr wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1")); + NS_ASSERTION(wwatch, "failed to get window watcher service"); + if (wwatch) + wwatch->GetNewPrompter(domWindow, getter_AddRefs(prompt)); + mPrompter = prompt; - } } *result = mPrompter; NS_ADDREF(*result); return NS_OK; } + diff --git a/xpfe/bootstrap/nsSetupRegistry.cpp b/xpfe/bootstrap/nsSetupRegistry.cpp index df29225a6eb..a3441d1d1cd 100644 --- a/xpfe/bootstrap/nsSetupRegistry.cpp +++ b/xpfe/bootstrap/nsSetupRegistry.cpp @@ -25,7 +25,6 @@ #include "nsICmdLineService.h" #include "nsIDOMXPConnectFactory.h" #include "nsAppShellCIDs.h" -#include "nsINetSupportDialogService.h" #include "nsIEditor.h" #include "nsIComponentManager.h" #include "nsIServiceManager.h" @@ -86,7 +85,6 @@ static NS_DEFINE_CID( kCommonDialogsCID, NS_CommonDialog_CID ); static NS_DEFINE_CID(kCAppShellServiceCID, NS_APPSHELL_SERVICE_CID); static NS_DEFINE_CID(kCCmdLineServiceCID, NS_COMMANDLINE_SERVICE_CID); static NS_DEFINE_CID(kXPConnectFactoryCID, NS_XPCONNECTFACTORY_CID); -static NS_DEFINE_CID(kNetSupportDialogCID, NS_NETSUPPORTDIALOG_CID); static NS_DEFINE_CID(kProtocolHelperCID, NS_PROTOCOL_HELPER_CID); static NS_DEFINE_CID(kWindowMediatorCID, NS_WINDOWMEDIATOR_CID); static NS_DEFINE_CID( kDialogParamBlockCID, NS_DialogParamBlock_CID ); diff --git a/xpfe/components/bookmarks/src/nsBookmarksService.cpp b/xpfe/components/bookmarks/src/nsBookmarksService.cpp index fb6c2fad0df..e0b8ee0a50a 100644 --- a/xpfe/components/bookmarks/src/nsBookmarksService.cpp +++ b/xpfe/components/bookmarks/src/nsBookmarksService.cpp @@ -60,8 +60,8 @@ #include "nsAppDirectoryServiceDefs.h" #include "nsISound.h" -#include "nsINetSupportDialogService.h" #include "nsIPrompt.h" +#include "nsIWindowWatcher.h" #include "nsAppShellCIDs.h" #include "nsIAppShellService.h" #include "nsIWebShell.h" @@ -142,7 +142,6 @@ static NS_DEFINE_CID(kRDFContainerCID, NS_RDFCONTAINER_CID); static NS_DEFINE_CID(kRDFContainerUtilsCID, NS_RDFCONTAINERUTILS_CID); static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID); static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CID); -static NS_DEFINE_CID(kNetSupportDialogCID, NS_NETSUPPORTDIALOG_CID); static NS_DEFINE_CID(kAppShellServiceCID, NS_APPSHELL_SERVICE_CID); static NS_DEFINE_CID(kPrefCID, NS_PREF_CID); static NS_DEFINE_IID(kSoundCID, NS_SOUND_CID); @@ -2355,7 +2354,11 @@ nsBookmarksService::OnStopRequest(nsIRequest* request, nsISupports *ctxt, if (interfaces) interfaces->GetInterface(NS_GET_IID(nsIPrompt), getter_AddRefs(prompter)); if (!prompter) - prompter = do_GetService(kNetSupportDialogCID); + { + nsCOMPtr wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1")); + if (wwatch) + wwatch->GetNewPrompter(0, getter_AddRefs(prompter)); + } if (prompter) {