Index: chrome/android/java/src/org/chromium/chrome/browser/ntp/LogoBridge.java |
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/LogoBridge.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/LogoBridge.java |
index cf2937d62c70aefdcfc75c4d139763be192ad4a1..51c0f1fc7bbd21b290bfff4e92428ed40e5d4b10 100644 |
--- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/LogoBridge.java |
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/LogoBridge.java |
@@ -9,6 +9,8 @@ import android.graphics.Bitmap; |
import org.chromium.base.annotations.CalledByNative; |
import org.chromium.chrome.browser.profiles.Profile; |
+import jp.tomorrowkey.android.gifplayer.BaseGifImage; |
+ |
/** |
* Provides access to the search provider's logo via the C++ LogoService. |
*/ |
@@ -33,10 +35,16 @@ class LogoBridge { |
*/ |
public final String altText; |
- Logo(Bitmap image, String onClickUrl, String altText) { |
+ /** |
+ * The URL to download animated GIF logo. If null, there is no animated logo to download. |
+ */ |
+ public final String animatedLogoUrl; |
+ |
+ Logo(Bitmap image, String onClickUrl, String altText, String animatedLogoUrl) { |
this.image = image; |
this.onClickUrl = onClickUrl; |
this.altText = altText; |
+ this.animatedLogoUrl = animatedLogoUrl; |
} |
} |
@@ -55,6 +63,20 @@ class LogoBridge { |
void onLogoAvailable(Logo logo, boolean fromCache); |
} |
+ /** |
+ * A callback that is called when the animated logo is successfully downloaded. |
+ */ |
+ interface AnimatedLogoCallback { |
+ |
+ /** |
+ * Called when the animated GIF logo is successfully downloaded. |
+ * |
+ * @param animatedLogoImage The {@link BaseGifImage} representing the animated logo. |
+ */ |
+ @CalledByNative("AnimatedLogoCallback") |
+ void onAnimatedLogoAvailable(BaseGifImage animatedLogoImage); |
+ } |
+ |
private long mNativeLogoBridge; |
/** |
@@ -87,12 +109,30 @@ class LogoBridge { |
nativeGetCurrentLogo(mNativeLogoBridge, logoObserver); |
} |
+ /** |
+ * Downloads an animated GIF logo. The given callback will not be called if the download failed |
+ * or there is already an ongoing url fetching for the same url. |
+ * |
+ * @param callback The callback to be called when the animated logo is successfully downloaded. |
+ * @param animatedLogoUrl The url from which to download the animated GIF logo. |
+ */ |
+ void getAnimatedLogo(AnimatedLogoCallback callback, String animatedLogoUrl) { |
+ nativeGetAnimatedLogo(mNativeLogoBridge, callback, animatedLogoUrl); |
+ } |
+ |
+ @CalledByNative |
+ private static Logo createLogo(Bitmap image, String onClickUrl, String altText, String gifUrl) { |
+ return new Logo(image, onClickUrl, altText, gifUrl); |
+ } |
+ |
@CalledByNative |
- private static Logo createLogo(Bitmap image, String onClickUrl, String altText) { |
- return new Logo(image, onClickUrl, altText); |
+ private static BaseGifImage createGifImage(byte[] bytes) { |
+ return new BaseGifImage(bytes); |
} |
private native long nativeInit(Profile profile); |
private native void nativeGetCurrentLogo(long nativeLogoBridge, LogoObserver logoObserver); |
+ private native void nativeGetAnimatedLogo(long nativeLogoBridge, AnimatedLogoCallback callback, |
+ String gifUrl); |
private native void nativeDestroy(long nativeLogoBridge); |
} |