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

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

Issue 2639533003: [Content suggestions] Report updates in the UI to UMA. (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | tools/metrics/histograms/histograms.xml » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 088ee0ac5b9c8190e1ce233fe6a6d697bf86370b..c7858e8ebc7230a463bbf36eac4bc43e3eafcf53 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
@@ -7,6 +7,7 @@ package org.chromium.chrome.browser.ntp.cards;
import org.chromium.base.Callback;
import org.chromium.base.Log;
import org.chromium.base.VisibleForTesting;
+import org.chromium.base.metrics.RecordHistogram;
import org.chromium.chrome.browser.ntp.NewTabPage.DestructionObserver;
import org.chromium.chrome.browser.ntp.NewTabPageView.NewTabPageManager;
import org.chromium.chrome.browser.ntp.snippets.CategoryInt;
@@ -29,6 +30,15 @@ import java.util.List;
* responsible for tracking whether its suggestions have been saved offline.
*/
public class SuggestionsSection extends InnerNode {
+ // UMA histogram values for the fullscreen controls the user could tap.
+ // Keep in sync with the MediaCommand enum in histograms.xml
+ public static final int UI_UPDATE_FIRST_TIME = 0;
+ public static final int UI_UPDATE_REPLACE_ALL = 1;
rkaplow 2017/01/17 23:12:12 i noticed the name of this is a bit different from
jkrcal 2017/01/19 18:31:47 Tried to make it consistent, now.
+ public static final int UI_UPDATE_REPLACE_SUBSEQUENT = 2;
+ public static final int UI_UPDATE_NOT_POSSIBLE = 3;
+ public static final int UI_UPDATE_DISABLED = 4;
+ public static final int UI_UPDATE_COUNT = 5;
rkaplow 2017/01/17 23:12:12 may want a comment calling out that UI_UPDATE_COUN
jkrcal 2017/01/19 18:31:47 Done.
+
private static final String TAG = "NtpCards";
private final Delegate mDelegate;
@@ -321,9 +331,18 @@ public class SuggestionsSection extends InnerNode {
// Remove suggestions to be replaced.
if (replaceExisting && hasSuggestions()) {
- if (CardsVariationParameters.ignoreUpdatesForExistingSuggestions()
- || mSubsequentSuggestionsSeen) {
- Log.d(TAG, "setSuggestions: replacing existing suggestion not possible");
+ if (CardsVariationParameters.ignoreUpdatesForExistingSuggestions()) {
+ Log.d(TAG, "setSuggestions: replacing existing suggestion disabled");
+ RecordHistogram.recordEnumeratedHistogram(
+ "NewTabPage.ContentSuggestions.UIUpdateStatus", UI_UPDATE_DISABLED,
+ UI_UPDATE_COUNT);
+ return;
+ }
+ if (mSubsequentSuggestionsSeen) {
+ Log.d(TAG, "setSuggestions: replacing existing suggestion not possible any more");
+ RecordHistogram.recordEnumeratedHistogram(
+ "NewTabPage.ContentSuggestions.UIUpdateStatus", UI_UPDATE_NOT_POSSIBLE,
+ UI_UPDATE_COUNT);
return;
}
@@ -338,10 +357,20 @@ public class SuggestionsSection extends InnerNode {
if (!suggestions.remove(mSuggestionsList.getSuggestionAt(0))) {
suggestions.remove(suggestions.size() - 1);
}
+ RecordHistogram.recordEnumeratedHistogram(
+ "NewTabPage.ContentSuggestions.UIUpdateStatus",
dgn 2017/01/18 11:27:55 can this be a constant? or wrapped in a method? if
jkrcal 2017/01/19 18:31:47 Thanks, done. Moved to NewTabPageUma.java.
+ UI_UPDATE_REPLACE_SUBSEQUENT, UI_UPDATE_COUNT);
} else {
Log.d(TAG, "setSuggestions: removing all suggestions");
mSuggestionsList.clear();
+ RecordHistogram.recordEnumeratedHistogram(
+ "NewTabPage.ContentSuggestions.UIUpdateStatus", UI_UPDATE_REPLACE_ALL,
+ UI_UPDATE_COUNT);
}
+ } else {
+ RecordHistogram.recordEnumeratedHistogram(
+ "NewTabPage.ContentSuggestions.UIUpdateStatus", UI_UPDATE_FIRST_TIME,
+ UI_UPDATE_COUNT);
}
mProgressIndicator.setVisible(SnippetsBridge.isCategoryLoading(status));
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | tools/metrics/histograms/histograms.xml » ('J')

Powered by Google App Engine
This is Rietveld 408576698