3rd patch for bug 158080

Description: replace the hardcode of "@mozilla.org/embedcomp/window-watcher;1" with NS_WINDOWWATCHER_CONTRACTID
Patch by Henry.Jia@sun.com
r=anto, sr=alecf
This commit is contained in:
henry.jia%sun.com 2002-08-06 05:37:58 +00:00
parent 139c30a706
commit eed9ab0bdd
18 changed files with 26 additions and 29 deletions

@ -124,7 +124,7 @@ NS_IMETHODIMP nsMessengerBootstrap::OpenMessengerWindowWithUri(const char *windo
argsArray->AppendElement(scriptableMessageKey);
}
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1", &rv));
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv));
NS_ENSURE_SUCCESS(rv, rv);
// we need to use the "mailnews.reuse_thread_window2" pref

@ -765,7 +765,7 @@ nsMsgIncomingServer::GetPasswordWithUI(const PRUnichar * aPromptMessage, const
}
else
{
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1"));
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
if (wwatch)
wwatch->GetNewAuthPrompter(0, getter_AddRefs(dialog));
if (!dialog) return NS_ERROR_FAILURE;

@ -273,7 +273,7 @@ nsresult nsMsgComposeService::OpenWindow(const char *chrome, nsIMsgComposeParams
}
//Else, create a new one...
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1"));
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
if (!wwatch)
return NS_ERROR_FAILURE;

@ -100,7 +100,7 @@ nsMsgDisplayMessageByString(nsIPrompt * aPrompt, const PRUnichar * msg, const PR
if (!prompt)
{
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1"));
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
if (wwatch)
wwatch->GetNewPrompter(0, getter_AddRefs(prompt));
}
@ -137,7 +137,7 @@ nsMsgAskBooleanQuestionByString(nsIPrompt * aPrompt, const PRUnichar * msg, PRBo
if (!dialog)
{
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1"));
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
if (wwatch)
wwatch->GetNewPrompter(0, getter_AddRefs(dialog));
}

@ -279,7 +279,7 @@ nsresult NS_MsgBuildSmtpUrl(nsIFileSpec * aFilePath,
nsCOMPtr<nsIAuthPrompt> smtpAuthPrompt(do_GetInterface(aNotificationCallbacks));
if (!smtpPrompt || !smtpAuthPrompt)
{
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1"));
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
if (wwatch) {
if (!smtpPrompt)
wwatch->GetNewPrompter(0, getter_AddRefs(smtpPrompt));

@ -3464,7 +3464,7 @@ NS_IMETHODIMP nsImapService::NewChannel(nsIURI *aURI, nsIChannel **_retval)
{
// this folder doesn't exist - check if the user wants to subscribe to this folder.
nsCOMPtr<nsIPrompt> dialog;
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1", &rv));
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv));
NS_ENSURE_SUCCESS(rv, rv);
wwatch->GetNewPrompter(nsnull, getter_AddRefs(dialog));

@ -1114,7 +1114,7 @@ nsresult nsNNTPProtocol::LoadUrl(nsIURI * aURL, nsISupports * aConsumer)
if (!dialog)
{
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1"));
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
wwatch->GetNewPrompter(nsnull, getter_AddRefs(dialog));
}

@ -1377,7 +1377,7 @@ nsMsgNewsFolder::GetGroupPasswordWithUI(const PRUnichar * aPromptMessage, const
if (NS_FAILED(rv)) return rv;
}
else {
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1"));
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
if (wwatch)
wwatch->GetNewAuthPrompter(0, getter_AddRefs(dialog));
@ -1443,7 +1443,7 @@ nsMsgNewsFolder::GetGroupUsernameWithUI(const PRUnichar * aPromptMessage, const
if (NS_FAILED(rv)) return rv;
}
else {
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1"));
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
if (wwatch)
wwatch->GetNewAuthPrompter(0, getter_AddRefs(dialog));

@ -1573,7 +1573,7 @@ nsNntpIncomingServer::GroupNotFound(nsIMsgWindow *aMsgWindow, const char *aName,
}
if (!prompt) {
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1"));
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
rv = wwatch->GetNewPrompter(nsnull, getter_AddRefs(prompt));
NS_ENSURE_SUCCESS(rv,rv);
}

@ -843,7 +843,7 @@ nsJVMManager::GetChrome(nsIWebBrowserChrome **theChrome)
nsCOMPtr<nsIWebBrowserChrome> chrome;
windowWatcher =
do_GetService("@mozilla.org/embedcomp/window-watcher;1", &rv);
do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv);
if (!windowWatcher) {
return rv;
}

@ -2912,7 +2912,7 @@ nsresult nsPluginHostImpl:: GetPrompt(nsIPluginInstanceOwner *aOwner, nsIPrompt
{
nsresult rv;
nsCOMPtr<nsIPrompt> prompt;
nsCOMPtr<nsIWindowWatcher> wwatch = do_GetService("@mozilla.org/embedcomp/window-watcher;1", &rv);
nsCOMPtr<nsIWindowWatcher> wwatch = do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv);
if (wwatch) {
nsCOMPtr<nsIDOMWindow> domWindow;

@ -336,7 +336,7 @@ nsPrefMigration::ProcessPrefs(PRBool showProgressAsModalWindow)
{
nsresult rv;
nsCOMPtr<nsIWindowWatcher> windowWatcher(do_GetService("@mozilla.org/embedcomp/window-watcher;1", &rv));
nsCOMPtr<nsIWindowWatcher> windowWatcher(do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv));
if (NS_FAILED(rv)) return rv;
// WindowWatcher can work with or without parent window
@ -473,7 +473,7 @@ NS_IMETHODIMP
nsPrefMigration::ShowSpaceDialog(PRInt32 *choice)
{
nsresult rv;
nsCOMPtr<nsIWindowWatcher> windowWatcher(do_GetService("@mozilla.org/embedcomp/window-watcher;1", &rv));
nsCOMPtr<nsIWindowWatcher> windowWatcher(do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv));
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIDialogParamBlock> ioParamBlock(do_CreateInstance("@mozilla.org/embedcomp/dialogparam;1", &rv));

@ -129,7 +129,6 @@
#define CHROME_STYLE nsIWebBrowserChrome::CHROME_ALL | nsIWebBrowserChrome::CHROME_CENTER_SCREEN
#endif
const char* kWindowWatcherContractID = "@mozilla.org/embedcomp/window-watcher;1";
const char* kDialogParamBlockContractID = "@mozilla.org/embedcomp/dialogparam;1";
const char* kDefaultOpenWindowParams = "centerscreen,chrome,modal,titlebar";
@ -569,7 +568,7 @@ nsProfile::LoadDefaultProfileDir(nsCString & profileURLStr, PRBool canInteract)
{
if (!canInteract) return NS_ERROR_PROFILE_REQUIRES_INTERACTION;
nsCOMPtr<nsIWindowWatcher> windowWatcher(do_GetService(kWindowWatcherContractID, &rv));
nsCOMPtr<nsIWindowWatcher> windowWatcher(do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv));
if (NS_FAILED(rv)) return rv;
// We need to send a param to OpenWindow if the window is to be considered
@ -2354,7 +2353,7 @@ nsresult
nsProfile::ShowProfileWizard(void)
{
nsresult rv;
nsCOMPtr<nsIWindowWatcher> windowWatcher(do_GetService(kWindowWatcherContractID, &rv));
nsCOMPtr<nsIWindowWatcher> windowWatcher(do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv));
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIDialogParamBlock> ioParamBlock(do_CreateInstance("@mozilla.org/embedcomp/dialogparam;1", &rv));

@ -90,7 +90,7 @@ nsNSSDialogHelper::openDialog(
{
nsresult rv;
nsCOMPtr<nsIWindowWatcher> windowWatcher =
do_GetService("@mozilla.org/embedcomp/window-watcher;1", &rv);
do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv);
if (NS_FAILED(rv)) return rv;
nsIDOMWindowInternal *parent = window;

@ -1650,7 +1650,7 @@ nsP12Runnable::~nsP12Runnable()
void
alertUser(const PRUnichar *message)
{
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1"));
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
nsCOMPtr<nsIPrompt> prompter;
if (wwatch)
wwatch->GetNewPrompter(0, getter_AddRefs(prompter));
@ -2129,7 +2129,7 @@ PRBool
confirm_user(const PRUnichar *message)
{
PRBool confirmation = PR_FALSE;
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1"));
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
nsCOMPtr<nsIPrompt> prompter;
if (wwatch)
wwatch->GetNewPrompter(0, getter_AddRefs(prompter));

@ -4057,7 +4057,7 @@ done:
if (!importSuccessful){
nsString message;
nsString temp;
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1"));
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
nsCOMPtr<nsIPrompt> prompter;
if (wwatch){
wwatch->GetNewPrompter(0, getter_AddRefs(prompter));

@ -981,7 +981,7 @@ nsNSSComponent::InitializeNSS()
if (NS_SUCCEEDED(rv)) {
PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("can't get error string\n"));
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1"));
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
if (!wwatch) {
PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("can't get window watcher\n"));
}
@ -1533,7 +1533,7 @@ NS_IMETHODIMP PipUIContext::GetInterface(const nsIID & uuid, void * *result)
if (!proxyman) return NS_ERROR_FAILURE;
nsCOMPtr<nsIPrompt> prompter;
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1"));
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
if (wwatch) {
wwatch->GetNewPrompter(0, getter_AddRefs(prompter));
if (prompter) {
@ -1780,7 +1780,7 @@ PSMContentDownloader::handleContentDownloadError(nsresult errCode)
pref->SavePrefFile(nsnull);
}else{
nsString message;
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1"));
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
nsCOMPtr<nsIPrompt> prompter;
if (wwatch){
wwatch->GetNewPrompter(0, getter_AddRefs(prompter));

@ -31,7 +31,7 @@
* may use your version of this file under either the MPL or the
* GPL.
*
* $Id: nsPKCS12Blob.cpp,v 1.26 2002/05/07 23:06:45 darin%netscape.com Exp $
* $Id: nsPKCS12Blob.cpp,v 1.27 2002/08/06 05:37:58 henry.jia%sun.com Exp $
*/
#include "prmem.h"
@ -678,8 +678,6 @@ pip_ucs2_ascii_conversion_fn(PRBool toUnicode,
return PR_TRUE;
}
#define kWindowWatcherCID "@mozilla.org/embedcomp/window-watcher;1"
PRBool
nsPKCS12Blob::handleError(int myerr)
{
@ -694,7 +692,7 @@ nsPKCS12Blob::handleError(int myerr)
do_GetService(NS_XPCOMPROXY_CONTRACTID));
if (!proxyman) return PR_FALSE;
nsCOMPtr<nsIPrompt> errPrompt;
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(kWindowWatcherCID));
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
if (wwatch) {
wwatch->GetNewPrompter(0, getter_AddRefs(errPrompt));
if (errPrompt) {