| 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 acb529e9137622de7e6178b77b6706d6b21d25dc..2d7b839225148c61ac4488e8d628f803784059ae 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
|
| @@ -19,6 +19,7 @@
|
| import org.chromium.chrome.browser.offlinepages.ClientId;
|
| import org.chromium.chrome.browser.offlinepages.OfflinePageBridge;
|
| import org.chromium.chrome.browser.offlinepages.OfflinePageItem;
|
| +import org.chromium.chrome.browser.suggestions.SuggestionsRanker;
|
|
|
| import java.util.ArrayList;
|
| import java.util.Iterator;
|
| @@ -34,6 +35,7 @@
|
| private final Delegate mDelegate;
|
| private final SuggestionsCategoryInfo mCategoryInfo;
|
| private final OfflinePageBridge mOfflinePageBridge;
|
| + private final SuggestionsRanker mSuggestionsRanker;
|
|
|
| // Children
|
| private final SectionHeader mHeader;
|
| @@ -60,15 +62,17 @@
|
| }
|
|
|
| public SuggestionsSection(Delegate delegate, NewTabPageManager manager,
|
| - OfflinePageBridge offlinePageBridge, SuggestionsCategoryInfo info) {
|
| + SuggestionsRanker ranker, OfflinePageBridge offlinePageBridge,
|
| + SuggestionsCategoryInfo info) {
|
| mDelegate = delegate;
|
| mCategoryInfo = info;
|
| mOfflinePageBridge = offlinePageBridge;
|
| + mSuggestionsRanker = ranker;
|
|
|
| mHeader = new SectionHeader(info.getTitle());
|
| mSuggestionsList = new SuggestionsList(manager, info);
|
| mStatus = StatusItem.createNoSuggestionsItem(info);
|
| - mMoreButton = new ActionItem(this);
|
| + mMoreButton = new ActionItem(this, ranker);
|
| mProgressIndicator = new ProgressItem();
|
| addChildren(mHeader, mSuggestionsList, mStatus, mMoreButton, mProgressIndicator);
|
|
|
| @@ -80,7 +84,6 @@ public SuggestionsSection(Delegate delegate, NewTabPageManager manager,
|
| private final List<SnippetArticle> mSuggestions = new ArrayList<>();
|
| private final NewTabPageManager mNewTabPageManager;
|
| private final SuggestionsCategoryInfo mCategoryInfo;
|
| - private int mCategoryIndex;
|
|
|
| public SuggestionsList(NewTabPageManager newTabPageManager,
|
| SuggestionsCategoryInfo categoryInfo) {
|
| @@ -88,14 +91,6 @@ public SuggestionsList(NewTabPageManager newTabPageManager,
|
| mCategoryInfo = categoryInfo;
|
| }
|
|
|
| - public void setCategoryIndex(int categoryIndex) {
|
| - mCategoryIndex = categoryIndex;
|
| - }
|
| -
|
| - public int getCategoryIndex() {
|
| - return mCategoryIndex;
|
| - }
|
| -
|
| @Override
|
| public int getItemCount() {
|
| return mSuggestions.size();
|
| @@ -114,8 +109,7 @@ public void onBindViewHolder(
|
| checkIndex(position);
|
| assert holder instanceof SnippetArticleViewHolder;
|
| ((SnippetArticleViewHolder) holder)
|
| - .onBindViewHolder(
|
| - getSuggestionAt(position), mCategoryInfo, payloads, mCategoryIndex);
|
| + .onBindViewHolder(getSuggestionAt(position), mCategoryInfo, payloads);
|
| }
|
|
|
| @Override
|
| @@ -359,6 +353,7 @@ public void setSuggestions(List<SnippetArticle> suggestions, @CategoryStatusEnum
|
| mSuggestionsList.addAll(suggestions);
|
|
|
| for (SnippetArticle article : suggestions) {
|
| + mSuggestionsRanker.rankSuggestion(article);
|
| if (!article.requiresExactOfflinePage()) {
|
| updateSnippetOfflineAvailability(article);
|
| }
|
| @@ -436,14 +431,6 @@ public SuggestionsCategoryInfo getCategoryInfo() {
|
| return mCategoryInfo;
|
| }
|
|
|
| - public int getCategoryIndex() {
|
| - return mSuggestionsList.getCategoryIndex();
|
| - }
|
| -
|
| - public void setCategoryIndex(int categoryIndex) {
|
| - mSuggestionsList.setCategoryIndex(categoryIndex);
|
| - }
|
| -
|
| public String getHeaderText() {
|
| return mHeader.getHeaderText();
|
| }
|
|
|