Bug 619518 - If a notification has no callback, use a toaster popup

This commit is contained in:
Fabrice Desré 2011-01-27 10:54:36 -08:00
parent cd19d688f1
commit 9ece094edb
5 changed files with 8 additions and 6 deletions

View File

@ -1173,7 +1173,7 @@ var BrowserUI = {
Services.prefs.setBoolPref("toolkit.screen.lock", !locked);
let strings = Strings.browser;
let alerts = Cc["@mozilla.org/alerts-service;1"].getService(Ci.nsIAlertsService);
let alerts = Cc["@mozilla.org/toaster-alerts-service;1"].getService(Ci.nsIAlertsService);
alerts.showAlertNotification(null, strings.GetStringFromName("alertLockScreen"),
strings.GetStringFromName("alertLockScreen." + (!locked ? "locked" : "unlocked")), false, "", null);
break;

View File

@ -387,7 +387,7 @@ var Browser = {
let disabledStrings = Strings.browser.GetStringFromName("alertAddonsDisabled");
let label = PluralForm.get(addons.length, disabledStrings).replace("#1", addons.length);
let alerts = Cc["@mozilla.org/alerts-service;1"].getService(Ci.nsIAlertsService);
let alerts = Cc["@mozilla.org/toaster-alerts-service;1"].getService(Ci.nsIAlertsService);
alerts.showAlertNotification(URI_GENERIC_ICON_XPINSTALL, Strings.browser.GetStringFromName("alertAddons"),
label, false, "", null);
}

View File

@ -241,7 +241,7 @@ HelperAppLauncherDialog.prototype = {
_notify: function hald_notify(aLauncher, aCallback) {
let bundle = Services.strings.createBundle("chrome://browser/locale/browser.properties");
let notifier = Cc["@mozilla.org/alerts-service;1"].getService(Ci.nsIAlertsService);
let notifier = Cc[aCallback ? "@mozilla.org/alerts-service;1" : "@mozilla.org/toaster-alerts-service;1"].getService(Ci.nsIAlertsService);
notifier.showAlertNotification(URI_GENERIC_ICON_DOWNLOAD,
bundle.GetStringFromName("alertDownloads"),
bundle.GetStringFromName("alertCantOpenDownload"),

View File

@ -80,9 +80,7 @@ ifdef MOZ_UPDATER
EXTRA_COMPONENTS += UpdatePrompt.js
endif
ifndef ANDROID
EXTRA_COMPONENTS += AlertsService.js
endif
ifneq (Android,$(OS_TARGET))
DIRS = phone \

View File

@ -43,9 +43,13 @@ component {C6E8C44D-9F39-4AF7-BCC0-76E38A8310F5} ContentPermissionPrompt.js
contract @mozilla.org/content-permission/prompt;1 {C6E8C44D-9F39-4AF7-BCC0-76E38A8310F5}
# AlertsService.js
component {fe33c107-82a4-41d6-8c64-5353267e04c9} AlertsService.js
#ifndef ANDROID
contract @mozilla.org/system-alerts-service;1 {fe33c107-82a4-41d6-8c64-5353267e04c9}
#endif
# ToasterAlertsService : alias to AlertsService
contract @mozilla.org/toaster-alerts-service;1 {fe33c107-82a4-41d6-8c64-5353267e04c9}
# XPIDialogService.js
component {c1242012-27d8-477e-a0f1-0b098ffc329b} XPIDialogService.js