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

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

Issue 2106753002: Refine snap scrolling on the Cards New Tab Page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update comment. Created 4 years, 6 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/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 aa41d50352aeff1b8ec8469d815ffb13d68d3e8f..5480867fcf8c70d894ca7872719143c8c1f94608 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
@@ -10,7 +10,6 @@ import android.support.annotation.IntDef;
import org.chromium.base.metrics.RecordHistogram;
import org.chromium.base.metrics.RecordUserAction;
import org.chromium.chrome.browser.UrlConstants;
-import org.chromium.chrome.browser.ntp.cards.NewTabPageListItem;
import org.chromium.chrome.browser.rappor.RapporServiceBridge;
import org.chromium.chrome.browser.tab.EmptyTabObserver;
import org.chromium.chrome.browser.tab.Tab;
@@ -71,7 +70,7 @@ public class NewTabPageUma {
* Do not remove or change existing values other than NUM_SNIPPETS_ACTIONS. */
@IntDef({SNIPPETS_ACTION_SHOWN, SNIPPETS_ACTION_SCROLLED, SNIPPETS_ACTION_CLICKED,
SNIPPETS_ACTION_DISMISSED_OBSOLETE, SNIPPETS_ACTION_DISMISSED_VISITED,
- SNIPPETS_ACTION_DISMISSED_UNVISITED, SNIPPETS_ACTION_SCROLLED_BELOW_THE_FOLD_ONCE})
+ SNIPPETS_ACTION_DISMISSED_UNVISITED})
@Retention(RetentionPolicy.SOURCE)
public @interface SnippetsAction {}
/** Snippets are enabled and are being shown to the user. */
@@ -86,8 +85,8 @@ public class NewTabPageUma {
public static final int SNIPPETS_ACTION_DISMISSED_VISITED = 4;
/** A snippet has been swiped away, it had not been viewed by the user (on this device). */
public static final int SNIPPETS_ACTION_DISMISSED_UNVISITED = 5;
- /** The snippet list has been scrolled below the fold (once per NTP load). */
- public static final int SNIPPETS_ACTION_SCROLLED_BELOW_THE_FOLD_ONCE = 6;
+ /** Obsolete. The snippet list has been scrolled below the fold (once per NTP load). */
+ // public static final int SNIPPETS_ACTION_SCROLLED_BELOW_THE_FOLD_ONCE = 6;
/** The number of possible actions. */
private static final int NUM_SNIPPETS_ACTIONS = 7;
@@ -184,44 +183,6 @@ public class NewTabPageUma {
}
/**
- * Snap state representing which part of the NTP the user is reading.
- */
- public enum SnapState {
- ABOVE_THE_FOLD,
- BELOW_THE_FOLD,
- }
-
- /**
- * Snap state observer that records UMA actions or histograms.
- */
- public static class SnapStateObserver {
- private SnapState mSnapState = SnapState.ABOVE_THE_FOLD;
- private boolean mEverBelowTheFold = false;
-
- public void updateSnapState(NewTabPageView newTabPageView, SnapState state) {
- if (state == mSnapState) return;
- mSnapState = state;
-
- switch (state) {
- case ABOVE_THE_FOLD:
- RecordUserAction.record("MobileNTP.Snippets.ScrolledAboveTheFold");
- break;
- case BELOW_THE_FOLD:
- RecordUserAction.record("MobileNTP.Snippets.ScrolledBelowTheFold");
- if (!mEverBelowTheFold) {
- mEverBelowTheFold = true;
- recordSnippetAction(SNIPPETS_ACTION_SCROLLED_BELOW_THE_FOLD_ONCE);
- RecordHistogram.recordSparseSlowlyHistogram(
- "NewTabPage.Snippets.NumArticlesOnScrolledBelowTheFoldOnce",
- newTabPageView.getViewCountMatchingViewType(
- NewTabPageListItem.VIEW_TYPE_SNIPPET));
- }
- break;
- }
- }
- }
-
- /**
* Records stats related to article visits, such as the time spent on the website, or if the
* user comes back to the NTP. Use through {@link NewTabPageUma#monitorVisit(Tab)}.
*/

Powered by Google App Engine
This is Rietveld 408576698