Bug 899353 - Show progress while installing apps. r=felipc

This commit is contained in:
Marco Castelluccio 2013-09-09 08:57:37 -04:00
parent 591842dffe
commit 69189031fe
6 changed files with 36 additions and 3 deletions

View File

@ -29,6 +29,12 @@
</popupnotificationcontent>
</popupnotification>
<popupnotification id="webapps-install-progress-notification" hidden="true">
<popupnotificationcontent id="webapps-install-progress-content" orient="vertical" align="start">
<separator class="thin"/>
</popupnotificationcontent>
</popupnotification>
<popupnotification id="geolocation-notification" hidden="true">
<popupnotificationcontent orient="vertical" align="start">
<separator class="thin"/>

View File

@ -407,6 +407,7 @@ webapps.install.accesskey = I
#LOCALIZATION NOTE (webapps.requestInstall) %1$S is the web app name, %2$S is the site from which the web app is installed
webapps.requestInstall = Do you want to install "%1$S" from this site (%2$S)?
webapps.install.success = Application Installed
webapps.install.inprogress = Installation in progress
# LOCALIZATION NOTE (fullscreen.entered): displayed when we enter HTML5 fullscreen mode, %S is the domain name of the focused website (e.g. mozilla.com).
fullscreen.entered=%S is now fullscreen.

View File

@ -117,13 +117,31 @@ this.webappsUI = {
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShell)
.chromeEventHandler;
let chromeWin = browser.ownerDocument.defaultView;
let chromeDoc = browser.ownerDocument;
let chromeWin = chromeDoc.defaultView;
let popupProgressContent =
chromeDoc.getElementById("webapps-install-progress-content");
let bundle = chromeWin.gNavigatorBundle;
let notification;
let mainAction = {
label: bundle.getString("webapps.install"),
accessKey: bundle.getString("webapps.install.accesskey"),
callback: () => {
notification.remove();
notification = chromeWin.PopupNotifications.
show(browser,
"webapps-install-progress",
bundle.getString("webapps.install.inprogress"),
"webapps-notification-icon");
let progressMeter = chromeDoc.createElement("progressmeter");
progressMeter.setAttribute("mode", "undetermined");
popupProgressContent.appendChild(progressMeter);
let manifestURL = aData.app.manifestURL;
if (aData.app.manifest && aData.app.manifest.appcache_path) {
this.downloads[manifestURL] = Promise.defer();
@ -150,6 +168,8 @@ this.webappsUI = {
Cu.reportError("Error installing webapp: " + ex);
// TODO: Notify user that the installation has failed
} finally {
popupProgressContent.removeChild(progressMeter);
notification.remove();
delete this.downloads[manifestURL];
}
}.bind(this));
@ -174,8 +194,11 @@ this.webappsUI = {
let message = bundle.getFormattedString("webapps.requestInstall",
[manifest.name, host], 2);
chromeWin.PopupNotifications.show(browser, "webapps-install", message,
"webapps-notification-icon", mainAction);
notification = chromeWin.PopupNotifications.show(browser,
"webapps-install",
message,
"webapps-notification-icon",
mainAction);
}
}

View File

@ -1184,6 +1184,7 @@ toolbar[iconsize="small"] #webrtc-status-button {
list-style-image: url(chrome://mozapps/skin/passwordmgr/key-64.png);
}
.popup-notification-icon[popupid="webapps-install-progress"],
.popup-notification-icon[popupid="webapps-install"] {
list-style-image: url(chrome://global/skin/icons/webapps-64.png);
}

View File

@ -3405,6 +3405,7 @@ toolbarbutton.chevron > .toolbarbutton-menu-dropmarker {
list-style-image: url(chrome://mozapps/skin/passwordmgr/key-64.png);
}
.popup-notification-icon[popupid="webapps-install-progress"],
.popup-notification-icon[popupid="webapps-install"] {
list-style-image: url(chrome://global/skin/icons/webapps-64.png);
}

View File

@ -2458,6 +2458,7 @@ toolbarbutton.bookmark-item[dragover="true"][open="true"] {
list-style-image: url(chrome://mozapps/skin/passwordmgr/key-64.png);
}
.popup-notification-icon[popupid="webapps-install-progress"],
.popup-notification-icon[popupid="webapps-install"] {
list-style-image: url(chrome://global/skin/icons/webapps-64.png);
}