Bug 563114 - Remove nsINonBlockingAlertService. r=karlt, r=bsmedberg, sr=roc
authorJustin Dolske <dolske@mozilla.com>
Tue, 04 May 2010 17:41:07 -0700
changeset 41889 f7a9b2f21b09eaf6fe3afd5a8f35786bfdca8074
parent 41888 95f5b74267ff886e2be3ef8cbf8ffe4b0ebc6675
child 41890 71c8fd654a3e477502929ca61aa9515446fa3503
push idunknown
push userunknown
push dateunknown
reviewerskarlt, bsmedberg, roc
bugs563114
milestone1.9.3a5pre
Bug 563114 - Remove nsINonBlockingAlertService. r=karlt, r=bsmedberg, sr=roc
embedding/base/nsEmbedCID.h
embedding/components/build/nsEmbeddingModule.cpp
embedding/components/windowwatcher/public/Makefile.in
embedding/components/windowwatcher/public/nsINonBlockingAlertService.idl
embedding/components/windowwatcher/src/nsPromptService.cpp
embedding/components/windowwatcher/src/nsPromptService.h
layout/mathml/nsMathMLChar.cpp
--- a/embedding/base/nsEmbedCID.h
+++ b/embedding/base/nsEmbedCID.h
@@ -72,28 +72,16 @@
  * Embedders may override this ContractID with their own implementation if they
  * want more control over the way prompts, alerts, and confirmation dialogs are
  * presented to the user.
  */
 #define NS_PROMPTSERVICE_CONTRACTID \
  "@mozilla.org/embedcomp/prompt-service;1"
 
 /**
- * Non Blocking Alert Service ContractID
- *   This service is for posing non blocking alerts to the user.
- *
- * This contract implements the following interfaces:
- * nsINonBlockingAlertService
- *
- * Embedders may override this ContractID with their own implementation.
- */
-#define NS_NONBLOCKINGALERTSERVICE_CONTRACTID \
- "@mozilla.org/embedcomp/nbalert-service;1"
-
-/**
  * This contract ID should be implemented by password managers to be able to
  * override the standard implementation of nsIAuthPrompt2. It will be used as
  * a service.
  *
  * This contract implements the following interfaces:
  * nsIPromptFactory
  */
 #define NS_PWMGR_AUTHPROMPTFACTORY \
