Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/SectionList.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/SectionList.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/SectionList.java |
| index c4ecfd880faeb8c229a9edc9d5489d7c293eb21d..f75a9f3f8537b4920e58d24840cff1c6c54bf487 100644 |
| --- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/SectionList.java |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/SectionList.java |
| @@ -51,7 +51,7 @@ public class SectionList |
| SuggestionsSource suggestionsSource = mNewTabPageManager.getSuggestionsSource(); |
| int[] categories = suggestionsSource.getCategories(); |
| int[] suggestionsPerCategory = new int[categories.length]; |
| - int i = 0; |
| + int categoryIndex = 0; |
| for (int category : categories) { |
| int categoryStatus = suggestionsSource.getCategoryStatus(category); |
| if (categoryStatus == CategoryStatus.LOADING_ERROR |
| @@ -59,8 +59,11 @@ public class SectionList |
| || categoryStatus == CategoryStatus.CATEGORY_EXPLICITLY_DISABLED) |
| continue; |
| - suggestionsPerCategory[i++] = |
| + suggestionsPerCategory[categoryIndex] = |
| resetSection(category, categoryStatus, alwaysAllowEmptySections); |
| + SuggestionsSection section = mSections.get(category); |
| + if (section != null) section.setCategoryIndex(categoryIndex); |
|
dgn
2017/01/17 17:53:18
here, we can decide not to show a section because
|
| + ++categoryIndex; |
| } |
| mNewTabPageManager.trackSnippetsPageImpression(categories, suggestionsPerCategory); |