| Index: chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarTablet.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarTablet.java b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarTablet.java
|
| index 6dc4385b1c2b8e892f42e4f6e2683bd2f8fa9e01..6cfdb0623b2c0594dd1b58ef46cca1b0275da547 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarTablet.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarTablet.java
|
| @@ -21,6 +21,7 @@ import org.chromium.chrome.R;
|
| import org.chromium.chrome.browser.ChromeSwitches;
|
| import org.chromium.chrome.browser.NavigationPopup;
|
| import org.chromium.chrome.browser.device.DeviceClassManager;
|
| +import org.chromium.chrome.browser.ntp.NewTabPage;
|
| import org.chromium.chrome.browser.omnibox.LocationBar;
|
| import org.chromium.chrome.browser.omnibox.LocationBarTablet;
|
| import org.chromium.chrome.browser.partnercustomizations.HomepageManager;
|
| @@ -69,6 +70,8 @@ public class ToolbarTablet extends ToolbarLayout implements OnClickListener {
|
| private boolean mShouldAnimateButtonVisibilityChange;
|
| private AnimatorSet mButtonVisibilityAnimators;
|
|
|
| + private NewTabPage mVisibleNtp;
|
| +
|
| /**
|
| * Constructs a ToolbarTablet object.
|
| * @param context The Context in which this View object is created.
|
| @@ -337,6 +340,37 @@ public class ToolbarTablet extends ToolbarLayout implements OnClickListener {
|
| }
|
| mUseLightColorAssets = incognito;
|
| }
|
| +
|
| + updateNtp();
|
| + }
|
| +
|
| + /**
|
| + * Called when the currently visible New Tab Page changes.
|
| + */
|
| + private void updateNtp() {
|
| + NewTabPage newVisibleNtp = getToolbarDataProvider().getNewTabPageForCurrentTab();
|
| + if (mVisibleNtp == newVisibleNtp) return;
|
| +
|
| + if (mVisibleNtp != null) {
|
| + mVisibleNtp.setSearchBoxScrollListener(null);
|
| + }
|
| + mVisibleNtp = newVisibleNtp;
|
| + if (mVisibleNtp != null) {
|
| + mVisibleNtp.setSearchBoxScrollListener(new NewTabPage.OnSearchBoxScrollListener() {
|
| + @Override
|
| + public void onNtpScrollChanged(float scrollPercentage) {
|
| + // Fade the search box out in the first 40% of the scrolling transition.
|
| + float alpha = Math.max(1f - scrollPercentage * 2.5f, 0f);
|
| + mVisibleNtp.setSearchBoxAlpha(alpha);
|
| + }
|
| + });
|
| + }
|
| + }
|
| +
|
| + @Override
|
| + protected void onTabContentViewChanged() {
|
| + super.onTabContentViewChanged();
|
| + updateNtp();
|
| }
|
|
|
| @Override
|
|
|