зеркало из https://github.com/mozilla/gecko-dev.git
Bug 489569: Add-on installation confirmation dialog [r=mark.finkle]
This commit is contained in:
Родитель
5c271b9ff5
Коммит
6a6a3e4a03
|
@ -353,8 +353,6 @@ var ExtensionsView = {
|
|||
if (!this._isXPInstallEnabled())
|
||||
return;
|
||||
|
||||
aItem.setAttribute("opType", "needs-install");
|
||||
|
||||
if (aItem.hasAttribute("eula")) {
|
||||
var eula = {
|
||||
name: aSelectedItem.getAttribute("name"),
|
||||
|
@ -633,6 +631,10 @@ XPInstallDownloadManager.prototype = {
|
|||
if (!element)
|
||||
return;
|
||||
|
||||
let opType = element.getAttribute("opType");
|
||||
if (!opType) {
|
||||
element.setAttribute("opType", "needs-install");
|
||||
}
|
||||
var progress = Math.round((aValue / aMaxValue) * 100);
|
||||
element.setAttribute("progress", progress);
|
||||
},
|
||||
|
|
|
@ -52,8 +52,21 @@ XPInstallDialogService.prototype = {
|
|||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIXPIDialogService, Ci.nsIXPIProgressDialog]),
|
||||
|
||||
confirmInstall: function(aParent, aPackages, aCount) {
|
||||
// Return true to get the install started
|
||||
// first check if the extensions panel is open : fast path to return true
|
||||
let wm = Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator);
|
||||
let browser = wm.getMostRecentWindow("navigator:browser");
|
||||
if (browser.ExtensionsView.visible)
|
||||
return true;
|
||||
|
||||
let bundleService = Cc["@mozilla.org/intl/stringbundle;1"].getService(Ci.nsIStringBundleService);
|
||||
let bundle = bundleService.createBundle("chrome://browser/locale/browser.properties");
|
||||
let prompt = Cc["@mozilla.org/embedcomp/prompt-service;1"].getService(Ci.nsIPromptService);
|
||||
|
||||
let flags = prompt.BUTTON_POS_0 * prompt.BUTTON_TITLE_IS_STRING + prompt.BUTTON_POS_1 * prompt.BUTTON_TITLE_CANCEL;
|
||||
let title = bundle.GetStringFromName("addonsConfirmInstall.title");
|
||||
let button = bundle.GetStringFromName("addonsConfirmInstall.install");
|
||||
|
||||
return prompt.confirmEx(null, title, aPackages[0], flags, button, null, null, null, {value: false}) == 0;
|
||||
},
|
||||
|
||||
openProgressDialog: function(aPackages, aCount, aManager) {
|
||||
|
|
|
@ -13,6 +13,9 @@ addonsSearchFail.label=%S couldn't retrieve add-ons
|
|||
addonsSearchFail.button=OK
|
||||
addonsSearchSuccess.button=Clear search
|
||||
|
||||
addonsConfirmInstall.title=Installing Add-on
|
||||
addonsConfirmInstall.install=Install
|
||||
|
||||
addonType.2=Extension
|
||||
addonType.4=Theme
|
||||
addonType.8=Locale
|
||||
|
|
Загрузка…
Ссылка в новой задаче