diff --git a/mozilla/editor/base/Makefile.in b/mozilla/editor/base/Makefile.in index 62f654eadc2..7f4cb7e36b1 100644 --- a/mozilla/editor/base/Makefile.in +++ b/mozilla/editor/base/Makefile.in @@ -29,7 +29,7 @@ include $(DEPTH)/config/autoconf.mk MODULE = editor LIBRARY_NAME = editor IS_COMPONENT = 1 -REQUIRES = xpcom string dom js locale layout uriloader widget txmgr htmlparser necko pref view appshell rdf webshell timer txtsvc intl lwbrk docshell chrome caps appcomps xuldoc gfx2 mozcomps +REQUIRES = xpcom string dom js locale layout uriloader widget txmgr htmlparser necko pref view appshell rdf webshell timer txtsvc intl lwbrk docshell chrome caps appcomps xuldoc gfx2 mozcomps windowwatcher CPPSRCS = \ ChangeAttributeTxn.cpp \ diff --git a/mozilla/editor/base/nsEditorShell.cpp b/mozilla/editor/base/nsEditorShell.cpp index b91e0a1f716..a6396395126 100644 --- a/mozilla/editor/base/nsEditorShell.cpp +++ b/mozilla/editor/base/nsEditorShell.cpp @@ -80,7 +80,9 @@ #include "nsIFilePicker.h" #include "nsIFindComponent.h" #include "nsIPrompt.h" -#include "nsICommonDialogs.h" +#include "nsIDialogParamBlock.h" +#include "nsIPromptService.h" +#include "nsPIPromptService.h" #include "nsIEditorController.h" //#include "nsEditorController.h" @@ -138,8 +140,6 @@ static NS_DEFINE_CID(kHTMLEditorCID, NS_HTMLEDITOR_CID); static NS_DEFINE_CID(kCTextServicesDocumentCID, NS_TEXTSERVICESDOCUMENT_CID); static NS_DEFINE_CID(kCStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID); -static NS_DEFINE_CID(kCommonDialogsCID, NS_CommonDialog_CID ); -static NS_DEFINE_CID(kDialogParamBlockCID, NS_DialogParamBlock_CID); static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID); static NS_DEFINE_CID(kChromeRegistryCID, NS_CHROMEREGISTRY_CID); static NS_DEFINE_CID(kStandardURLCID, NS_STANDARDURL_CID); @@ -1740,8 +1740,8 @@ nsEditorShell::SaveDocument(PRBool aSaveAs, PRBool aSaveCopy, const PRUnichar* a if (!mMailCompose && (!saveAsText && mEditorType == eHTMLTextEditorType) && (title.Length() == 0)) { // Use a "prompt" common dialog to get title string from user - NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &res); - if (NS_SUCCEEDED(res)) + nsCOMPtr dialog(do_GetService("@mozilla.org/embedcomp/prompt-service;1")); + if (dialog) { PRUnichar *titleUnicode; nsAutoString captionStr, msgStr1, msgStr2; @@ -1755,11 +1755,11 @@ nsEditorShell::SaveDocument(PRBool aSaveAs, PRBool aSaveCopy, const PRUnichar* a PRBool retVal = PR_FALSE; if(!mContentWindow) return NS_ERROR_NOT_INITIALIZED; - nsCOMPtr cwP = do_QueryReferent(mContentWindow); + nsCOMPtr cwP = do_QueryReferent(mContentWindow); if (!cwP) return NS_ERROR_NOT_INITIALIZED; res = dialog->Prompt(cwP, captionStr.GetUnicode(), msgStr1.GetUnicode(), - title.GetUnicode(), &titleUnicode, &retVal); + title.GetUnicode(), 0, 0, &titleUnicode, &retVal); if( retVal == PR_FALSE) { @@ -2827,17 +2827,17 @@ nsEditorShell::ConfirmWithCancel(const nsString& aTitle, const nsString& aQuesti const nsString *aYesString, const nsString *aNoString) { nsEditorShell::EConfirmResult result = nsEditorShell::eCancel; - + nsIDialogParamBlock* block = NULL; - nsresult rv = nsComponentManager::CreateInstance(kDialogParamBlockCID, 0, - NS_GET_IID(nsIDialogParamBlock), + nsresult rv = nsComponentManager::CreateInstance("@mozilla.org/embedcomp/dialogparam;1", + 0, NS_GET_IID(nsIDialogParamBlock), (void**)&block ); if ( NS_SUCCEEDED(rv) ) { // Stuff in Parameters - block->SetString( nsICommonDialogs::eMsg, aQuestion.GetUnicode()); + block->SetString( nsIPromptService::eMsg, aQuestion.GetUnicode()); nsAutoString url; url.AssignWithConversion( "chrome://global/skin/question-icon.gif" ); - block->SetString( nsICommonDialogs::eIconURL, url.GetUnicode()); + block->SetString( nsIPromptService::eIconURL, url.GetUnicode()); nsAutoString yesStr, noStr; // Default is Yes, No, Cancel @@ -2851,34 +2851,34 @@ nsEditorShell::ConfirmWithCancel(const nsString& aTitle, const nsString& aQuesti if (aNoString && aNoString->Length() > 0) { noStr.Assign(*aNoString); - block->SetString( nsICommonDialogs::eButton2Text, noStr.GetUnicode() ); + block->SetString( nsIPromptService::eButton2Text, noStr.GetUnicode() ); } else { // No string for "No" means we only want Yes, Cancel numberOfButtons = 2; } - block->SetInt( nsICommonDialogs::eNumberButtons, numberOfButtons ); + block->SetInt( nsIPromptService::eNumberButtons, numberOfButtons ); nsAutoString cancelStr; GetBundleString(NS_LITERAL_STRING("Cancel"), cancelStr); - block->SetString( nsICommonDialogs::eDialogTitle, aTitle.GetUnicode() ); + block->SetString( nsIPromptService::eDialogTitle, aTitle.GetUnicode() ); //Note: "button0" is always Ok or Yes action, "button1" is Cancel - block->SetString( nsICommonDialogs::eButton0Text, yesStr.GetUnicode() ); - block->SetString( nsICommonDialogs::eButton1Text, cancelStr.GetUnicode() ); + block->SetString( nsIPromptService::eButton0Text, yesStr.GetUnicode() ); + block->SetString( nsIPromptService::eButton1Text, cancelStr.GetUnicode() ); - NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &rv); - if ( NS_SUCCEEDED( rv ) ) + nsCOMPtr dialog(do_GetService("@mozilla.org/embedcomp/prompt-service;1")); + if (dialog) { PRInt32 buttonPressed = 0; if(!mContentWindow) return result; - nsCOMPtr cwP = do_QueryReferent(mContentWindow); + nsCOMPtr cwP = do_QueryReferent(mContentWindow); if (!cwP) return result; rv = dialog->DoDialog( cwP, block, "chrome://global/content/commonDialog.xul" ); - block->GetInt( nsICommonDialogs::eButtonPressed, &buttonPressed ); - // NOTE: If order of buttons changes in nsICommonDialogs, + block->GetInt( nsIPromptService::eButtonPressed, &buttonPressed ); + // NOTE: If order of buttons changes in nsIPromptService, // then we must change the EConfirmResult enums in nsEditorShell.h result = nsEditorShell::EConfirmResult(buttonPressed); } @@ -2894,12 +2894,12 @@ nsEditorShell::Confirm(const nsString& aTitle, const nsString& aQuestion) nsresult rv; PRBool result = PR_FALSE; - NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &rv); - if (NS_SUCCEEDED(rv) && dialog) + nsCOMPtr dialog(do_GetService("@mozilla.org/embedcomp/prompt-service;1")); + if (dialog) { if(!mContentWindow) return NS_ERROR_NOT_INITIALIZED; - nsCOMPtr cwP = do_QueryReferent(mContentWindow); + nsCOMPtr cwP = do_QueryReferent(mContentWindow); if (!cwP) return NS_ERROR_NOT_INITIALIZED; rv = dialog->Confirm(cwP, aTitle.GetUnicode(), aQuestion.GetUnicode(), &result); } @@ -2913,12 +2913,12 @@ nsEditorShell::AlertWithTitle(const PRUnichar *aTitle, const PRUnichar *aMsg) return NS_ERROR_NULL_POINTER; nsresult rv = NS_ERROR_FAILURE; - NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &rv); - if (NS_SUCCEEDED(rv) && dialog) + nsCOMPtr dialog(do_GetService("@mozilla.org/embedcomp/prompt-service;1")); + if (dialog) { if(!mContentWindow) return NS_ERROR_NOT_INITIALIZED; - nsCOMPtr cwP = do_QueryReferent(mContentWindow); + nsCOMPtr cwP = do_QueryReferent(mContentWindow); if (!cwP) return NS_ERROR_NOT_INITIALIZED; rv = dialog->Alert(cwP, aTitle, aMsg); } @@ -2930,12 +2930,12 @@ void nsEditorShell::Alert(const nsString& aTitle, const nsString& aMsg) { nsresult rv; - NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &rv); - if (NS_SUCCEEDED(rv) && dialog) + nsCOMPtr dialog(do_GetService("@mozilla.org/embedcomp/prompt-service;1")); + if (dialog) { if(!mContentWindow) return; - nsCOMPtr cwP = do_QueryReferent(mContentWindow); + nsCOMPtr cwP = do_QueryReferent(mContentWindow); if (!cwP) return; rv = dialog->Alert(cwP, aTitle.GetUnicode(), aMsg.GetUnicode()); } diff --git a/mozilla/editor/composer/src/nsEditorShell.cpp b/mozilla/editor/composer/src/nsEditorShell.cpp index b91e0a1f716..a6396395126 100644 --- a/mozilla/editor/composer/src/nsEditorShell.cpp +++ b/mozilla/editor/composer/src/nsEditorShell.cpp @@ -80,7 +80,9 @@ #include "nsIFilePicker.h" #include "nsIFindComponent.h" #include "nsIPrompt.h" -#include "nsICommonDialogs.h" +#include "nsIDialogParamBlock.h" +#include "nsIPromptService.h" +#include "nsPIPromptService.h" #include "nsIEditorController.h" //#include "nsEditorController.h" @@ -138,8 +140,6 @@ static NS_DEFINE_CID(kHTMLEditorCID, NS_HTMLEDITOR_CID); static NS_DEFINE_CID(kCTextServicesDocumentCID, NS_TEXTSERVICESDOCUMENT_CID); static NS_DEFINE_CID(kCStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID); -static NS_DEFINE_CID(kCommonDialogsCID, NS_CommonDialog_CID ); -static NS_DEFINE_CID(kDialogParamBlockCID, NS_DialogParamBlock_CID); static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID); static NS_DEFINE_CID(kChromeRegistryCID, NS_CHROMEREGISTRY_CID); static NS_DEFINE_CID(kStandardURLCID, NS_STANDARDURL_CID); @@ -1740,8 +1740,8 @@ nsEditorShell::SaveDocument(PRBool aSaveAs, PRBool aSaveCopy, const PRUnichar* a if (!mMailCompose && (!saveAsText && mEditorType == eHTMLTextEditorType) && (title.Length() == 0)) { // Use a "prompt" common dialog to get title string from user - NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &res); - if (NS_SUCCEEDED(res)) + nsCOMPtr dialog(do_GetService("@mozilla.org/embedcomp/prompt-service;1")); + if (dialog) { PRUnichar *titleUnicode; nsAutoString captionStr, msgStr1, msgStr2; @@ -1755,11 +1755,11 @@ nsEditorShell::SaveDocument(PRBool aSaveAs, PRBool aSaveCopy, const PRUnichar* a PRBool retVal = PR_FALSE; if(!mContentWindow) return NS_ERROR_NOT_INITIALIZED; - nsCOMPtr cwP = do_QueryReferent(mContentWindow); + nsCOMPtr cwP = do_QueryReferent(mContentWindow); if (!cwP) return NS_ERROR_NOT_INITIALIZED; res = dialog->Prompt(cwP, captionStr.GetUnicode(), msgStr1.GetUnicode(), - title.GetUnicode(), &titleUnicode, &retVal); + title.GetUnicode(), 0, 0, &titleUnicode, &retVal); if( retVal == PR_FALSE) { @@ -2827,17 +2827,17 @@ nsEditorShell::ConfirmWithCancel(const nsString& aTitle, const nsString& aQuesti const nsString *aYesString, const nsString *aNoString) { nsEditorShell::EConfirmResult result = nsEditorShell::eCancel; - + nsIDialogParamBlock* block = NULL; - nsresult rv = nsComponentManager::CreateInstance(kDialogParamBlockCID, 0, - NS_GET_IID(nsIDialogParamBlock), + nsresult rv = nsComponentManager::CreateInstance("@mozilla.org/embedcomp/dialogparam;1", + 0, NS_GET_IID(nsIDialogParamBlock), (void**)&block ); if ( NS_SUCCEEDED(rv) ) { // Stuff in Parameters - block->SetString( nsICommonDialogs::eMsg, aQuestion.GetUnicode()); + block->SetString( nsIPromptService::eMsg, aQuestion.GetUnicode()); nsAutoString url; url.AssignWithConversion( "chrome://global/skin/question-icon.gif" ); - block->SetString( nsICommonDialogs::eIconURL, url.GetUnicode()); + block->SetString( nsIPromptService::eIconURL, url.GetUnicode()); nsAutoString yesStr, noStr; // Default is Yes, No, Cancel @@ -2851,34 +2851,34 @@ nsEditorShell::ConfirmWithCancel(const nsString& aTitle, const nsString& aQuesti if (aNoString && aNoString->Length() > 0) { noStr.Assign(*aNoString); - block->SetString( nsICommonDialogs::eButton2Text, noStr.GetUnicode() ); + block->SetString( nsIPromptService::eButton2Text, noStr.GetUnicode() ); } else { // No string for "No" means we only want Yes, Cancel numberOfButtons = 2; } - block->SetInt( nsICommonDialogs::eNumberButtons, numberOfButtons ); + block->SetInt( nsIPromptService::eNumberButtons, numberOfButtons ); nsAutoString cancelStr; GetBundleString(NS_LITERAL_STRING("Cancel"), cancelStr); - block->SetString( nsICommonDialogs::eDialogTitle, aTitle.GetUnicode() ); + block->SetString( nsIPromptService::eDialogTitle, aTitle.GetUnicode() ); //Note: "button0" is always Ok or Yes action, "button1" is Cancel - block->SetString( nsICommonDialogs::eButton0Text, yesStr.GetUnicode() ); - block->SetString( nsICommonDialogs::eButton1Text, cancelStr.GetUnicode() ); + block->SetString( nsIPromptService::eButton0Text, yesStr.GetUnicode() ); + block->SetString( nsIPromptService::eButton1Text, cancelStr.GetUnicode() ); - NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &rv); - if ( NS_SUCCEEDED( rv ) ) + nsCOMPtr dialog(do_GetService("@mozilla.org/embedcomp/prompt-service;1")); + if (dialog) { PRInt32 buttonPressed = 0; if(!mContentWindow) return result; - nsCOMPtr cwP = do_QueryReferent(mContentWindow); + nsCOMPtr cwP = do_QueryReferent(mContentWindow); if (!cwP) return result; rv = dialog->DoDialog( cwP, block, "chrome://global/content/commonDialog.xul" ); - block->GetInt( nsICommonDialogs::eButtonPressed, &buttonPressed ); - // NOTE: If order of buttons changes in nsICommonDialogs, + block->GetInt( nsIPromptService::eButtonPressed, &buttonPressed ); + // NOTE: If order of buttons changes in nsIPromptService, // then we must change the EConfirmResult enums in nsEditorShell.h result = nsEditorShell::EConfirmResult(buttonPressed); } @@ -2894,12 +2894,12 @@ nsEditorShell::Confirm(const nsString& aTitle, const nsString& aQuestion) nsresult rv; PRBool result = PR_FALSE; - NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &rv); - if (NS_SUCCEEDED(rv) && dialog) + nsCOMPtr dialog(do_GetService("@mozilla.org/embedcomp/prompt-service;1")); + if (dialog) { if(!mContentWindow) return NS_ERROR_NOT_INITIALIZED; - nsCOMPtr cwP = do_QueryReferent(mContentWindow); + nsCOMPtr cwP = do_QueryReferent(mContentWindow); if (!cwP) return NS_ERROR_NOT_INITIALIZED; rv = dialog->Confirm(cwP, aTitle.GetUnicode(), aQuestion.GetUnicode(), &result); } @@ -2913,12 +2913,12 @@ nsEditorShell::AlertWithTitle(const PRUnichar *aTitle, const PRUnichar *aMsg) return NS_ERROR_NULL_POINTER; nsresult rv = NS_ERROR_FAILURE; - NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &rv); - if (NS_SUCCEEDED(rv) && dialog) + nsCOMPtr dialog(do_GetService("@mozilla.org/embedcomp/prompt-service;1")); + if (dialog) { if(!mContentWindow) return NS_ERROR_NOT_INITIALIZED; - nsCOMPtr cwP = do_QueryReferent(mContentWindow); + nsCOMPtr cwP = do_QueryReferent(mContentWindow); if (!cwP) return NS_ERROR_NOT_INITIALIZED; rv = dialog->Alert(cwP, aTitle, aMsg); } @@ -2930,12 +2930,12 @@ void nsEditorShell::Alert(const nsString& aTitle, const nsString& aMsg) { nsresult rv; - NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &rv); - if (NS_SUCCEEDED(rv) && dialog) + nsCOMPtr dialog(do_GetService("@mozilla.org/embedcomp/prompt-service;1")); + if (dialog) { if(!mContentWindow) return; - nsCOMPtr cwP = do_QueryReferent(mContentWindow); + nsCOMPtr cwP = do_QueryReferent(mContentWindow); if (!cwP) return; rv = dialog->Alert(cwP, aTitle.GetUnicode(), aMsg.GetUnicode()); } diff --git a/mozilla/extensions/p3p/src/Makefile.in b/mozilla/extensions/p3p/src/Makefile.in index d946ff71f59..00608827b5e 100644 --- a/mozilla/extensions/p3p/src/Makefile.in +++ b/mozilla/extensions/p3p/src/Makefile.in @@ -30,7 +30,7 @@ MODULE = p3p LIBRARY_NAME = p3p IS_COMPONENT = 1 -REQUIRES = p3p xpcom +REQUIRES = p3p xpcom windowwatcher CPPSRCS = \ nsP3PModule.cpp \ diff --git a/mozilla/extensions/p3p/src/nsP3PUI.cpp b/mozilla/extensions/p3p/src/nsP3PUI.cpp index ed355efb781..2094a03ffd1 100644 --- a/mozilla/extensions/p3p/src/nsP3PUI.cpp +++ b/mozilla/extensions/p3p/src/nsP3PUI.cpp @@ -47,13 +47,10 @@ #include #include #include -#include #include -static NS_DEFINE_CID(kCommonDialogsCID, NS_CommonDialog_CID ); - NS_IMPL_ISUPPORTS4( nsP3PUI, nsIP3PUI, nsIP3PCUI, nsIWebProgressListener, diff --git a/mozilla/extensions/p3p/src/nsP3PUIService.cpp b/mozilla/extensions/p3p/src/nsP3PUIService.cpp index 1779b8b867c..13a8ecddb76 100644 --- a/mozilla/extensions/p3p/src/nsP3PUIService.cpp +++ b/mozilla/extensions/p3p/src/nsP3PUIService.cpp @@ -31,14 +31,14 @@ #include #include #include -#include +#include +#include // **************************************************************************** // nsP3PUIService Implementation routines // **************************************************************************** static NS_DEFINE_CID( kNameSpaceManagerCID, NS_NAMESPACEMANAGER_CID ); -static NS_DEFINE_CID( kCommonDialogsCID, NS_CommonDialog_CID ); // P3P UI Service generic factory constructor NS_GENERIC_FACTORY_CONSTRUCTOR_INIT( nsP3PUIService, Init ); @@ -369,8 +369,8 @@ nsP3PUIService::WarningNotPrivate(nsIDOMWindowInternal * aDOMWindowInternal) mPrefServ->GetBoolPref( P3P_PREF_WARNINGNOTPRIVATE, &bWarnPref ); if (bWarnPref) { - NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &rv); - if (NS_SUCCEEDED(rv)) { + nsCOMPtr dialog(do_GetService("@mozilla.org/embedcomp/prompt-service;1")); + if (dialog) { nsAutoString windowTitle, message, showAgain; @@ -378,8 +378,9 @@ nsP3PUIService::WarningNotPrivate(nsIDOMWindowInternal * aDOMWindowInternal) mP3PService->GetLocaleString( "WarningNotPrivate", message ); mP3PService->GetLocaleString( "ShowAgain", showAgain ); + nsCOMPtr parent(do_QueryInterface(aDOMWindowInternal)); PRBool outCheckValue = PR_TRUE; - dialog->AlertCheck( aDOMWindowInternal, + dialog->AlertCheck( parent, windowTitle.GetUnicode(), message.GetUnicode(), showAgain.GetUnicode(), @@ -421,8 +422,8 @@ nsP3PUIService::WarningPartialPrivacy(nsIDOMWindowInternal * aDOMWindowInternal) mPrefServ->GetBoolPref( P3P_PREF_WARNINGPARTIALPRIVACY, &bWarnPref ); if (bWarnPref) { - NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &rv); - if (NS_SUCCEEDED(rv)) { + nsCOMPtr dialog(do_GetService("@mozilla.org/embedcomp/prompt-service;1")); + if (dialog) { nsAutoString windowTitle, message, showAgain; @@ -431,7 +432,8 @@ nsP3PUIService::WarningPartialPrivacy(nsIDOMWindowInternal * aDOMWindowInternal) mP3PService->GetLocaleString( "ShowAgain", showAgain ); PRBool outCheckValue = PR_TRUE; - dialog->AlertCheck( aDOMWindowInternal, + nsCOMPtr parent(do_QueryInterface(aDOMWindowInternal)); + dialog->AlertCheck( parent, windowTitle.GetUnicode(), message.GetUnicode(), showAgain.GetUnicode(), @@ -459,8 +461,8 @@ nsP3PUIService::WarningPostToNotPrivate(nsIDOMWindowInternal * aDOMWindowInterna mPrefServ->GetBoolPref( P3P_PREF_WARNINGPOSTTONOTPRIVATE, &bWarnPref ); if (bWarnPref) { - NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &rv); - if (NS_SUCCEEDED(rv)) { + nsCOMPtr dialog(do_GetService("@mozilla.org/embedcomp/prompt-service;1")); + if (dialog) { nsAutoString windowTitle, message, showAgain; @@ -469,6 +471,7 @@ nsP3PUIService::WarningPostToNotPrivate(nsIDOMWindowInternal * aDOMWindowInterna mP3PService->GetLocaleString( "ShowAgain", showAgain ); PRBool outCheckValue = PR_TRUE; + nsCOMPtr parent(do_QueryInterface(aDOMWindowInternal)); dialog->ConfirmCheck( aDOMWindowInternal, windowTitle.GetUnicode(), message.GetUnicode(), @@ -498,8 +501,8 @@ nsP3PUIService::WarningPostToBrokenPolicy(nsIDOMWindowInternal * aDOMWindowInter mPrefServ->GetBoolPref( P3P_PREF_WARNINGPOSTTOBROKENPOLICY, &bWarn2Pref ); if (bWarn2Pref) { - NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &rv); - if (NS_SUCCEEDED(rv)) { + nsCOMPtr dialog(do_GetService("@mozilla.org/embedcomp/prompt-service;1")); + if (dialog) { nsAutoString windowTitle, message, showAgain; @@ -508,6 +511,7 @@ nsP3PUIService::WarningPostToBrokenPolicy(nsIDOMWindowInternal * aDOMWindowInter mP3PService->GetLocaleString( "ShowAgain", showAgain ); PRBool outCheckValue = PR_TRUE; + nsCOMPtr parent(do_QueryInterface(aDOMWindowInternal)); dialog->ConfirmCheck( aDOMWindowInternal, windowTitle.GetUnicode(), message.GetUnicode(), @@ -537,8 +541,8 @@ nsP3PUIService::WarningPostToNoPolicy(nsIDOMWindowInternal * aDOMWindowInternal, mPrefServ->GetBoolPref( P3P_PREF_WARNINGPOSTTONOPOLICY, &bWarn3Pref ); if (bWarn3Pref) { - NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &rv); - if (NS_SUCCEEDED(rv)) { + nsCOMPtr dialog(do_GetService("@mozilla.org/embedcomp/prompt-service;1")); + if (dialog) { nsAutoString windowTitle, message, showAgain; @@ -547,7 +551,8 @@ nsP3PUIService::WarningPostToNoPolicy(nsIDOMWindowInternal * aDOMWindowInternal, mP3PService->GetLocaleString( "ShowAgain", showAgain ); PRBool outCheckValue = PR_TRUE; - dialog->ConfirmCheck( aDOMWindowInternal, + nsCOMPtr parent(do_QueryInterface(aDOMWindowInternal)); + dialog->ConfirmCheck( parent, windowTitle.GetUnicode(), message.GetUnicode(), showAgain.GetUnicode(), diff --git a/mozilla/extensions/psm-glue/src/nsSecureBrowserUIImpl.cpp b/mozilla/extensions/psm-glue/src/nsSecureBrowserUIImpl.cpp index 9d90e3256f1..f4d5f5be0c7 100644 --- a/mozilla/extensions/psm-glue/src/nsSecureBrowserUIImpl.cpp +++ b/mozilla/extensions/psm-glue/src/nsSecureBrowserUIImpl.cpp @@ -58,7 +58,6 @@ #include "nsISecurityEventSink.h" #include "nsIPrompt.h" -#include "nsICommonDialogs.h" #include "nsIPref.h" #include "nsIFormSubmitObserver.h" @@ -68,7 +67,6 @@ #include "nsSSLIOLayer.h" static NS_DEFINE_CID(kCStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID); -static NS_DEFINE_CID(kCommonDialogsCID, NS_CommonDialog_CID ); static NS_DEFINE_CID(kPrefCID, NS_PREF_CID); #define ENTER_SITE_PREF "security.warn_entering_secure" diff --git a/mozilla/profile/pref-migrator/src/Makefile.in b/mozilla/profile/pref-migrator/src/Makefile.in index d2bcd707d6b..ad46fa34a2b 100644 --- a/mozilla/profile/pref-migrator/src/Makefile.in +++ b/mozilla/profile/pref-migrator/src/Makefile.in @@ -29,7 +29,7 @@ include $(DEPTH)/config/autoconf.mk MODULE = prefmigr LIBRARY_NAME = nsprefm IS_COMPONENT = 1 -REQUIRES = xpcom string pref appshell intl docshell dom necko rdf js layout locale uriloader widget webbrwsr uconv gfx2 mozcomps +REQUIRES = xpcom string pref appshell intl docshell dom necko rdf js layout locale uriloader widget webbrwsr uconv gfx2 mozcomps windowwatcher CPPSRCS = \ nsPrefMigration.cpp \ diff --git a/mozilla/profile/pref-migrator/src/nsPrefMigration.cpp b/mozilla/profile/pref-migrator/src/nsPrefMigration.cpp index 820a53562a3..16204cad8c3 100644 --- a/mozilla/profile/pref-migrator/src/nsPrefMigration.cpp +++ b/mozilla/profile/pref-migrator/src/nsPrefMigration.cpp @@ -27,9 +27,9 @@ #include "nsRepository.h" #include "nsIAppShellComponentImpl.h" #include "nsIComponentManager.h" +#include "nsIDialogParamBlock.h" #include "nsIServiceManager.h" #include "nsIWindowMediator.h" -#include "nsICommonDialogs.h" #include "nsIScriptGlobalObject.h" #include "nsSpecialSystemDirectory.h" #include "nsFileStream.h" @@ -227,8 +227,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(kWindowMediatorCID, NS_WINDOWMEDIATOR_CID); -static NS_DEFINE_CID(kCommonDialogsCID, NS_CommonDialog_CID); -static NS_DEFINE_CID(kDialogParamBlockCID, NS_DialogParamBlock_CID); static NS_DEFINE_CID(kFileLocatorCID, NS_FILELOCATOR_CID); static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CID); @@ -489,7 +487,7 @@ nsPrefMigration::ShowSpaceDialog(PRInt32 *choice) // list to the dialog //----------------------------------------------------- nsCOMPtr ioParamBlock; - rv = nsComponentManager::CreateInstance(kDialogParamBlockCID, + rv = nsComponentManager::CreateInstance("@mozilla.org/embedcomp/dialogparam;1", nsnull, NS_GET_IID(nsIDialogParamBlock), getter_AddRefs(ioParamBlock)); diff --git a/mozilla/profile/pref-migrator/src/nsPrefMigration.h b/mozilla/profile/pref-migrator/src/nsPrefMigration.h index 198719c9ed3..2bbafb8dde1 100644 --- a/mozilla/profile/pref-migrator/src/nsPrefMigration.h +++ b/mozilla/profile/pref-migrator/src/nsPrefMigration.h @@ -30,7 +30,6 @@ #include "nsFileSpec.h" #include "nsIPref.h" #include "nsIServiceManager.h" -#include "nsICommonDialogs.h" #include "nsCOMPtr.h" #include "nsIDOMWindowInternal.h" #include "nsIFileSpec.h" diff --git a/mozilla/profile/src/nsProfile.cpp b/mozilla/profile/src/nsProfile.cpp index b7e37010f88..d3444c8c2d1 100644 --- a/mozilla/profile/src/nsProfile.cpp +++ b/mozilla/profile/src/nsProfile.cpp @@ -71,7 +71,7 @@ #include "nsIScriptGlobalObject.h" #include "nsIBaseWindow.h" -#include "nsICommonDialogs.h" +#include "nsIDialogParamBlock.h" #include "nsIDOMWindowInternal.h" #include "nsIWindowMediator.h" @@ -114,10 +114,8 @@ // we want everyone to have the debugging info to the console for now // to help track down profile manager problems // when we ship, we'll turn this off -#define DEBUG_profile 1 #undef DEBUG_profile_verbose #ifdef DEBUG_seth -#define DEBUG_profile_verbose 1 #endif // ProfileAccess varaible (gProfileDataAccess) to access registry operations @@ -159,7 +157,6 @@ static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID); static NS_DEFINE_CID(kPrefMigrationCID, NS_PREFMIGRATION_CID); static NS_DEFINE_CID(kPrefConverterCID, NS_PREFCONVERTER_CID); static NS_DEFINE_IID(kCookieServiceCID, NS_COOKIESERVICE_CID); -static NS_DEFINE_CID(kDialogParamBlockCID, NS_DialogParamBlock_CID); static NS_DEFINE_CID(kWindowMediatorCID, NS_WINDOWMEDIATOR_CID); static NS_DEFINE_CID(kChromeRegistryCID, NS_CHROMEREGISTRY_CID); @@ -2007,7 +2004,7 @@ nsProfile::ShowProfileWizard(void) // list to the dialog //----------------------------------------------------- nsCOMPtr ioParamBlock; - rv = nsComponentManager::CreateInstance(kDialogParamBlockCID, + rv = nsComponentManager::CreateInstance("@mozilla.org/embedcomp/dialogparam;1", nsnull, NS_GET_IID(nsIDialogParamBlock), getter_AddRefs(ioParamBlock)); diff --git a/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp b/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp index d95dda448c7..f94cbf0ed24 100644 --- a/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp +++ b/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp @@ -150,9 +150,7 @@ static NS_DEFINE_CID(kXULPopupListenerCID, NS_XULPOPUPLISTENER_CID); #ifdef DEBUG_rods #define DEBUG_MENUSDEL 1 #endif -#include "nsICommonDialogs.h" -static NS_DEFINE_CID( kCommonDialogsCID, NS_CommonDialog_CID ); #include "nsIWebShell.h" static NS_DEFINE_CID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID); diff --git a/mozilla/xpfe/bootstrap/nsSetupRegistry.cpp b/mozilla/xpfe/bootstrap/nsSetupRegistry.cpp index a3441d1d1cd..3efa6789a7e 100644 --- a/mozilla/xpfe/bootstrap/nsSetupRegistry.cpp +++ b/mozilla/xpfe/bootstrap/nsSetupRegistry.cpp @@ -34,11 +34,9 @@ #include "rdf.h" #include "nsIWindowMediator.h" -#include "nsICommonDialogs.h" -#include "nsIDialogParamBlock.h" // #include "nsAbout.h" #include "nsIAboutModule.h" -static NS_DEFINE_CID( kCommonDialogsCID, NS_CommonDialog_CID ); + #ifdef XP_OS2 #define WIDGET_DLL "WDGTOS2" @@ -87,7 +85,6 @@ static NS_DEFINE_CID(kCCmdLineServiceCID, NS_COMMANDLINE_SERVICE_CID); static NS_DEFINE_CID(kXPConnectFactoryCID, NS_XPCONNECTFACTORY_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 ); #define NS_ABOUT_CID \ { /* {1f1ce501-663a-11d3-b7a0-be426e4e69bc} */ \ 0x1f1ce501, 0x663a, 0x11d3, { 0xb7, 0xa0, 0xbe, 0x42, 0x6e, 0x4e, 0x69, 0xbc } \ diff --git a/mozilla/xpfe/components/winhooks/nsWindowsHooks.cpp b/mozilla/xpfe/components/winhooks/nsWindowsHooks.cpp index fc83e0e4e52..61ab8752610 100644 --- a/mozilla/xpfe/components/winhooks/nsWindowsHooks.cpp +++ b/mozilla/xpfe/components/winhooks/nsWindowsHooks.cpp @@ -27,7 +27,7 @@ #include "nsWindowsHooksUtil.cpp" #include "nsIDOMWindowInternal.h" #include "nsIServiceManager.h" -#include "nsICommonDialogs.h" +#include "nsIPromptService.h" #include "nsIStringBundle.h" #include "nsIAllocator.h" #include "nsICmdLineService.h" @@ -273,12 +273,11 @@ nsWindowsHooks::CheckSettings( nsIDOMWindowInternal *aParent ) { // o We need the common dialog service to show the dialog. // o We need the string bundle service to fetch the appropriate // dialog text. - nsCID commonDlgCID = NS_CommonDialog_CID; nsCID bundleCID = NS_STRINGBUNDLESERVICE_CID; - nsCOMPtr commonDlgService( do_GetService( commonDlgCID, &rv ) ); + nsCOMPtr promptService( do_GetService("@mozilla.org/embedcomp/prompt-service;1")); nsCOMPtr bundleService( do_GetService( bundleCID, &rv ) ); - if ( commonDlgService && bundleService ) { + if ( promptService && bundleService ) { // Next, get bundle that provides text for dialog. nsILocale *locale = 0; nsIStringBundle *bundle; @@ -326,7 +325,7 @@ nsWindowsHooks::CheckSettings( nsIDOMWindowInternal *aParent ) { // o Cancel // o No // because UniversalDialog will move "Cancel" to the right. - rv = commonDlgService->UniversalDialog( aParent, + rv = promptService->UniversalDialog( aParent, 0, // title title, // dlg title text, // dlg text diff --git a/mozilla/xpinstall/src/Makefile.in b/mozilla/xpinstall/src/Makefile.in index 2de1657b82f..7d789e91043 100644 --- a/mozilla/xpinstall/src/Makefile.in +++ b/mozilla/xpinstall/src/Makefile.in @@ -33,7 +33,7 @@ MODULE = xpinstall LIBRARY_NAME = xpinstall SHORT_LIBNAME = xpinstal IS_COMPONENT = 1 -REQUIRES = xpcom string jar chrome necko intl locale libreg js pref appshell widget layout uriloader xpconnect docshell dom gfx2 mozcomps +REQUIRES = xpcom string jar chrome necko intl locale libreg js pref appshell widget layout uriloader xpconnect docshell dom gfx2 mozcomps windowwatcher # XXX shouldn't need to export this EXPORTS = nsXPITriggerInfo.h diff --git a/mozilla/xpinstall/src/nsInstall.cpp b/mozilla/xpinstall/src/nsInstall.cpp index d1dc944025b..890a572cc4a 100644 --- a/mozilla/xpinstall/src/nsInstall.cpp +++ b/mozilla/xpinstall/src/nsInstall.cpp @@ -62,7 +62,7 @@ #include "nsIProxyObjectManager.h" #include "nsProxiedService.h" -#include "nsICommonDialogs.h" +#include "nsIPromptService.h" #include "nsIPrompt.h" #ifdef _WINDOWS @@ -94,8 +94,6 @@ static NS_DEFINE_IID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID); static NS_DEFINE_IID(kIEventQueueServiceIID, NS_IEVENTQUEUESERVICE_IID); static NS_DEFINE_IID(kProxyObjectManagerCID, NS_PROXYEVENT_MANAGER_CID); -static NS_DEFINE_CID(kCommonDialogsCID, NS_CommonDialog_CID); - static NS_DEFINE_CID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID); static NS_DEFINE_IID(kIStringBundleServiceIID, NS_ISTRINGBUNDLESERVICE_IID); @@ -2481,7 +2479,7 @@ void nsInstall::SetInstallURL(const nsString& url) { mInstallURL = url; } //----------------------------------------------------------------------------- // GetTranslatedString : // This is a utility function that translates "Alert" or -// "Confirm" to pass as the title to the CommonDialogs Alert and Confirm +// "Confirm" to pass as the title to the PromptService Alert and Confirm // functions as the title. If you pass nsnull as the title, you get garbage // instead of a blank title. //----------------------------------------------------------------------------- @@ -2504,15 +2502,18 @@ PRUnichar *GetTranslatedString(const PRUnichar* aString) PRInt32 nsInstall::Alert(nsString& string) { - nsresult res; - - NS_WITH_PROXIED_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, NS_UI_THREAD_EVENTQ, &res); - if (NS_FAILED(res)) - return res; + nsCOMPtr proxyman(do_GetService(NS_XPCOMPROXY_CONTRACTID)); + nsCOMPtr dialog(do_GetService("@mozilla.org/embedcomp/prompt-service;1")); + nsCOMPtr proxiedDialog; + if (proxyman && dialog) + proxyman->GetProxyForObject(NS_UI_THREAD_EVENTQ, NS_GET_IID(nsIPromptService), + dialog, PROXY_SYNC, getter_AddRefs(proxiedDialog)); + if (!proxiedDialog) + return NS_ERROR_FAILURE; PRUnichar *title = GetTranslatedString(NS_ConvertASCIItoUCS2("Alert").get()); - return dialog->Alert(mParent, title, string.GetUnicode()); + return proxiedDialog->Alert(mParent, title, string.GetUnicode()); } PRInt32 @@ -2520,10 +2521,14 @@ nsInstall::Confirm(nsString& string, PRBool* aReturn) { *aReturn = PR_FALSE; /* default value */ - nsresult res; - NS_WITH_PROXIED_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, NS_UI_THREAD_EVENTQ, &res); - if (NS_FAILED(res)) - return res; + nsCOMPtr proxyman(do_GetService(NS_XPCOMPROXY_CONTRACTID)); + nsCOMPtr dialog(do_GetService("@mozilla.org/embedcomp/prompt-service;1")); + nsCOMPtr proxiedDialog; + if (proxyman && dialog) + proxyman->GetProxyForObject(NS_UI_THREAD_EVENTQ, NS_GET_IID(nsIPromptService), + dialog, PROXY_SYNC, getter_AddRefs(proxiedDialog)); + if (!proxiedDialog) + return NS_ERROR_FAILURE; PRUnichar *title = GetTranslatedString(NS_ConvertASCIItoUCS2("Confirm").get()); diff --git a/mozilla/xpinstall/src/nsXPInstallManager.cpp b/mozilla/xpinstall/src/nsXPInstallManager.cpp index 0bb86ee7d83..e1b98df3620 100644 --- a/mozilla/xpinstall/src/nsXPInstallManager.cpp +++ b/mozilla/xpinstall/src/nsXPInstallManager.cpp @@ -59,7 +59,7 @@ #include "nsProxiedService.h" #include "nsIAppShellComponentImpl.h" -#include "nsICommonDialogs.h" +#include "nsIPromptService.h" #include "nsIScriptGlobalObject.h" static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); @@ -67,7 +67,6 @@ static NS_DEFINE_IID(kAppShellServiceCID, NS_APPSHELL_SERVICE_CID ); static NS_DEFINE_IID(kProxyObjectManagerCID, NS_PROXYEVENT_MANAGER_CID); static NS_DEFINE_IID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID); static NS_DEFINE_CID(kDialogParamBlockCID, NS_DialogParamBlock_CID); -static NS_DEFINE_CID(kCommonDialogCID, NS_CommonDialog_CID); #include "nsIEventQueueService.h" @@ -359,8 +358,8 @@ PRBool nsXPInstallManager::ConfirmChromeInstall(nsIScriptGlobalObject* aGlobalOb nsCOMPtr parentWindow(do_QueryInterface(aGlobalObject)); if (parentWindow) { - NS_WITH_SERVICE(nsICommonDialogs, dlgService, kCommonDialogCID, &rv); - if (NS_SUCCEEDED(rv)) + nsCOMPtr dlgService(do_GetService("@mozilla.org/embedcomp/prompt-service;1")); + if (dlgService) { rv = dlgService->ConfirmCheck( parentWindow, nsnull,