From e5c68f5f9b0209553388aa82e3b41ecd872c2260 Mon Sep 17 00:00:00 2001 From: "antonio.xu%sun.com" Date: Wed, 14 Aug 2002 12:39:03 +0000 Subject: [PATCH] replace the hardcode of "@mozilla.org/embedcomp/dialogparam;1" with NS_DIALOGPARAMBLOCK_CONTRACTID Bug 158608 r=Henry sr=alecf --- .../src/os2/nsPrintingPromptService.cpp | 3 --- .../src/unixshared/nsPrintingPromptService.cpp | 3 --- .../src/win/nsPrintingPromptService.cpp | 2 -- .../windowwatcher/public/nsIDialogParamBlock.idl | 4 +--- .../windowwatcher/src/nsDialogParamBlock.h | 2 -- gfx/src/nsPrintOptionsImpl.cpp | 2 +- layout/mathml/base/src/nsMathMLChar.cpp | 2 +- profile/pref-migrator/src/nsPrefMigration.cpp | 2 +- profile/src/nsProfile.cpp | 6 ++---- security/manager/pki/src/nsNSSDialogs.cpp | 16 ++++++++-------- security/manager/pki/src/nsPKIParamBlock.cpp | 2 +- xpinstall/src/nsXPInstallManager.cpp | 2 +- 12 files changed, 16 insertions(+), 30 deletions(-) diff --git a/embedding/components/printingui/src/os2/nsPrintingPromptService.cpp b/embedding/components/printingui/src/os2/nsPrintingPromptService.cpp index 2fae6544277..55fe17cefd4 100644 --- a/embedding/components/printingui/src/os2/nsPrintingPromptService.cpp +++ b/embedding/components/printingui/src/os2/nsPrintingPromptService.cpp @@ -62,9 +62,6 @@ static const char *kPrintProgressDialogURL = "chrome://global/content/printProgr static const char *kPrtPrvProgressDialogURL = "chrome://global/content/printPreviewProgress.xul"; static const char *kPageSetupDialogURL = "chrome://communicator/content/printPageSetup.xul"; -#define NS_DIALOGPARAMBLOCK_CONTRACTID \ - "@mozilla.org/embedcomp/dialogparam;1" - /**************************************************************** ************************* ParamBlock *************************** ****************************************************************/ diff --git a/embedding/components/printingui/src/unixshared/nsPrintingPromptService.cpp b/embedding/components/printingui/src/unixshared/nsPrintingPromptService.cpp index b03b6b3fdf0..a50f22c65af 100644 --- a/embedding/components/printingui/src/unixshared/nsPrintingPromptService.cpp +++ b/embedding/components/printingui/src/unixshared/nsPrintingPromptService.cpp @@ -57,9 +57,6 @@ static const char *kPrtPrvProgressDialogURL = "chrome://global/content/printPrev static const char *kPageSetupDialogURL = "chrome://communicator/content/printPageSetup.xul"; static const char *kPrinterPropertiesURL = "chrome://global/content/printjoboptions.xul"; -#define NS_DIALOGPARAMBLOCK_CONTRACTID \ - "@mozilla.org/embedcomp/dialogparam;1" - /**************************************************************** ************************* ParamBlock *************************** ****************************************************************/ diff --git a/embedding/components/printingui/src/win/nsPrintingPromptService.cpp b/embedding/components/printingui/src/win/nsPrintingPromptService.cpp index 7ccd6e2a8be..11b9ecd91fa 100644 --- a/embedding/components/printingui/src/win/nsPrintingPromptService.cpp +++ b/embedding/components/printingui/src/win/nsPrintingPromptService.cpp @@ -54,8 +54,6 @@ #include "nsIInterfaceRequestorUtils.h" -#define NS_DIALOGPARAMBLOCK_CONTRACTID "@mozilla.org/embedcomp/dialogparam;1" - static const char *kPrintProgressDialogURL = "chrome://global/content/printProgress.xul"; static const char *kPrtPrvProgressDialogURL = "chrome://global/content/printPreviewProgress.xul"; static const char *kPageSetupDialogURL = "chrome://communicator/content/printPageSetup.xul"; diff --git a/embedding/components/windowwatcher/public/nsIDialogParamBlock.idl b/embedding/components/windowwatcher/public/nsIDialogParamBlock.idl index b869cb2cd38..f221b057d28 100644 --- a/embedding/components/windowwatcher/public/nsIDialogParamBlock.idl +++ b/embedding/components/windowwatcher/public/nsIDialogParamBlock.idl @@ -50,8 +50,6 @@ interface nsIDialogParamBlock: nsISupports { }; %{C++ -// {f76c0901-437a-11d3-b7a0-e35db351b4bc} -#define NS_DIALOGPARAMBLOCK_IID \ - {0xf76c0901, 0x437a, 0x11d3, {0xb7, 0xa0, 0xe3, 0x5d, 0xb3, 0x51, 0xb4, 0xbc}} +#define NS_DIALOGPARAMBLOCK_CONTRACTID "@mozilla.org/embedcomp/dialogparam;1" %} diff --git a/embedding/components/windowwatcher/src/nsDialogParamBlock.h b/embedding/components/windowwatcher/src/nsDialogParamBlock.h index 4c6e59e135f..359346b0489 100644 --- a/embedding/components/windowwatcher/src/nsDialogParamBlock.h +++ b/embedding/components/windowwatcher/src/nsDialogParamBlock.h @@ -44,8 +44,6 @@ // {4E4AAE11-8901-46cc-8217-DAD7C5415873} #define NS_DIALOGPARAMBLOCK_CID \ {0x4e4aae11, 0x8901, 0x46cc, {0x82, 0x17, 0xda, 0xd7, 0xc5, 0x41, 0x58, 0x73}} -#define NS_DIALOGPARAMBLOCK_CONTRACTID \ - "@mozilla.org/embedcomp/dialogparam;1" class nsString; diff --git a/gfx/src/nsPrintOptionsImpl.cpp b/gfx/src/nsPrintOptionsImpl.cpp index ed4d7fddaf9..31b05034b6c 100644 --- a/gfx/src/nsPrintOptionsImpl.cpp +++ b/gfx/src/nsPrintOptionsImpl.cpp @@ -280,7 +280,7 @@ nsPrintOptions::ShowPrintSetupDialog(nsIPrintSettings *aPS) NS_ASSERTION(psSupports, "PrintSettings must be a supports"); array->AppendElement(psSupports); - nsCOMPtr ioParamBlock(do_CreateInstance("@mozilla.org/embedcomp/dialogparam;1")); + nsCOMPtr ioParamBlock(do_CreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID)); if (ioParamBlock) { ioParamBlock->SetInt(0, 0); nsCOMPtr blkSupps(do_QueryInterface(ioParamBlock)); diff --git a/layout/mathml/base/src/nsMathMLChar.cpp b/layout/mathml/base/src/nsMathMLChar.cpp index b83f3c0311e..fc1ff3beb8c 100644 --- a/layout/mathml/base/src/nsMathMLChar.cpp +++ b/layout/mathml/base/src/nsMathMLChar.cpp @@ -158,7 +158,7 @@ AlertMissingFonts(nsString& aMissingFonts) if (!wwatch) return; - nsCOMPtr paramBlock(do_CreateInstance("@mozilla.org/embedcomp/dialogparam;1")); + nsCOMPtr paramBlock(do_CreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID)); if (!paramBlock) return; diff --git a/profile/pref-migrator/src/nsPrefMigration.cpp b/profile/pref-migrator/src/nsPrefMigration.cpp index 8876d310b32..8c7d16cac07 100644 --- a/profile/pref-migrator/src/nsPrefMigration.cpp +++ b/profile/pref-migrator/src/nsPrefMigration.cpp @@ -476,7 +476,7 @@ nsPrefMigration::ShowSpaceDialog(PRInt32 *choice) nsCOMPtr windowWatcher(do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv)); if (NS_FAILED(rv)) return rv; - nsCOMPtr ioParamBlock(do_CreateInstance("@mozilla.org/embedcomp/dialogparam;1", &rv)); + nsCOMPtr ioParamBlock(do_CreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID, &rv)); if (NS_FAILED(rv)) return rv; ioParamBlock->SetInt(0,3); //set the Retry, CreateNew and Cancel buttons diff --git a/profile/src/nsProfile.cpp b/profile/src/nsProfile.cpp index 17cfd75c60b..8e911cbfffd 100644 --- a/profile/src/nsProfile.cpp +++ b/profile/src/nsProfile.cpp @@ -129,8 +129,6 @@ #define CHROME_STYLE nsIWebBrowserChrome::CHROME_ALL | nsIWebBrowserChrome::CHROME_CENTER_SCREEN #endif -const char* kDialogParamBlockContractID = "@mozilla.org/embedcomp/dialogparam;1"; - const char* kDefaultOpenWindowParams = "centerscreen,chrome,modal,titlebar"; const char* kBrandBundleURL = "chrome://global/locale/brand.properties"; @@ -574,7 +572,7 @@ nsProfile::LoadDefaultProfileDir(nsCString & profileURLStr, PRBool canInteract) // We need to send a param to OpenWindow if the window is to be considered // a dialog. It needs to be for script security reasons. This param block // will be made use of soon. See bug 66833. - nsCOMPtr ioParamBlock(do_CreateInstance("@mozilla.org/embedcomp/dialogparam;1", &rv)); + nsCOMPtr ioParamBlock(do_CreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID, &rv)); if (NS_FAILED(rv)) return rv; nsCOMPtr newWindow; @@ -2360,7 +2358,7 @@ nsProfile::ShowProfileWizard(void) nsCOMPtr windowWatcher(do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv)); if (NS_FAILED(rv)) return rv; - nsCOMPtr ioParamBlock(do_CreateInstance("@mozilla.org/embedcomp/dialogparam;1", &rv)); + nsCOMPtr ioParamBlock(do_CreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID, &rv)); if (NS_FAILED(rv)) return rv; ioParamBlock->SetInt(0,4); // standard wizard buttons diff --git a/security/manager/pki/src/nsNSSDialogs.cpp b/security/manager/pki/src/nsNSSDialogs.cpp index bcb1a16b07d..ec79cf6b9db 100644 --- a/security/manager/pki/src/nsNSSDialogs.cpp +++ b/security/manager/pki/src/nsNSSDialogs.cpp @@ -169,7 +169,7 @@ nsNSSDialogs::SetPassword(nsIInterfaceRequestor *ctx, // Get the parent window for the dialog nsCOMPtr parent = do_GetInterface(ctx); - nsCOMPtr block(do_CreateInstance("@mozilla.org/embedcomp/dialogparam;1")); + nsCOMPtr block(do_CreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID)); if (!block) return NS_ERROR_FAILURE; // void ChangePassword(in wstring tokenName, out int status); @@ -202,7 +202,7 @@ nsNSSDialogs::GetPassword(nsIInterfaceRequestor *ctx, *_canceled = PR_FALSE; // Get the parent window for the dialog nsCOMPtr parent = do_GetInterface(ctx); - nsCOMPtr block(do_CreateInstance("@mozilla.org/embedcomp/dialogparam;1")); + nsCOMPtr block(do_CreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID)); if (!block) return NS_ERROR_FAILURE; // Set the token name in the window rv = block->SetString(1, tokenName); @@ -726,7 +726,7 @@ nsNSSDialogs::CACertExists(nsIInterfaceRequestor *ctx,PRBool *_canceled) // Get the parent window for the dialog nsCOMPtr parent = do_GetInterface(ctx); - nsCOMPtr block(do_CreateInstance("@mozilla.org/embedcomp/dialogparam;1")); + nsCOMPtr block(do_CreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID)); if (!block) return NS_ERROR_FAILURE; @@ -749,7 +749,7 @@ nsNSSDialogs::ChooseCertificate(nsIInterfaceRequestor *ctx, const PRUnichar *cn, // Get the parent window for the dialog nsCOMPtr parent = do_GetInterface(ctx); - nsCOMPtr block(do_CreateInstance("@mozilla.org/embedcomp/dialogparam;1")); + nsCOMPtr block(do_CreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID)); if (!block) return NS_ERROR_FAILURE; block->SetNumberStrings(4+count*2); @@ -811,7 +811,7 @@ nsNSSDialogs::PickCertificate(nsIInterfaceRequestor *ctx, // Get the parent window for the dialog nsCOMPtr parent = do_GetInterface(ctx); - nsCOMPtr block(do_CreateInstance("@mozilla.org/embedcomp/dialogparam;1")); + nsCOMPtr block(do_CreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID)); if (!block) return NS_ERROR_FAILURE; block->SetNumberStrings(1+count*2); @@ -864,7 +864,7 @@ nsNSSDialogs::SetPKCS12FilePassword(nsIInterfaceRequestor *ctx, *_canceled = PR_FALSE; // Get the parent window for the dialog nsCOMPtr parent = do_GetInterface(ctx); - nsCOMPtr block(do_CreateInstance("@mozilla.org/embedcomp/dialogparam;1")); + nsCOMPtr block(do_CreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID)); if (!block) return NS_ERROR_FAILURE; // open up the window rv = nsNSSDialogHelper::openDialog(parent, @@ -897,7 +897,7 @@ nsNSSDialogs::GetPKCS12FilePassword(nsIInterfaceRequestor *ctx, *_canceled = PR_FALSE; // Get the parent window for the dialog nsCOMPtr parent = do_GetInterface(ctx); - nsCOMPtr block(do_CreateInstance("@mozilla.org/embedcomp/dialogparam;1")); + nsCOMPtr block(do_CreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID)); if (!block) return NS_ERROR_FAILURE; // open up the window rv = nsNSSDialogHelper::openDialog(parent, @@ -960,7 +960,7 @@ nsNSSDialogs::ChooseToken(nsIInterfaceRequestor *aCtx, const PRUnichar **aTokenL // Get the parent window for the dialog nsCOMPtr parent = do_GetInterface(aCtx); - nsCOMPtr block(do_CreateInstance("@mozilla.org/embedcomp/dialogparam;1")); + nsCOMPtr block(do_CreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID)); if (!block) return NS_ERROR_FAILURE; block->SetNumberStrings(aCount); diff --git a/security/manager/pki/src/nsPKIParamBlock.cpp b/security/manager/pki/src/nsPKIParamBlock.cpp index 05410ce70dc..5d503027618 100644 --- a/security/manager/pki/src/nsPKIParamBlock.cpp +++ b/security/manager/pki/src/nsPKIParamBlock.cpp @@ -48,7 +48,7 @@ nsPKIParamBlock::nsPKIParamBlock() nsresult nsPKIParamBlock::Init() { - mDialogParamBlock = do_CreateInstance("@mozilla.org/embedcomp/dialogparam;1"); + mDialogParamBlock = do_CreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID); return (mDialogParamBlock == nsnull) ? NS_ERROR_OUT_OF_MEMORY : NS_OK; } diff --git a/xpinstall/src/nsXPInstallManager.cpp b/xpinstall/src/nsXPInstallManager.cpp index a99c8f5d941..5fc9b5e0646 100644 --- a/xpinstall/src/nsXPInstallManager.cpp +++ b/xpinstall/src/nsXPInstallManager.cpp @@ -666,7 +666,7 @@ NS_IMETHODIMP nsXPInstallManager::LoadParams(PRUint32 aCount, const PRUnichar** aPackageList, nsIDialogParamBlock** aParams) { nsIDialogParamBlock* paramBlock = 0; - nsresult rv = nsComponentManager::CreateInstance("@mozilla.org/embedcomp/dialogparam;1", + nsresult rv = nsComponentManager::CreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID, nsnull, NS_GET_IID(nsIDialogParamBlock), (void**)¶mBlock);