Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2809)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/favicon/FaviconHelper.java

Issue 1272883004: Popular sites on the NTP: Favicons! (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@enable_popular_sites
Patch Set: . Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/favicon/FaviconHelper.java
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 1b35bc948ff644a9d761503741d0047d5e64b81b..2ce0a8a39649a11406e93b7fdcae382659b3ffb9 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
@@ -9,6 +9,7 @@ import android.graphics.Color;
import org.chromium.base.annotations.CalledByNative;
import org.chromium.chrome.browser.profiles.Profile;
+import org.chromium.content_public.browser.WebContents;
/**
* This is a helper class to use favicon_service.cc's functionality.
@@ -42,6 +43,19 @@ public class FaviconHelper {
}
/**
+ * Callback interface for the result of the ensureFaviconIsAvailable method.
+ */
+ public interface FaviconAvailabilityCallback {
+ /**
+ * This method will be called when the availability of the favicon has been checked.
+ * @param newlyAvailable true if the favicon was downloaded and is now available,
+ * false if the favicon was already there or the download failed.
+ */
+ @CalledByNative("FaviconAvailabilityCallback")
+ public void onFaviconAvailabilityChecked(boolean newlyAvailable);
+ }
+
+ /**
* Allocate and initialize the C++ side of this class.
*/
public FaviconHelper() {
@@ -124,6 +138,13 @@ public class FaviconHelper {
return nativeGetSyncedFaviconImageForURL(mNativeFaviconHelper, profile, pageUrl);
}
+ public void ensureFaviconIsAvailable(
+ Profile profile, WebContents webContents, String pageUrl, String faviconUrl,
+ FaviconAvailabilityCallback callback) {
+ nativeEnsureFaviconIsAvailable(
+ mNativeFaviconHelper, profile, webContents, pageUrl, faviconUrl, callback);
+ }
+
private static native long nativeInit();
private static native void nativeDestroy(long nativeFaviconHelper);
private static native boolean nativeGetLocalFaviconImageForURL(long nativeFaviconHelper,
@@ -135,4 +156,7 @@ public class FaviconHelper {
private static native Bitmap nativeGetSyncedFaviconImageForURL(long nativeFaviconHelper,
Profile profile, String pageUrl);
private static native int nativeGetDominantColorForBitmap(Bitmap image);
+ private static native void nativeEnsureFaviconIsAvailable(
+ long nativeFaviconHelper, Profile profile, WebContents webContents, String pageUrl,
+ String faviconUrl, FaviconAvailabilityCallback callback);
}

Powered by Google App Engine
This is Rietveld 408576698