Index: chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageView.java |
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageView.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageView.java |
index d38d11b1b4c5472ed55982bd8b484868724b5039..35d4abd87f1200160a174aef115569d609af0efb 100644 |
--- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageView.java |
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageView.java |
@@ -118,6 +118,9 @@ public class NewTabPageView extends FrameLayout |
/** @return Whether voice search is enabled and the microphone should be shown. */ |
boolean isVoiceSearchEnabled(); |
+ /** @return Whether the user is signed in. */ |
+ boolean isUserSignedIn(); |
+ |
/** @return Whether the document mode opt out promo should be shown. */ |
boolean shouldShowOptOutPromo(); |
@@ -136,6 +139,9 @@ public class NewTabPageView extends FrameLayout |
/** Opens a given URL in the current tab. */ |
void open(String url); |
+ /** Opens the interests dialog. */ |
+ void navigateToInterests(); |
+ |
/** |
* Animates the search box up into the omnibox and bring up the keyboard. |
* @param beginVoiceSearch Whether to begin a voice search. |
@@ -306,6 +312,12 @@ public class NewTabPageView extends FrameLayout |
mManager.navigateToBookmarks(); |
} |
}); |
+ toolbar.getInterestsButton().setOnClickListener(new View.OnClickListener() { |
+ @Override |
+ public void onClick(View v) { |
+ mManager.navigateToInterests(); |
+ } |
+ }); |
initializeSearchBoxScrollHandling(); |
addOnLayoutChangeListener(this); |
@@ -340,6 +352,13 @@ public class NewTabPageView extends FrameLayout |
} |
}); |
} |
+ |
+ // Set up interests |
+ // TODO(peconn): If the user is not signed in, show Interests button that leads to sign-in. |
+ if (CommandLine.getInstance().hasSwitch(ChromeSwitches.ENABLE_NTP_INTERESTS) |
newt (away)
2015/12/14 21:18:39
Better: add a method isInterestsEnabled() in NewTa
PEConn
2015/12/15 11:50:15
Done.
|
+ && manager.isUserSignedIn()) { |
+ toolbar.getInterestsButton().setVisibility(View.VISIBLE); |
+ } |
} |
private int getTabsMovedIllustration() { |