--- a/embedding/components/build/nsEmbeddingModule.cpp
+++ b/embedding/components/build/nsEmbeddingModule.cpp
@@ -128,17 +128,16 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPr
 #endif
 #endif
 
 static const nsModuleComponentInfo gComponents[] = {
 
 #ifdef MOZ_XUL
   { "Dialog ParamBlock", NS_DIALOGPARAMBLOCK_CID, NS_DIALOGPARAMBLOCK_CONTRACTID, nsDialogParamBlockConstructor },
   { "Prompt Service", NS_PROMPTSERVICE_CID, NS_PROMPTSERVICE_CONTRACTID, nsPromptServiceConstructor },
-  { "Nonblocking Alert Service", NS_PROMPTSERVICE_CID, NS_NONBLOCKINGALERTSERVICE_CONTRACTID, nsPromptServiceConstructor },
 #ifdef NS_PRINTING
 #ifndef WINCE
   { "Printing Prompt Service", NS_PRINTINGPROMPTSERVICE_CID, NS_PRINTINGPROMPTSERVICE_CONTRACTID, nsPrintingPromptServiceConstructor },
 #endif
 #endif
 #endif
   { "Window Watcher", NS_WINDOWWATCHER_CID, NS_WINDOWWATCHER_CONTRACTID, nsWindowWatcherConstructor },
   { "Window Watcher", NS_WINDOWWATCHER_CID, NS_AUTHPROMPT_ADAPTER_FACTORY_CONTRACTID, nsWindowWatcherConstructor },
--- a/embedding/components/windowwatcher/public/Makefile.in
+++ b/embedding/components/windowwatcher/public/Makefile.in
@@ -52,16 +52,15 @@ SDK_XPIDLSRCS   = nsIWindowWatcher.idl \
 		  $(NULL)
 
 XPIDLSRCS	= nsIDialogParamBlock.idl \
                   nsIPromptService2.idl \
                   nsPIPromptService.idl \
                   nsPIWindowWatcher.idl \
                   nsIAuthPromptWrapper.idl \
                   nsIPromptFactory.idl \
-                  nsINonBlockingAlertService.idl \
                   $(NULL)
 
 EXPORTS		= nsPromptUtils.h \
                   $(NULL)
 
 include $(topsrcdir)/config/rules.mk
 
deleted file mode 100644
--- a/embedding/components/windowwatcher/public/nsINonBlockingAlertService.idl
+++ /dev/null
@@ -1,67 +0,0 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * YAMASHITA Makoto <makotoy@ms.u-tokyo.ac.jp>.
- * Portions created by the Initial Developer are Copyright (C) 2006
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include "nsISupports.idl"
-interface nsIDOMWindow;
-
-/**
- * This is the interface to the embeddable non-blocking alert
- * service.  A non-blocking alert is a less serious informative alert
- * that does not need to block the program's execution to get the
- * user's response.
- *
- * The way to present the alert is left to the implementations.  It
- * may be a dialog separate from the parent window, or a window-modal
- * sheet (as the ones in Mac OS X) attached to the parent.
- */
-[scriptable, uuid(E800EF97-AE37-46B7-A46C-31FBE79657EA)]
-interface nsINonBlockingAlertService : nsISupports {
-  /**
-   * This shows a non-blocking alert with the specified title and
-   * message text. This function requires a valid parent window with
-   * which the alert is associated.
-   *
-   * @param aParent
-   *        The parent window. This must not be null.
-   * @param aDialogTitle
-   *        Text to appear in the title of the alert.
-   * @param aText
-   *        Text to appear in the body of the alert.
-   */
-  void showNonBlockingAlert(in nsIDOMWindow aParent,
-			    in wstring aDialogTitle, in wstring aText);
-};
--- a/embedding/components/windowwatcher/src/nsPromptService.cpp
+++ b/embedding/components/windowwatcher/src/nsPromptService.cpp
@@ -85,18 +85,18 @@ public:
 private:
   nsIDialogParamBlock *mBlock;
 };
 
 /****************************************************************
  ************************ nsPromptService ***********************
  ****************************************************************/
 
-NS_IMPL_ISUPPORTS4(nsPromptService, nsIPromptService, nsIPromptService2,
-                   nsPIPromptService, nsINonBlockingAlertService)
+NS_IMPL_ISUPPORTS3(nsPromptService, nsIPromptService, nsIPromptService2,
+                   nsPIPromptService)
 
 nsPromptService::nsPromptService() {
 }
 
 nsPromptService::~nsPromptService() {
 }
 
 nsresult
@@ -734,44 +734,16 @@ nsPromptService::Select(nsIDOMWindow *pa
   PRInt32 buttonPressed = 0;
   block->GetInt(eButtonPressed, &buttonPressed);
   block->GetInt(eSelection, outSelection);
   *_retval = buttonPressed ? PR_FALSE : PR_TRUE;
 
   return rv;
 }
 
