Bug 489569: Add-on installation confirmation dialog [r=mark.finkle]

This commit is contained in:
Fabrice Desré 2009-09-02 13:54:25 -04:00
Родитель 5c271b9ff5
Коммит 6a6a3e4a03
3 изменённых файлов: 22 добавлений и 4 удалений

Просмотреть файл

@ -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
return true;
// 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