Index: chrome/android/java/src/org/chromium/chrome/browser/favicon/LargeIconBridge.java |
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/favicon/LargeIconBridge.java b/chrome/android/java/src/org/chromium/chrome/browser/favicon/LargeIconBridge.java |
index e1017c99497c4bf50a0f82f0ac141deb3b551de8..4faae1386478149748064b46581df9d416b87f5e 100644 |
--- a/chrome/android/java/src/org/chromium/chrome/browser/favicon/LargeIconBridge.java |
+++ b/chrome/android/java/src/org/chromium/chrome/browser/favicon/LargeIconBridge.java |
@@ -21,7 +21,7 @@ public class LargeIconBridge { |
private static final int CACHE_ENTRY_MIN_SIZE_BYTES = 1024; |
private long mNativeLargeIconBridge; |
private Profile mProfile; |
- private LruCache<String, Pair<Bitmap, Integer>> mFaviconCache; |
+ private LruCache<String, Pair<Bitmap, Pair<Integer, Boolean>>> mFaviconCache; |
Bernhard Bauer
2016/09/27 16:14:57
This is getting a bit unwieldy... Would it make se
sfiera
2016/09/27 16:50:36
I can do that. Initially I was looking for Tuple3<
sfiera
2016/09/28 13:15:52
Done.
|
/** |
* Callback for use with GetLargeIconForUrl(). |
@@ -34,7 +34,7 @@ public class LargeIconBridge { |
* @param fallbackColor The fallback color to use if icon is null. |
*/ |
@CalledByNative("LargeIconCallback") |
- void onLargeIconAvailable(Bitmap icon, int fallbackColor); |
+ void onLargeIconAvailable(Bitmap icon, int fallbackColor, boolean isDefaultColor); |
} |
/** |
@@ -55,9 +55,9 @@ public class LargeIconBridge { |
public void createCache(int cacheSizeBytes) { |
assert cacheSizeBytes > 0; |
- mFaviconCache = new LruCache<String, Pair<Bitmap, Integer>>(cacheSizeBytes) { |
+ mFaviconCache = new LruCache<String, Pair<Bitmap, Pair<Integer, Boolean>>>(cacheSizeBytes) { |
@Override |
- protected int sizeOf(String key, Pair<Bitmap, Integer> icon) { |
+ protected int sizeOf(String key, Pair<Bitmap, Pair<Integer, Boolean>> icon) { |
int iconBitmapSize = icon.first == null ? 0 : icon.first.getByteCount(); |
return Math.max(CACHE_ENTRY_MIN_SIZE_BYTES, iconBitmapSize); |
} |
@@ -95,17 +95,21 @@ public class LargeIconBridge { |
return nativeGetLargeIconForURL(mNativeLargeIconBridge, mProfile, pageUrl, |
desiredSizePx, callback); |
} else { |
- Pair<Bitmap, Integer> cached = mFaviconCache.get(pageUrl); |
+ Pair<Bitmap, Pair<Integer, Boolean>> cached = mFaviconCache.get(pageUrl); |
if (cached != null) { |
- callback.onLargeIconAvailable(cached.first, cached.second); |
+ callback.onLargeIconAvailable( |
+ cached.first, cached.second.first, cached.second.second); |
return true; |
} |
LargeIconCallback callbackWrapper = new LargeIconCallback() { |
@Override |
- public void onLargeIconAvailable(Bitmap icon, int fallbackColor) { |
- mFaviconCache.put(pageUrl, new Pair<Bitmap, Integer>(icon, fallbackColor)); |
- callback.onLargeIconAvailable(icon, fallbackColor); |
+ public void onLargeIconAvailable( |
+ Bitmap icon, int fallbackColor, boolean isDefaultColor) { |
pkotwicz
2016/09/28 03:52:52
Nit: I think that things would be clearer if you r
sfiera
2016/09/28 13:15:52
Done.
|
+ mFaviconCache.put(pageUrl, |
+ new Pair<Bitmap, Pair<Integer, Boolean>>(icon, |
+ new Pair<Integer, Boolean>(fallbackColor, isDefaultColor))); |
+ callback.onLargeIconAvailable(icon, fallbackColor, isDefaultColor); |
} |
}; |
return nativeGetLargeIconForURL(mNativeLargeIconBridge, mProfile, pageUrl, |