| 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 2ccefe712e54428283d129d44751f583a389ca6d..eb62dce888250ad0d4d4c6698980c3bda2bc448a 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.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;
|
| @@ -68,6 +69,8 @@
|
| private final int mStartPaddingWithoutButtons;
|
| private boolean mShouldAnimateButtonVisibilityChange;
|
| private AnimatorSet mButtonVisibilityAnimators;
|
| +
|
| + private NewTabPage mVisibleNtp;
|
|
|
| /**
|
| * Constructs a ToolbarTablet object.
|
| @@ -337,6 +340,38 @@
|
| }
|
| 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);
|
| + mVisibleNtp.setSearchProviderLogoAlpha(alpha);
|
| + }
|
| + });
|
| + }
|
| + }
|
| +
|
| + @Override
|
| + protected void onTabContentViewChanged() {
|
| + super.onTabContentViewChanged();
|
| + updateNtp();
|
| }
|
|
|
| @Override
|
|
|