summaryrefslogtreecommitdiffstats
path: root/chrome/android
diff options
context:
space:
mode:
authortedchoc@chromium.org <tedchoc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-08 03:58:56 +0000
committertedchoc@chromium.org <tedchoc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-08 03:58:56 +0000
commita65a5500e8c6ab173d4a2e39daf5a423b34c20c3 (patch)
tree703dead82a05ab56cd603c2b8a74af162fb98dbb /chrome/android
parent766faca0a3914a7d71a8ec9dccf1273c7524f531 (diff)
downloadchromium_src-a65a5500e8c6ab173d4a2e39daf5a423b34c20c3.zip
chromium_src-a65a5500e8c6ab173d4a2e39daf5a423b34c20c3.tar.gz
chromium_src-a65a5500e8c6ab173d4a2e39daf5a423b34c20c3.tar.bz2
Expose the API to fetch the largest possible favicon.
BUG=365590 Review URL: https://codereview.chromium.org/269313003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@269025 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/android')
-rw-r--r--chrome/android/java/src/org/chromium/chrome/browser/favicon/FaviconHelper.java27
1 files changed, 27 insertions, 0 deletions
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/favicon/FaviconHelper.java b/chrome/android/java/src/org/chromium/chrome/browser/favicon/FaviconHelper.java
index 445efb0..d04a290 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/favicon/FaviconHelper.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/favicon/FaviconHelper.java
@@ -84,6 +84,30 @@ public class FaviconHelper {
}
/**
+ * Fetches the first available favicon for a URL that exceeds the minimum size threshold. If
+ * no favicons are larger (or equal) to the threshold, the largest favicon of any type is
+ * fetched.
+ *
+ * @param profile Profile used for the FaviconService construction.
+ * @param pageUrl The target Page URL to get the favicon.
+ * @param iconTypes The list of icon types (each entry can be a bitmasked collection
+ * of types) that should be fetched in order. As soon as one of
+ * the buckets exceeds the minimum size threshold, that favicon
+ * will be returned.
+ * @param minSizeThresholdPx The size threshold (inclusive) used to early exit out fetching
+ * subsequent favicon types.
+ * @param faviconImageCallback The callback to be notified with the best matching favicon.
+ */
+ public void getLargestRawFaviconForUrl(
+ Profile profile, String pageUrl, int[] iconTypes, int minSizeThresholdPx,
+ FaviconImageCallback faviconImageCallback) {
+ assert mNativeFaviconHelper != 0;
+ nativeGetLargestRawFaviconForUrl(
+ mNativeFaviconHelper, profile, pageUrl, iconTypes, minSizeThresholdPx - 1,
+ faviconImageCallback);
+ }
+
+ /**
* Return the dominant color of a given bitmap in {@link Color} format.
* @param image The bitmap image to find the dominant color for.
* @return The dominant color in {@link Color} format.
@@ -111,6 +135,9 @@ public class FaviconHelper {
private static native boolean nativeGetLocalFaviconImageForURL(long nativeFaviconHelper,
Profile profile, String pageUrl, int iconTypes, int desiredSizeInDip,
FaviconImageCallback faviconImageCallback);
+ private static native void nativeGetLargestRawFaviconForUrl(long nativeFaviconHelper,
+ Profile profile, String pageUrl, int[] iconTypes, int minSizeThresholdPx,
+ FaviconImageCallback faviconImageCallback);
private static native Bitmap nativeGetSyncedFaviconImageForURL(long nativeFaviconHelper,
Profile profile, String pageUrl);
private static native int nativeGetDominantColorForBitmap(Bitmap image);