Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(823)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/SuggestionsSection.java

Issue 2618893003: 📰 Tweak the suggestion ranks for UMA to handle fetchMore (Closed)
Patch Set: rebase and fix findbugs warning Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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) {

Powered by Google App Engine
This is Rietveld 408576698