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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPage.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
Index: chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPage.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPage.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPage.java
index 2edbf6eaf404192a0a77899c15165133e9f358f4..8b6bfe967a6313911322882420ed1703d92acebc 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPage.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPage.java
@@ -10,6 +10,7 @@ import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Rect;
+import android.text.TextUtils;
import android.view.ContextMenu;
import android.view.LayoutInflater;
import android.view.Menu;
@@ -55,6 +56,8 @@ import org.chromium.ui.base.PageTransition;
import java.util.concurrent.TimeUnit;
+import jp.tomorrowkey.android.gifplayer.BaseGifImage;
+
/**
* Provides functionality when the user interacts with the NTP.
*/
@@ -87,6 +90,7 @@ public class NewTabPage
private boolean mSearchProviderHasLogo;
private final boolean mOptOutPromoShown;
private String mOnLogoClickUrl;
+ private String mGifUrl;
newt (away) 2015/09/18 20:46:02 Call this "mAnimatedLogoUrl". Yes, it's a gif, but
Ian Wen 2015/09/22 21:39:06 Done.
private FakeboxDelegate mFakeboxDelegate;
// The timestamp at which the constructor was called.
@@ -353,7 +357,17 @@ public class NewTabPage
public void openLogoLink() {
if (mIsDestroyed) return;
if (mOnLogoClickUrl == null) return;
newt (away) 2015/09/18 20:46:02 This check should be moved inside the if clause be
Ian Wen 2015/09/22 21:39:06 Done.
- mTab.loadUrl(new LoadUrlParams(mOnLogoClickUrl, PageTransition.LINK));
+
+ if (TextUtils.isEmpty(mGifUrl) || mNewTabPageView.isGifPlaying()) {
newt (away) 2015/09/18 20:46:02 I'd rename this method to onLogoClicked() since it
Ian Wen 2015/09/22 21:39:06 Done.
+ mTab.loadUrl(new LoadUrlParams(mOnLogoClickUrl, PageTransition.LINK));
+ } else {
+ mLogoBridge.getGif(new LogoBridge.GifListener() {
+ @Override
+ public void onGifDownloaded(byte[] bytes) {
newt (away) 2015/09/18 20:46:02 add "if (mIsDestroyed) return;" or "assert !mIsDes
Ian Wen 2015/09/22 21:39:06 Done.
+ mNewTabPageView.updateLogoGif(new BaseGifImage(bytes));
+ }
+ }, mGifUrl);
+ }
}
@Override
@@ -364,6 +378,7 @@ public class NewTabPage
public void onLogoAvailable(Logo logo, boolean fromCache) {
if (mIsDestroyed) return;
mOnLogoClickUrl = logo != null ? logo.onClickUrl : null;
+ mGifUrl = logo != null ? logo.gifUrl : null;
logoObserver.onLogoAvailable(logo, fromCache);
}
};

Powered by Google App Engine
This is Rietveld 408576698