Commit 6c491e11 authored by Daniel Murphy's avatar Daniel Murphy Committed by Commit Bot

[NTP] Fix icon existence checking in chrome://apps

This change fixes the icon existence checking for web apps in
chrome://apps to use downloaded icons instead of icon_info's from the
manifest.

R=loyso@chromium.org

Fixed: 1062987, 1078695
Change-Id: If27239cf1e4901369c0ab52182cdcf7f78c9982a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2183118Reviewed-by: default avatarAlan Cutter <alancutter@chromium.org>
Reviewed-by: default avatarAlexey Baskakov <loyso@chromium.org>
Commit-Queue: Daniel Murphy <dmurph@chromium.org>
Cr-Commit-Position: refs/heads/master@{#766532}
parent 2bc4e486
......@@ -147,10 +147,10 @@ bool DesktopPWAsWithoutExtensions() {
}
bool HasMatchingOrGreaterThanIcon(
const std::vector<WebApplicationIconInfo>& icon_infos,
std::vector<SquareSizePx> downloaded_icon_sizes,
int pixels) {
for (const auto& icon : icon_infos) {
if (icon.square_size_px >= pixels)
for (const SquareSizePx icon_size : downloaded_icon_sizes) {
if (icon_size >= pixels)
return true;
}
return false;
......@@ -207,14 +207,14 @@ void AppLauncherHandler::CreateWebAppInfo(const web_app::AppId& app_id,
base::Optional<std::string> icon_big;
base::Optional<std::string> icon_small;
if (HasMatchingOrGreaterThanIcon(registrar.GetAppIconInfos(app_id),
if (HasMatchingOrGreaterThanIcon(registrar.GetAppDownloadedIconSizes(app_id),
kWebAppIconLargeNonDefault)) {
icon_big =
apps::AppIconSource::GetIconURL(app_id, kWebAppIconLargeNonDefault)
.spec();
}
if (HasMatchingOrGreaterThanIcon(registrar.GetAppIconInfos(app_id),
if (HasMatchingOrGreaterThanIcon(registrar.GetAppDownloadedIconSizes(app_id),
kWebAppIconSmallNonDefault)) {
icon_small =
apps::AppIconSource::GetIconURL(app_id, kWebAppIconSmallNonDefault)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment