| Index: chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/SuggestionsSection.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/SuggestionsSection.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/SuggestionsSection.java
|
| index 71b7d4b494b5467d5516b4dd1e75fa1cd1ebb60c..3bcf62e4b8e6537c4626f267576ea337b83f313e 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/SuggestionsSection.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/SuggestionsSection.java
|
| @@ -165,6 +165,14 @@ public void updateSuggestionOfflineId(SnippetArticle article, Long newId) {
|
| notifyItemChanged(mSuggestions.indexOf(article),
|
| SnippetArticleViewHolder.PARTIAL_UPDATE_OFFLINE_ID);
|
| }
|
| +
|
| + /**
|
| + * @return the index of the first suggestion matching {@code suggestion}, or -1 if such
|
| + * an element can't be found.
|
| + */
|
| + public int indexOf(SnippetArticle suggestion) {
|
| + return mSuggestions.indexOf(suggestion);
|
| + }
|
| }
|
|
|
| private void setupOfflinePageBridgeObserver(NewTabPageManager manager) {
|
| @@ -251,6 +259,14 @@ public int getSuggestionsCount() {
|
| return mSuggestionsList.getItemCount();
|
| }
|
|
|
| + /**
|
| + * @return the rank of the provided suggestion among the other suggestions of that section, or
|
| + * -1 if not found.
|
| + */
|
| + public int getSuggestionRank(SnippetArticle suggestion) {
|
| + return mSuggestionsList.indexOf(suggestion);
|
| + }
|
| +
|
| public String[] getDisplayedSuggestionIds() {
|
| String[] suggestionIds = new String[mSuggestionsList.getItemCount()];
|
| for (int i = 0; i < mSuggestionsList.getItemCount(); ++i) {
|
|
|