| 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 b83ab1dfb013cf53a32f5caf8ef2aadc21bdf81d..ca9c3b56012bd14ebbfbe84d870a3cf03f1cd09a 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
|
| @@ -155,6 +155,14 @@ public void dismissItem(int position, Callback<String> itemRemovedCallback) {
|
| suggestionsSource.dismissSuggestion(suggestion);
|
| itemRemovedCallback.onResult(suggestion.mTitle);
|
| }
|
| +
|
| + /**
|
| + * @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) {
|
| @@ -241,6 +249,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) {
|
|
|