Commit dd222366 authored by galinap's avatar galinap Committed by Commit Bot

[Suggestions] Set desired size when fetching a favicon image.

This CL reverts a change that was made in
https://chromium-review.googlesource.com/c/519422.
Namely, the desired size when fetching a favicon image has to be set to
32px. Even though the image will not be resized in the c++, this provides
information to the c++ side about what image to fetch from the server.

Bug: 715477
Change-Id: Iadb89de97cdc7ab0e188b95bd8fbae63de271bb5
Reviewed-on: https://chromium-review.googlesource.com/593947Reviewed-by: default avatarJan Krcal <jkrcal@chromium.org>
Reviewed-by: default avatarNicolas Dossou-Gbété <dgn@chromium.org>
Commit-Queue: Galia Peycheva <galinap@google.com>
Cr-Commit-Position: refs/heads/master@{#490774}
parent 5b0f1e22
......@@ -47,8 +47,12 @@ public class ImageFetcher {
private static final int[] FAVICON_SERVICE_SUPPORTED_SIZES = {16, 24, 32, 48, 64};
private static final String FAVICON_SERVICE_FORMAT =
"https://s2.googleusercontent.com/s2/favicons?domain=%s&src=chrome_newtab_mobile&sz=%d&alt=404";
/** Min size for site attribution: only 16px as many sites do not have any other small icon. */
private static final int PUBLISHER_FAVICON_MINIMUM_SIZE_PX = 16;
/** Desired size for site attribution: only 32px as larger icons are often too complex */
private static final int PUBLISHER_FAVICON_DESIRED_SIZE_PX = 32;
private final boolean mUseFaviconService;
private final NativePageHost mHost;
......@@ -199,9 +203,10 @@ public class ImageFetcher {
private void fetchFaviconFromLocalCacheOrGoogleServer(SnippetArticle suggestion,
final long faviconFetchStartTimeMs, final Callback<Bitmap> faviconCallback) {
// Set the desired size to 0 to specify we do not want to resize in c++, we'll resize here.
// The bitmap will not be resized to desired size in c++, this only expresses preference
// as to what image to be fetched from the server.
mSuggestionsSource.fetchSuggestionFavicon(suggestion, PUBLISHER_FAVICON_MINIMUM_SIZE_PX,
/* desiredSizePx */ 0, new Callback<Bitmap>() {
PUBLISHER_FAVICON_DESIRED_SIZE_PX, new Callback<Bitmap>() {
@Override
public void onResult(Bitmap image) {
SuggestionsMetrics.recordArticleFaviconFetchTime(
......
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