-/* void showNonBlockingAlert (in nsIDOMWindow aParent, in wstring aDialogTitle, in wstring aText); */
-NS_IMETHODIMP
-nsPromptService::ShowNonBlockingAlert(nsIDOMWindow *aParent,
-                                      const PRUnichar *aDialogTitle,
-                                      const PRUnichar *aText)
-{
-  NS_ENSURE_ARG(aParent);
-  if (!mWatcher)
-    return NS_ERROR_FAILURE;
-
-  nsCOMPtr<nsIDialogParamBlock> paramBlock(do_CreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID));
-  if (!paramBlock)
-    return NS_ERROR_FAILURE;
-
-  paramBlock->SetInt(eNumberButtons, 1);
-  paramBlock->SetString(eIconClass, NS_LITERAL_STRING("alert-icon").get());
-  paramBlock->SetString(eDialogTitle, aDialogTitle);
-  paramBlock->SetString(eMsg, aText);
-  paramBlock->SetString(eOpeningSound, NS_SYSSOUND_ALERT_DIALOG.get());
-  paramBlock->SetInt(eSoundEventId, nsISound::EVENT_ALERT_DIALOG_OPEN);
-
-  nsCOMPtr<nsIDOMWindow> dialog;
-  mWatcher->OpenWindow(aParent, "chrome://global/content/commonDialog.xul",
-                       "_blank", "dependent,centerscreen,chrome,titlebar",
-                       paramBlock, getter_AddRefs(dialog));
-  return NS_OK;
-}
-
 nsresult
 nsPromptService::DoDialog(nsIDOMWindow *aParent,
                    nsIDialogParamBlock *aParamBlock, const char *aChromeURL)
 {
   NS_ENSURE_ARG(aParamBlock);
   NS_ENSURE_ARG(aChromeURL);
   if (!mWatcher)
     return NS_ERROR_FAILURE;
--- a/embedding/components/windowwatcher/src/nsPromptService.h
+++ b/embedding/components/windowwatcher/src/nsPromptService.h
@@ -43,38 +43,35 @@
  {0xa2112d6a, 0x0e28, 0x421f, {0xb4, 0x6a, 0x25, 0xc0, 0xb3, 0x8, 0xcb, 0xd0}}
 // {150E7415-72D7-11DA-A924-00039386357A}
 #define NS_NONBLOCKINGALERTSERVICE_CID \
  {0x150e7415, 0x72d7, 0x11da, {0xa9, 0x24, 0x00, 0x03, 0x93, 0x86, 0x35, 0x7a}}
 
 #include "nsCOMPtr.h"
 #include "nsIPromptService2.h"
 #include "nsPIPromptService.h"
-#include "nsINonBlockingAlertService.h"
 #include "nsIWindowWatcher.h"
 #include "nsAutoWindowStateHelper.h"
 
 class nsIDOMWindow;
 class nsIDialogParamBlock;
 
 class nsPromptService: public nsIPromptService2,
-                       public nsPIPromptService,
-                       public nsINonBlockingAlertService {
+                       public nsPIPromptService {
 
 public:
 
   nsPromptService();
   virtual ~nsPromptService();
 
   nsresult Init();
 
   NS_DECL_NSIPROMPTSERVICE
   NS_DECL_NSIPROMPTSERVICE2
   NS_DECL_NSPIPROMPTSERVICE
-  NS_DECL_NSINONBLOCKINGALERTSERVICE
   NS_DECL_ISUPPORTS
 
 private:
   nsresult GetLocaleString(const char *aKey, PRUnichar **aResult);
 
   nsCOMPtr<nsIWindowWatcher> mWatcher;
 };
 
--- a/layout/mathml/nsMathMLChar.cpp
+++ b/layout/mathml/nsMathMLChar.cpp
@@ -60,19 +60,16 @@
 #include "nsNetUtil.h"
 
 #include "nsILookAndFeel.h"
 #include "nsIDeviceContext.h"
 #include "nsCSSRendering.h"
 #include "prprf.h"         // For PR_snprintf()
 
 #if ALERT_MISSING_FONTS
-#include "nsIDOMWindow.h"
-#include "nsINonBlockingAlertService.h"
-#include "nsIWindowWatcher.h"
 #include "nsIStringBundle.h"
 #endif
 #include "nsDisplayList.h"
 
 #include "nsMathMLOperators.h"
 #include "nsMathMLChar.h"
 
 //#define SHOW_BORDERS 1
@@ -164,29 +161,18 @@ AlertMissingFonts(nsString& aMissingFont
     return;
 
   nsXPIDLString title, message;
   const PRUnichar* strings[] = { aMissingFonts.get() };
   sb->GetStringFromName(NS_LITERAL_STRING("mathfont_missing_dialog_title").get(), getter_Copies(title));
   sb->FormatStringFromName(NS_LITERAL_STRING("mathfont_missing_dialog_message").get(),
                            strings, 1, getter_Copies(message));
 
-  nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
-  if (!wwatch)
-    return;
-
-  nsCOMPtr<nsIDOMWindow> parent;
-  wwatch->GetActiveWindow(getter_AddRefs(parent));
-  nsresult rv;
-  nsCOMPtr<nsINonBlockingAlertService> prompter =
-    do_GetService("@mozilla.org/embedcomp/nbalert-service;1", &rv);
-
-  if (prompter && parent) {
-    prompter->ShowNonBlockingAlert(parent, title.get(), message.get());
-  }
+  // XXX Bug 309090 - could show a notification bar here. Bug 563114 removed
+  // the nsINonBlockingAlertService interface that was previously used here.
 }
 #endif
 
 // helper to trim off comments from data in a MathFont Property File
 static void
 Clean(nsString& aValue)
 {
   // chop the trailing # comment portion if any ...