Commit 93b01331 authored by Dmitry Titov's avatar Dmitry Titov Committed by Commit Bot

[Explore Sites]: Add missing UserActions UMA reporting for the next round of experiments.

Change-Id: I5f4a016bb924eaf227f4df23b1ffae37bc02cc87
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1625815
Commit-Queue: Justin DeWitt <dewittj@chromium.org>
Reviewed-by: default avatarJustin DeWitt <dewittj@chromium.org>
Reviewed-by: default avatarBrian White <bcwhite@chromium.org>
Cr-Commit-Position: refs/heads/master@{#662824}
parent e314c116
......@@ -15,6 +15,7 @@ import android.widget.LinearLayout;
import android.widget.TextView;
import org.chromium.base.metrics.RecordHistogram;
import org.chromium.base.metrics.RecordUserAction;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.native_page.ContextMenuManager;
import org.chromium.chrome.browser.native_page.NativePageNavigationDelegate;
......@@ -86,6 +87,7 @@ public class ExploreSitesCategoryCardView extends LinearLayout {
public void onClick(View view) {
recordCategoryClick(mCategory.getType());
recordTileIndexClick(mCategoryCardIndex, mTileIndex);
RecordUserAction.record("Android.ExploreSitesPage.ClickOnSiteIcon");
ExploreSitesBridge.recordClick(mProfile, mSiteUrl, mCategory.getType());
mNavigationDelegate.openUrl(WindowOpenDisposition.CURRENT_TAB,
new LoadUrlParams(getUrl(), PageTransition.AUTO_BOOKMARK));
......
......@@ -86,6 +86,7 @@ public class ExploreSitesPage extends BasicNativePage {
private boolean mHasFetchedNetworkCatalog;
private boolean mIsLoaded;
private int mInitialScrollPosition;
private boolean mScrollUserActionReported;
/**
* Create a new instance of the explore sites page.
......@@ -167,6 +168,19 @@ public class ExploreSitesPage extends BasicNativePage {
mRecyclerView.setLayoutManager(mLayoutManager);
mRecyclerView.setAdapter(adapter);
mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(RecyclerView v, int x, int y) {
// y=0 on initial layout, even if the initial scroll position is requested
// that is not 0. Once user starts scrolling via touch, the onScrolled comes
// in bunches with |y| having a dY value of every small move, positive (scroll
// down) or negative (scroll up) number of dps for each move.
if (!mScrollUserActionReported && (y != 0)) {
mScrollUserActionReported = true;
RecordUserAction.record("Android.ExploreSitesPage.Scrolled");
}
}
});
// When we personalize, we don't want to scroll to the 4th category.
mInitialScrollPosition =
......
......@@ -1784,6 +1784,13 @@ should be able to be added at any place in this file.
<description>User opened NTP with enabled ExploreSites section.</description>
</action>
<action name="Android.ExploreSitesPage.ClickOnSiteIcon">
<owner>dimich@chromium.org</owner>
<description>
User clicked on a site icon while on ExploreSites page.
</description>
</action>
<action name="Android.ExploreSitesPage.Open">
<owner>dimich@chromium.org</owner>
<description>
......@@ -1791,6 +1798,14 @@ should be able to be added at any place in this file.
</description>
</action>
<action name="Android.ExploreSitesPage.Scrolled">
<owner>dimich@chromium.org</owner>
<description>
User scrolled the ExploreSites page. Reported once per ExploreSitesPage
instance shown.
</description>
</action>
<action name="Android.HistoryPage.ClearBrowsingData">
<owner>twellington@chromium.org</owner>
<description>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment