Bug 1320406 - Add a "Not now" button to the addon installation restart notification. r=florian
MozReview-Commit-ID: EUJfcHU6qGN
--- a/browser/base/content/browser-addons.js
+++ b/browser/base/content/browser-addons.js
@@ -420,45 +420,52 @@ const gXPInstallObserver = {
}
showNotification();
break; }
case "addon-install-complete": {
let needsRestart = installInfo.installs.some(function(i) {
return i.addon.pendingOperations != AddonManager.PENDING_NONE;
});
+ let secondaryActions = null;
+
if (needsRestart) {
notificationID = "addon-install-restart";
messageString = gNavigatorBundle.getString("addonsInstalledNeedsRestart");
action = {
label: gNavigatorBundle.getString("addonInstallRestartButton"),
accessKey: gNavigatorBundle.getString("addonInstallRestartButton.accesskey"),
callback: function() {
BrowserUtils.restartApplication();
}
};
+ secondaryActions = [{
+ label: gNavigatorBundle.getString("addonInstallRestartIgnoreButton"),
+ accessKey: gNavigatorBundle.getString("addonInstallRestartIgnoreButton.accesskey"),
+ callback: () => {},
+ }];
}
else {
messageString = gNavigatorBundle.getString("addonsInstalled");
action = null;
}
messageString = PluralForm.get(installInfo.installs.length, messageString);
messageString = messageString.replace("#1", installInfo.installs[0].name);
messageString = messageString.replace("#2", installInfo.installs.length);
messageString = messageString.replace("#3", brandShortName);
- // Remove notificaion on dismissal, since it's possible to cancel the
+ // Remove notification on dismissal, since it's possible to cancel the
// install through the addons manager UI, making the "restart" prompt
// irrelevant.
options.removeOnDismissal = true;
options.persistent = false;
PopupNotifications.show(browser, notificationID, messageString, anchorID,
- action, null, options);
+ action, secondaryActions, options);
break; }
}
},
_removeProgressNotification(aBrowser) {
let notification = PopupNotifications.getNotification("addon-progress", aBrowser);
if (notification)
notification.remove();
}
--- a/browser/locales/en-US/chrome/browser/browser.properties
+++ b/browser/locales/en-US/chrome/browser/browser.properties
@@ -72,16 +72,18 @@ addonwatch.restart.accesskey=R
# LOCALIZATION NOTE (addonsInstalled, addonsInstalledNeedsRestart):
# Semicolon-separated list of plural forms. See:
# http://developer.mozilla.org/en/docs/Localization_and_Plurals
# #1 first add-on's name, #2 number of add-ons, #3 application name
addonsInstalled=#1 has been installed successfully.;#2 add-ons have been installed successfully.
addonsInstalledNeedsRestart=#1 will be installed after you restart #3.;#2 add-ons will be installed after you restart #3.
addonInstallRestartButton=Restart Now
addonInstallRestartButton.accesskey=R
+addonInstallRestartIgnoreButton=Not Now
+addonInstallRestartIgnoreButton.accesskey=N
# LOCALIZATION NOTE (addonInstallError-1, addonInstallError-2, addonInstallError-3, addonInstallError-4, addonInstallError-5, addonLocalInstallError-1, addonLocalInstallError-2, addonLocalInstallError-3, addonLocalInstallError-4, addonLocalInstallError-5):
# %1$S is the application name, %2$S is the add-on name
addonInstallError-1=The add-on could not be downloaded because of a connection failure.
addonInstallError-2=The add-on could not be installed because it does not match the add-on %1$S expected.
addonInstallError-3=The add-on downloaded from this site could not be installed because it appears to be corrupt.
addonInstallError-4=%2$S could not be installed because %1$S cannot modify the needed file.
addonInstallError-5=%1$S has prevented this site from installing an unverified add-on.