Commit 4056bd3f authored by Yafei Duan's avatar Yafei Duan Committed by Commit Bot

[Offline Pages] Adding user action recording for P2P sharing.

Adding user action recording for P2P sharing:
- When user shares page loaded in current tab from overflow menu.
- When user shares pages from Download Home.
- When user clicks on the reload button in the snackbar shown when an
  untrusted page is loaded.

Bug: 758690
Change-Id: I1b5c4dae5d33fb84b363ca2b26b2c56eb58efcf0
Reviewed-on: https://chromium-review.googlesource.com/1009073Reviewed-by: default avatarPeter Williamson <petewil@chromium.org>
Reviewed-by: default avatarRobert Kaplow <rkaplow@chromium.org>
Reviewed-by: default avatarJoy Ming <jming@chromium.org>
Commit-Queue: Yafei Duan <romax@chromium.org>
Cr-Commit-Position: refs/heads/master@{#550713}
parent 2214ab02
......@@ -347,6 +347,7 @@ public class DownloadUtils {
if (newFilePath != null) {
file = new File(newFilePath);
}
RecordUserAction.record("OfflinePages.Sharing.SharePageFromDownloadHome");
}
} else {
// Share the URL, instead of the file, when the offline page sharing is
......
......@@ -325,6 +325,9 @@ public class OfflinePageTabObserver
RecordUserAction.record("OfflinePages.ReloadButtonClicked");
Tab foundTab = tabModelSelector.getTabById(tabId);
if (foundTab == null) return;
if (!OfflinePageUtils.isShowingTrustedOfflinePage(foundTab)) {
RecordUserAction.record("OfflinePages.ReloadButtonClickedViewingUntrustedPage");
}
// Delegates to Tab to reload the page. Tab will send the correct header in order to
// load the right page.
foundTab.reload();
......
......@@ -17,6 +17,7 @@ import org.chromium.base.Callback;
import org.chromium.base.Log;
import org.chromium.base.VisibleForTesting;
import org.chromium.base.metrics.RecordHistogram;
import org.chromium.base.metrics.RecordUserAction;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.ChromeActivity;
import org.chromium.chrome.browser.UrlConstants;
......@@ -506,6 +507,7 @@ public class OfflinePageUtils {
*/
public static void sharePage(Activity activity, String pageUrl, String pageTitle,
String offlinePath, File offlinePageFile, final Callback<ShareParams> shareCallback) {
RecordUserAction.record("OfflinePages.Sharing.SharePageFromOverflowMenu");
AsyncTask<Void, Void, Uri> task = new AsyncTask<Void, Void, Uri>() {
@Override
protected Uri doInBackground(Void... v) {
......
......@@ -13339,6 +13339,14 @@ should be able to be added at any place in this file.
</description>
</action>
<action name="OfflinePages.ReloadButtonClickedViewingUntrustedPage">
<owner>romax@chromium.org</owner>
<description>
Recorded when &quot;Reload&quot; button is clicked in the snackbar that is
shown when an untrusted offline page is loaded.
</description>
</action>
<action name="OfflinePages.ReloadButtonNotClicked">
<owner>jianli@chromium.org</owner>
<description>
......@@ -13385,6 +13393,25 @@ should be able to be added at any place in this file.
</description>
</action>
<action name="OfflinePages.Sharing.SharePageFromDownloadHome">
<owner>romax@chromium.org</owner>
<description>
Recorded when the user shares offline pages from Download Home. Each page
will be counted once if there are multiple items being shared in a batch.
This will not increment if the sharing process fails at the page publishing
step.
</description>
</action>
<action name="OfflinePages.Sharing.SharePageFromOverflowMenu">
<owner>romax@chromium.org</owner>
<description>
Recorded when the user shares an offline page loaded in the current tab
through the &quot;Share...&quot; button in the overflow menu. This will not
increment if the sharing process fails at the page publishing step.
</description>
</action>
<action name="OfflinePages.ViewingOffline.EditButtonClicked">
<obsolete>Offline pages were pulled out of bookmarks UI.</obsolete>
<owner>jianli@chromium.org</owner>
......
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