зеркало из https://github.com/mozilla/pjs.git
removing use of nsNetSupportDialog. bug 72112 continued. r=hyatt,morse,mstoltz,various
This commit is contained in:
Родитель
453d6facb0
Коммит
378b2f48b9
|
@ -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<nsIWindowWatcher> 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 */
|
||||
|
|
|
@ -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<nsIWindowWatcher> wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1"));
|
||||
if (wwatch)
|
||||
wwatch->GetNewPrompter(0, getter_AddRefs(dialog));
|
||||
}
|
||||
if (!dialog) {
|
||||
*checkValue = 0;
|
||||
return PR_FALSE;
|
||||
|
|
|
@ -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<nsIWindowWatcher> 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++);
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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<nsIPrompt> dialog;
|
||||
nsCOMPtr<nsIWindowWatcher> 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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<nsIPrompt> dialog;
|
||||
nsCOMPtr<nsIWindowWatcher> 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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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<nsIWindowWatcher> 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)
|
||||
{
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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<nsIWindowWatcher> 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<nsIWindowWatcher> 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);
|
||||
|
|
|
@ -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"
|
||||
{
|
||||
|
|
|
@ -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<nsIPrompt> smtpPrompt(do_GetInterface(aNotificationCallbacks));
|
||||
if (!smtpPrompt)
|
||||
smtpPrompt = do_GetService(kNetSupportDialogCID);
|
||||
{
|
||||
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1"));
|
||||
if (wwatch)
|
||||
wwatch->GetNewPrompter(0, getter_AddRefs(smtpPrompt));
|
||||
}
|
||||
|
||||
smtpUrl->SetPrompt(smtpPrompt);
|
||||
url->RegisterListener(aUrlListener);
|
||||
}
|
||||
|
|
|
@ -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<nsIWindowWatcher> 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<nsIWindowWatcher> wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1"));
|
||||
if (wwatch)
|
||||
wwatch->GetNewPrompter(0, getter_AddRefs(dialog));
|
||||
}
|
||||
|
||||
if (aString)
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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<nsIWindowWatcher> 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<nsIWindowWatcher> 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");
|
||||
|
|
|
@ -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<nsIPref> prefs(do_GetService(kPrefServiceCID));
|
||||
nsCOMPtr<nsIPrompt> prompt(do_GetService(kNetSupportDialogCID));
|
||||
nsCOMPtr<nsIPrompt> prompt;
|
||||
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1"));
|
||||
if (wwatch)
|
||||
wwatch->GetNewPrompter(0, getter_AddRefs(prompt));
|
||||
|
||||
nsCOMPtr<nsIIOService> io(do_GetService(kIOServiceCID));
|
||||
nsCOMPtr<nsIStringBundleService> strings(do_GetService(kStringBundleServiceCID));
|
||||
nsCOMPtr<nsIStringBundle> bundle;
|
||||
|
@ -4384,7 +4386,11 @@ NS_IMETHODIMP nsPluginHostImpl::HandleBadPlugin(PRLibrary* aLibrary)
|
|||
if(mDontShowBadPluginMessage)
|
||||
return rv;
|
||||
|
||||
nsCOMPtr<nsIPrompt> prompt(do_GetService(kNetSupportDialogCID));
|
||||
nsCOMPtr<nsIPrompt> prompt;
|
||||
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1"));
|
||||
if (wwatch)
|
||||
wwatch->GetNewPrompter(0, getter_AddRefs(prompt));
|
||||
|
||||
nsCOMPtr<nsIIOService> io(do_GetService(kIOServiceCID));
|
||||
nsCOMPtr<nsIStringBundleService> strings(do_GetService(kStringBundleServiceCID));
|
||||
|
||||
|
|
|
@ -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<nsIPref> prefs(do_GetService(kPrefServiceCID));
|
||||
nsCOMPtr<nsIPrompt> prompt(do_GetService(kNetSupportDialogCID));
|
||||
nsCOMPtr<nsIPrompt> prompt;
|
||||
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1"));
|
||||
if (wwatch)
|
||||
wwatch->GetNewPrompter(0, getter_AddRefs(prompt));
|
||||
|
||||
nsCOMPtr<nsIIOService> io(do_GetService(kIOServiceCID));
|
||||
nsCOMPtr<nsIStringBundleService> strings(do_GetService(kStringBundleServiceCID));
|
||||
nsCOMPtr<nsIStringBundle> bundle;
|
||||
|
@ -4384,7 +4386,11 @@ NS_IMETHODIMP nsPluginHostImpl::HandleBadPlugin(PRLibrary* aLibrary)
|
|||
if(mDontShowBadPluginMessage)
|
||||
return rv;
|
||||
|
||||
nsCOMPtr<nsIPrompt> prompt(do_GetService(kNetSupportDialogCID));
|
||||
nsCOMPtr<nsIPrompt> prompt;
|
||||
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1"));
|
||||
if (wwatch)
|
||||
wwatch->GetNewPrompter(0, getter_AddRefs(prompt));
|
||||
|
||||
nsCOMPtr<nsIIOService> io(do_GetService(kIOServiceCID));
|
||||
nsCOMPtr<nsIStringBundleService> strings(do_GetService(kStringBundleServiceCID));
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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<nsIDOMWindowInternal> mDOMWindow;
|
||||
nsCOMPtr<nsICommonDialogs> 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<nsIStringBundleService> stringService = do_GetService(kStringBundleServiceCID);
|
||||
nsCOMPtr<nsIStringBundle> 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<nsIWebShell> webShell(dont_AddRef(tempWebShell));
|
||||
nsCOMPtr<nsIDOMWindowInternal> 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<nsIPrompt> prompt;
|
||||
rv = NS_NewDOMWindowPrompter(getter_AddRefs(prompt), domWindow);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// wrap the nsDOMWindowPrompter in a nsISingleSignOnPrompt:
|
||||
nsCOMPtr<nsISingleSignOnPrompt> 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<nsIWebShell> webshell;
|
||||
GetWebShell(*getter_AddRefs(webshell));
|
||||
nsCOMPtr<nsIDOMWindowInternal> domiwindow;
|
||||
rv = ConvertWebShellToDOMWindow(webshell, getter_AddRefs(domiwindow));
|
||||
nsCOMPtr<nsIDOMWindow> 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<nsIPrompt> prompt;
|
||||
|
||||
nsCOMPtr<nsIWindowWatcher> 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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<nsIWindowWatcher> wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1"));
|
||||
if (wwatch)
|
||||
wwatch->GetNewPrompter(0, getter_AddRefs(prompter));
|
||||
}
|
||||
|
||||
if (prompter)
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче