| 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 33cf29924015c9079503ea1637b8e3f1cc23f9d2..3f244fd119f6f155560c253a1cdcac3d8612c687 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
|
| @@ -300,6 +300,12 @@ void ensureIconIsAvailable(String pageUrl, String iconUrl, boolean isLargeIcon,
|
| * Page goes away.
|
| */
|
| void registerSignInStateObserver(SignInStateObserver signInStateObserver);
|
| +
|
| + /**
|
| + * @return whether the {@link NewTabPage} associated with this manager is the current page
|
| + * displayed to the user.
|
| + */
|
| + boolean isCurrentPage();
|
| }
|
|
|
| /**
|
| @@ -491,6 +497,12 @@ public void onClick(View v) {
|
| private void updateSearchBoxOnScroll() {
|
| if (mDisableUrlFocusChangeAnimations) return;
|
|
|
| + // When the page changes (tab switching or new page loading), it is possible that events
|
| + // (e.g. delayed RecyclerView change notifications) trigger calls to these methods after
|
| + // the current page changes. We check it again to make sure we don't attempt to update the
|
| + // wrong page.
|
| + if (!mManager.isCurrentPage()) return;
|
| +
|
| if (mSearchBoxScrollListener != null) {
|
| mSearchBoxScrollListener.onNtpScrollChanged(getToolbarTransitionPercentage());
|
| }
|
|
|