| Index: chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageUma.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageUma.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageUma.java
|
| index 60681f11fd75211808486b0a13d0461a3f307f39..28edcc41ac84bf1999d389649836d38a7314a463 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageUma.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageUma.java
|
| @@ -4,12 +4,17 @@
|
|
|
| package org.chromium.chrome.browser.ntp;
|
|
|
| +import android.support.annotation.IntDef;
|
| +
|
| import org.chromium.base.metrics.RecordHistogram;
|
| import org.chromium.base.metrics.RecordUserAction;
|
| import org.chromium.chrome.browser.rappor.RapporServiceBridge;
|
| import org.chromium.chrome.browser.util.UrlUtilities;
|
| import org.chromium.ui.base.PageTransition;
|
|
|
| +import java.lang.annotation.Retention;
|
| +import java.lang.annotation.RetentionPolicy;
|
| +
|
| /**
|
| * Records UMA stats for which actions the user takes on the NTP in the
|
| * "NewTabPage.ActionAndroid" histogram.
|
| @@ -46,6 +51,19 @@
|
| // The number of possible actions pertinent to Rappor
|
| private static final int RAPPOR_NUM_ACTIONS = 2;
|
|
|
| + /** Possible interactions with the snippets. */
|
| + @IntDef({SNIPPETS_ACTION_SHOWN, SNIPPETS_ACTION_SCROLLED, SNIPPETS_ACTION_CLICKED})
|
| + @Retention(RetentionPolicy.SOURCE)
|
| + public @interface SnippetsAction {}
|
| + /** Snippets are enabled and are being shown to the user. */
|
| + public static final int SNIPPETS_ACTION_SHOWN = 0;
|
| + /** The snippet list has been scrolled. */
|
| + public static final int SNIPPETS_ACTION_SCROLLED = 1;
|
| + /** A snippet has been clicked. */
|
| + public static final int SNIPPETS_ACTION_CLICKED = 2;
|
| + /** The number of possible actions. */
|
| + private static final int NUM_SNIPPETS_ACTIONS = 3;
|
| +
|
| /**
|
| * Records an action taken by the user on the NTP.
|
| * @param action One of the ACTION_* values defined in this class.
|
| @@ -108,4 +126,13 @@ public static void recordExplicitUserNavigation(String destinationUrl, int rappo
|
| return;
|
| }
|
| }
|
| +
|
| + /**
|
| + * Records important events related to snippets.
|
| + * @param action action key, one of {@link SnippetsAction}'s values.
|
| + */
|
| + public static void recordSnippetAction(@SnippetsAction int action) {
|
| + RecordHistogram.recordEnumeratedHistogram(
|
| + "NewTabPage.Snippets.Interactions", action, NUM_SNIPPETS_ACTIONS);
|
| + }
|
| }
|
|
|