Bug 619518 - If a notification has no callback, use a toaster popup
--- a/mobile/chrome/content/browser-ui.js
+++ b/mobile/chrome/content/browser-ui.js
@@ -1168,16 +1168,16 @@ var BrowserUI = {
Browser.zoom(Util.isPortrait() ? 1 : -1);
break;
case "cmd_lockscreen":
{
let locked = Services.prefs.getBoolPref("toolkit.screen.lock");
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;
}
}
}
};
--- a/mobile/chrome/content/browser.js
+++ b/mobile/chrome/content/browser.js
@@ -382,17 +382,17 @@ var Browser = {
// If some add-ons were disabled during during an application update, alert user
if (Services.prefs.prefHasUserValue("extensions.disabledAddons")) {
let addons = Services.prefs.getCharPref("extensions.disabledAddons").split(",");
if (addons.length > 0) {
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);
}
Services.prefs.clearUserPref("extensions.disabledAddons");
}
messageManager.addMessageListener("Browser:ViewportMetadata", this);
messageManager.addMessageListener("Browser:FormSubmit", this);
--- a/mobile/components/HelperAppDialog.js
+++ b/mobile/components/HelperAppDialog.js
@@ -236,17 +236,17 @@ HelperAppLauncherDialog.prototype = {
isUsableDirectory: function hald_isUsableDirectory(aDirectory) {
return aDirectory.exists() && aDirectory.isDirectory() && aDirectory.isWritable();
},
_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"),
true, "", aCallback, "downloadopen-fail");
}
};
const NSGetFactory = XPCOMUtils.generateNSGetFactory([HelperAppLauncherDialog]);
--- a/mobile/components/Makefile.in
+++ b/mobile/components/Makefile.in
@@ -75,18 +75,16 @@ EXTRA_COMPONENTS = \
LoginManagerPrompter.js \
BlocklistPrompt.js \
$(NULL)
ifdef MOZ_UPDATER
EXTRA_COMPONENTS += UpdatePrompt.js
endif
-ifndef ANDROID
EXTRA_COMPONENTS += AlertsService.js
-endif
ifneq (Android,$(OS_TARGET))
DIRS = phone \
$(NULL)
endif
include $(topsrcdir)/config/rules.mk
--- a/mobile/components/MobileComponents.manifest
+++ b/mobile/components/MobileComponents.manifest
@@ -38,19 +38,23 @@ category app-startup BrowserStartup serv
category agent-style-sheets browser-content-stylesheet chrome://browser/content/content.css
category agent-style-sheets browser-cursor-stylesheet chrome://browser/content/cursor.css
# ContentPermissionPrompt.js
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
-component {fe33c107-82a4-41d6-8c64-5353267e04c9} AlertsService.js
-contract @mozilla.org/system-alerts-service;1 {fe33c107-82a4-41d6-8c64-5353267e04c9}
+# 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
contract @mozilla.org/addons/web-install-prompt;1 {c1242012-27d8-477e-a0f1-0b098ffc329b}
# DownloadManagerUI.js
component {93db15b1-b408-453e-9a2b-6619e168324a} DownloadManagerUI.js
contract @mozilla.org/download-manager-ui;1 {93db15b1-b408-453e-9a2b-6619e168324a}