[Bug 605370] Add Pref to disable desktop notifications r=jonas a=approval2.0
authorDoug Turner <dougt@dougt.org>
Tue, 16 Nov 2010 20:15:15 -0800
changeset 57630 0f43632752fe99e5f04aeb6ad31c06e8b609bbe6
parent 57629 b8024b9802483e049c628f5903c072bdad371566
child 57631 941c3d14e14d11a7b2f4160d5190471a11f8b820
push id17015
push userdougt@mozilla.com
push dateWed, 17 Nov 2010 04:25:31 +0000
treeherdermozilla-central@0f43632752fe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjonas, approval2
bugs605370
milestone2.0b8pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
[Bug 605370] Add Pref to disable desktop notifications r=jonas a=approval2.0
dom/src/notification/nsDesktopNotification.cpp
--- a/dom/src/notification/nsDesktopNotification.cpp
+++ b/dom/src/notification/nsDesktopNotification.cpp
@@ -176,16 +176,19 @@ nsDOMDesktopNotification::HandleAlertSer
   } else if (!strcmp("alertfinished", aTopic)) {
     DispatchNotificationEvent(NS_LITERAL_STRING("close"));
   }
 }
 
 NS_IMETHODIMP
 nsDOMDesktopNotification::Show()
 {
+  if (nsContentUtils::GetBoolPref("notification.disabled", PR_FALSE))
+    return NS_OK;
+
   // If we are in testing mode (running mochitests, for example)
   // and we are suppose to allow requests, then just post an allow event.
   if (nsContentUtils::GetBoolPref("notification.prompt.testing", PR_FALSE) &&
       nsContentUtils::GetBoolPref("notification.prompt.testing.allow", PR_TRUE)) {
     nsCOMPtr<nsIRunnable> request = new NotificationRequestAllowEvent(this);
     NS_DispatchToMainThread(request);
     return NS_OK;
   }