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
Родитель e4ad9c5094
Коммит ccb6ecd388
4 изменённых файлов: 15 добавлений и 3 удалений

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

@ -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");

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

@ -5704,7 +5704,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: {
@ -5740,7 +5740,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();

Двоичные данные
mobile/android/themes/core/images/default-app-icon.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.9 KiB

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

@ -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)