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

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: try skipping UMA for test 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 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) {

Powered by Google App Engine
This is Rietveld 408576698