Bug 749618 - Use a default icon for webapps without one. r=mfinkle

This commit is contained in:
Wes Johnston 2012-06-26 14:54:49 -07:00
parent cb91ad76c9
commit 17fdb74492
4 changed files with 15 additions and 3 deletions

View File

@ -44,7 +44,7 @@ function onLoad(aEvent) {
AppsUI.shortcut = contextmenus.add(gStrings.GetStringFromName("appsContext.shortcut"), contextmenus.SelectorContext("div[mozApp]"),
function(aTarget) {
let manifest = aTarget.manifest;
gChromeWin.WebappsUI.createShortcut(manifest.name, manifest.fullLaunchPath(), manifest.iconURLForSize("64"), "webapp");
gChromeWin.WebappsUI.createShortcut(manifest.name, manifest.fullLaunchPath(), gChromeWin.WebappsUI.getBiggestIcon(manifest.icons), "webapp");
});
AppsUI.uninstall = contextmenus.add(gStrings.GetStringFromName("appsContext.uninstall"), contextmenus.SelectorContext("div[mozApp]"),
function(aTarget) {
@ -97,7 +97,7 @@ function addApplication(aApp) {
container.setAttribute("title", manifest.name);
let img = document.createElement("img");
img.src = manifest.iconURLForSize("64");
img.src = gChromeWin.WebappsUI.getBiggestIcon(manifest.icons);
img.setAttribute("title", manifest.name);
let title = document.createElement("div");

View File

@ -5790,7 +5790,7 @@ var WebappsUI = {
// Add a homescreen shortcut -- we can't use createShortcut, since we need to pass
// a unique ID for Android webapp allocation
this.makeBase64Icon(manifest.iconURLForSize("64"),
this.makeBase64Icon(this.getBiggestIcon(manifest.icons),
function(icon) {
sendMessageToJava({
gecko: {
@ -5826,7 +5826,18 @@ var WebappsUI = {
break;
}
},
getBiggestIcon: function getBiggestIcon(aIcons) {
if (!aIcons)
return "chrome://browser/skin/images/default-app-icon.png";
let iconSizes = Object.keys(aIcons);
if (iconSizes.length == 0)
return "chrome://browser/skin/images/default-app-icon.png";
iconSizes.sort(function(a, b) a - b);
return aIcons[iconSizes.pop()];
}
doInstall: function doInstall(aData) {
let manifest = new DOMApplicationManifest(aData.app.manifest, aData.app.origin);
let name = manifest.name ? manifest.name : manifest.fullLaunchPath();

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@ -32,6 +32,7 @@ chrome.jar:
skin/images/checkbox_unchecked.png (images/checkbox_unchecked.png)
skin/images/checkbox_unchecked_disabled.png (images/checkbox_unchecked_disabled.png)
skin/images/checkbox_unchecked_pressed.png (images/checkbox_unchecked_pressed.png)
skin/images/default-app-icon.png (images/default-app-icon.png)
skin/images/dropmarker.svg (images/dropmarker.svg)
skin/images/errorpage-warning.png (images/errorpage-warning.png)
skin/images/errorpage-warning.png (images/errorpage-warning.png)