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; ...@@ -15,6 +15,7 @@ import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import org.chromium.base.metrics.RecordHistogram; import org.chromium.base.metrics.RecordHistogram;
import org.chromium.base.metrics.RecordUserAction;
import org.chromium.chrome.R; import org.chromium.chrome.R;
import org.chromium.chrome.browser.native_page.ContextMenuManager; import org.chromium.chrome.browser.native_page.ContextMenuManager;
import org.chromium.chrome.browser.native_page.NativePageNavigationDelegate; import org.chromium.chrome.browser.native_page.NativePageNavigationDelegate;
...@@ -86,6 +87,7 @@ public class ExploreSitesCategoryCardView extends LinearLayout { ...@@ -86,6 +87,7 @@ public class ExploreSitesCategoryCardView extends LinearLayout {
public void onClick(View view) { public void onClick(View view) {
recordCategoryClick(mCategory.getType()); recordCategoryClick(mCategory.getType());
recordTileIndexClick(mCategoryCardIndex, mTileIndex); recordTileIndexClick(mCategoryCardIndex, mTileIndex);
RecordUserAction.record("Android.ExploreSitesPage.ClickOnSiteIcon");
ExploreSitesBridge.recordClick(mProfile, mSiteUrl, mCategory.getType()); ExploreSitesBridge.recordClick(mProfile, mSiteUrl, mCategory.getType());
mNavigationDelegate.openUrl(WindowOpenDisposition.CURRENT_TAB, mNavigationDelegate.openUrl(WindowOpenDisposition.CURRENT_TAB,
new LoadUrlParams(getUrl(), PageTransition.AUTO_BOOKMARK)); new LoadUrlParams(getUrl(), PageTransition.AUTO_BOOKMARK));
......
...@@ -86,6 +86,7 @@ public class ExploreSitesPage extends BasicNativePage { ...@@ -86,6 +86,7 @@ public class ExploreSitesPage extends BasicNativePage {
private boolean mHasFetchedNetworkCatalog; private boolean mHasFetchedNetworkCatalog;
private boolean mIsLoaded; private boolean mIsLoaded;
private int mInitialScrollPosition; private int mInitialScrollPosition;
private boolean mScrollUserActionReported;
/** /**
* Create a new instance of the explore sites page. * Create a new instance of the explore sites page.
...@@ -167,6 +168,19 @@ public class ExploreSitesPage extends BasicNativePage { ...@@ -167,6 +168,19 @@ public class ExploreSitesPage extends BasicNativePage {
mRecyclerView.setLayoutManager(mLayoutManager); mRecyclerView.setLayoutManager(mLayoutManager);
mRecyclerView.setAdapter(adapter); 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. // When we personalize, we don't want to scroll to the 4th category.
mInitialScrollPosition = mInitialScrollPosition =
......
...@@ -1784,6 +1784,13 @@ should be able to be added at any place in this file. ...@@ -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> <description>User opened NTP with enabled ExploreSites section.</description>
</action> </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"> <action name="Android.ExploreSitesPage.Open">
<owner>dimich@chromium.org</owner> <owner>dimich@chromium.org</owner>
<description> <description>
...@@ -1791,6 +1798,14 @@ should be able to be added at any place in this file. ...@@ -1791,6 +1798,14 @@ should be able to be added at any place in this file.
</description> </description>
</action> </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"> <action name="Android.HistoryPage.ClearBrowsingData">
<owner>twellington@chromium.org</owner> <owner>twellington@chromium.org</owner>
<description> <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