Index: chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/NewTabPageRecyclerView.java |
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/NewTabPageRecyclerView.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/NewTabPageRecyclerView.java |
index d9f4470a5eb28af3edd95a0305c919af43bca071..99b19a5cd123b66aab5292c3b1639aa883630f86 100644 |
--- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/NewTabPageRecyclerView.java |
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/NewTabPageRecyclerView.java |
@@ -257,6 +257,18 @@ public class NewTabPageRecyclerView extends RecyclerView { |
} |
/** |
+ * Returns the approximate adapter position that the user has scrolled to. The purpose of this |
+ * value is that it can be stored and later retrieved to restore a scroll position that is |
+ * familiar to the user, showing (part of) the same content the user was previously looking at. |
+ * This position is valid for that purpose regardless of device orientation changes. Note that |
+ * if the underlying data has changed in the meantime, different content would be shown for this |
+ * position. |
+ */ |
+ public int getScrollPosition() { |
+ return mLayoutManager.findFirstVisibleItemPosition(); |
+ } |
+ |
+ /** |
* Finds the view holder for the first header. |
* @return The {@code ViewHolder} of the header, or null if it is not present. |
*/ |