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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/ntp/LogoBridge.java

Issue 1343913002: Introduce Animated Logo to Chrome on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « chrome/android/BUILD.gn ('k') | chrome/android/java/src/org/chromium/chrome/browser/ntp/LogoView.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« no previous file with comments | « chrome/android/BUILD.gn ('k') | chrome/android/java/src/org/chromium/chrome/browser/ntp/LogoView.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698