| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.chrome.browser.favicon; | 5 package org.chromium.chrome.browser.favicon; |
| 6 | 6 |
| 7 import android.graphics.Bitmap; | 7 import android.graphics.Bitmap; |
| 8 import android.support.annotation.Nullable; |
| 8 import android.util.LruCache; | 9 import android.util.LruCache; |
| 9 | 10 |
| 10 import org.chromium.base.annotations.CalledByNative; | 11 import org.chromium.base.annotations.CalledByNative; |
| 11 import org.chromium.chrome.browser.profiles.Profile; | 12 import org.chromium.chrome.browser.profiles.Profile; |
| 12 | 13 |
| 13 /** | 14 /** |
| 14 * A Java API for using the C++ LargeIconService. | 15 * A Java API for using the C++ LargeIconService. |
| 15 * | 16 * |
| 16 * An instance of this class must be created, used, and destroyed on the same th
read. | 17 * An instance of this class must be created, used, and destroyed on the same th
read. |
| 17 */ | 18 */ |
| (...skipping 20 matching lines...) Expand all Loading... |
| 38 * Callback for use with GetLargeIconForUrl(). | 39 * Callback for use with GetLargeIconForUrl(). |
| 39 */ | 40 */ |
| 40 public interface LargeIconCallback { | 41 public interface LargeIconCallback { |
| 41 /** | 42 /** |
| 42 * Called when the icon or fallback color is available. | 43 * Called when the icon or fallback color is available. |
| 43 * | 44 * |
| 44 * @param icon The icon, or null if none is available. | 45 * @param icon The icon, or null if none is available. |
| 45 * @param fallbackColor The fallback color to use if icon is null. | 46 * @param fallbackColor The fallback color to use if icon is null. |
| 46 */ | 47 */ |
| 47 @CalledByNative("LargeIconCallback") | 48 @CalledByNative("LargeIconCallback") |
| 48 void onLargeIconAvailable(Bitmap icon, int fallbackColor, boolean isFall
backColorDefault); | 49 void onLargeIconAvailable( |
| 50 @Nullable Bitmap icon, int fallbackColor, boolean isFallbackColo
rDefault); |
| 49 } | 51 } |
| 50 | 52 |
| 51 /** | 53 /** |
| 52 * Initializes the C++ side of this class. | 54 * Initializes the C++ side of this class. |
| 53 * @param profile Profile to use when fetching icons. | 55 * @param profile Profile to use when fetching icons. |
| 54 */ | 56 */ |
| 55 public LargeIconBridge(Profile profile) { | 57 public LargeIconBridge(Profile profile) { |
| 56 mNativeLargeIconBridge = nativeInit(); | 58 mNativeLargeIconBridge = nativeInit(); |
| 57 mProfile = profile; | 59 mProfile = profile; |
| 58 } | 60 } |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 return nativeGetLargeIconForURL(mNativeLargeIconBridge, mProfile, pa
geUrl, | 127 return nativeGetLargeIconForURL(mNativeLargeIconBridge, mProfile, pa
geUrl, |
| 126 desiredSizePx, callbackWrapper); | 128 desiredSizePx, callbackWrapper); |
| 127 } | 129 } |
| 128 } | 130 } |
| 129 | 131 |
| 130 private static native long nativeInit(); | 132 private static native long nativeInit(); |
| 131 private static native void nativeDestroy(long nativeLargeIconBridge); | 133 private static native void nativeDestroy(long nativeLargeIconBridge); |
| 132 private static native boolean nativeGetLargeIconForURL(long nativeLargeIconB
ridge, | 134 private static native boolean nativeGetLargeIconForURL(long nativeLargeIconB
ridge, |
| 133 Profile profile, String pageUrl, int desiredSizePx, LargeIconCallbac
k callback); | 135 Profile profile, String pageUrl, int desiredSizePx, LargeIconCallbac
k callback); |
| 134 } | 136 } |
| OLD | NEW |