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

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

Issue 2715433008: 🏡 Add a ChromeHomeNewTabPage (Closed)
Patch Set: Cancel inprogress animation when FBV disabled Created 3 years, 10 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/LogoView.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/LogoView.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/LogoView.java
index 0bf53e9ea7037adc39357ea5924de151f52e4292..38c4db99569d956050073a85d41f6b5c1ce679f2 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/LogoView.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/LogoView.java
@@ -24,7 +24,7 @@ import android.widget.FrameLayout;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.ntp.LogoBridge.Logo;
-import org.chromium.chrome.browser.ntp.NewTabPageView.NewTabPageManager;
+import org.chromium.chrome.browser.ntp.LogoBridge.LogoObserver;
import org.chromium.chrome.browser.widget.LoadingView;
import java.lang.ref.WeakReference;
@@ -67,7 +67,7 @@ public class LogoView extends FrameLayout implements OnClickListener {
*/
private float mTransitionAmount;
- private NewTabPageManager mManager;
+ private Delegate mDelegate;
private final Property<LogoView, Float> mTransitionProperty =
new Property<LogoView, Float>(Float.class, "") {
@@ -88,6 +88,28 @@ public class LogoView extends FrameLayout implements OnClickListener {
};
/**
+ * Handles tasks for the {@link LogoView} shown on an NTP.
+ */
+ public interface Delegate {
+ /**
+ * Called when the user clicks on the logo.
+ * @param isAnimatedLogoShowing Whether the animated GIF logo is playing.
+ */
+ void onLogoClicked(boolean isAnimatedLogoShowing);
+
+ /**
+ * Gets the default search provider's logo and calls logoObserver with the result.
+ * @param logoObserver The callback to notify when the logo is available.
+ */
+ void getSearchProviderLogo(LogoObserver logoObserver);
+
+ /**
+ * Should be called when the owning class is destroyed.
+ */
+ void destroy();
+ }
+
+ /**
* Constructor used to inflate a LogoView from XML.
*/
public LogoView(Context context, AttributeSet attrs) {
@@ -115,10 +137,10 @@ public class LogoView extends FrameLayout implements OnClickListener {
}
/**
- * Sets the NewTabPageManager to notify when the logo is pressed.
+ * Sets the {@link Delegate} to notify when the logo is pressed.
*/
- public void setMananger(NewTabPageManager manager) {
- mManager = manager;
+ public void setDelegate(Delegate delegate) {
+ mDelegate = delegate;
}
/**
@@ -321,8 +343,8 @@ public class LogoView extends FrameLayout implements OnClickListener {
@Override
public void onClick(View view) {
- if (view == this && mManager != null && !isTransitioning()) {
- mManager.onLogoClicked(isAnimatedLogoShowing());
+ if (view == this && mDelegate != null && !isTransitioning()) {
+ mDelegate.onLogoClicked(isAnimatedLogoShowing());
}
}
}

Powered by Google App Engine
This is Rietveld 408576698