Commit d57b2587 authored by Peter Kotwicz's avatar Peter Kotwicz Committed by Commit Bot

[Android WebAPK] Add UMA for whether WebAPK navigation is in scope

This CL adds a new UMA metric WebApk.Navigation.InScope which is
recorded on every WebAPK navigation. It records whether WebAPK
navigations are within the WebAPK's scope.

BUG=999648

Change-Id: I0d8fc678f396e8fd55c48aabd41b8878ee8fdcd6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1788304
Commit-Queue: Peter Kotwicz <pkotwicz@chromium.org>
Reviewed-by: default avatarDominick Ng <dominickn@chromium.org>
Reviewed-by: default avatarRobert Kaplow <rkaplow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#695828}
parent a798c106
...@@ -305,6 +305,13 @@ public class WebApkUma { ...@@ -305,6 +305,13 @@ public class WebApkUma {
RecordHistogram.recordSparseHistogram("WebApk.Launch.NetworkError", -errorCode); RecordHistogram.recordSparseHistogram("WebApk.Launch.NetworkError", -errorCode);
} }
/**
* Records whether a WebAPK navigation is within the WebAPK's scope.
*/
public static void recordNavigation(boolean isNavigationInScope) {
RecordHistogram.recordBooleanHistogram("WebApk.Navigation.InScope", isNavigationInScope);
}
/** /**
* Log necessary disk usage and cache size UMAs when WebAPK installation fails. * Log necessary disk usage and cache size UMAs when WebAPK installation fails.
*/ */
......
...@@ -41,6 +41,7 @@ import org.chromium.chrome.browser.compositor.layouts.LayoutManager; ...@@ -41,6 +41,7 @@ import org.chromium.chrome.browser.compositor.layouts.LayoutManager;
import org.chromium.chrome.browser.customtabs.CustomTabAppMenuPropertiesDelegate; import org.chromium.chrome.browser.customtabs.CustomTabAppMenuPropertiesDelegate;
import org.chromium.chrome.browser.document.ChromeLauncherActivity; import org.chromium.chrome.browser.document.ChromeLauncherActivity;
import org.chromium.chrome.browser.document.DocumentUtils; import org.chromium.chrome.browser.document.DocumentUtils;
import org.chromium.chrome.browser.metrics.WebApkUma;
import org.chromium.chrome.browser.tab.EmptyTabObserver; import org.chromium.chrome.browser.tab.EmptyTabObserver;
import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.tab.TabBrowserControlsState; import org.chromium.chrome.browser.tab.TabBrowserControlsState;
...@@ -600,13 +601,17 @@ public class WebappActivity extends SingleTabActivity { ...@@ -600,13 +601,17 @@ public class WebappActivity extends SingleTabActivity {
updateToolbarCloseButtonVisibility(); updateToolbarCloseButtonVisibility();
if (!WebappScopePolicy.isUrlInScope( boolean isNavigationInScope = WebappScopePolicy.isUrlInScope(
scopePolicy(), mWebappInfo, navigation.getUrl())) { scopePolicy(), mWebappInfo, navigation.getUrl());
if (!isNavigationInScope) {
// Briefly show the toolbar for off-scope navigations. // Briefly show the toolbar for off-scope navigations.
getFullscreenManager() getFullscreenManager()
.getBrowserVisibilityDelegate() .getBrowserVisibilityDelegate()
.showControlsTransient(); .showControlsTransient();
} }
if (mWebappInfo.isForWebApk()) {
WebApkUma.recordNavigation(isNavigationInScope);
}
} }
} }
......
...@@ -153197,6 +153197,17 @@ regressions. --> ...@@ -153197,6 +153197,17 @@ regressions. -->
</summary> </summary>
</histogram> </histogram>
<histogram name="WebApk.Navigation.InScope" enum="Boolean"
expires_after="2020-04-01">
<owner>hartmanng@chromium.org</owner>
<owner>pkotwicz@chromium.org</owner>
<owner>yfriedman@chromium.org</owner>
<summary>
Recorded each time that a WebAPK is navigated. Records whether the
navigation is within the scope of the WebAPK's Web Manifest.
</summary>
</histogram>
<histogram name="WebApk.Notification.Permission.Status" <histogram name="WebApk.Notification.Permission.Status"
enum="BooleanWebApkNotificationPermission" expires_after="2020-02-23"> enum="BooleanWebApkNotificationPermission" expires_after="2020-02-23">
<owner>hanxi@chromium.org</owner> <owner>hanxi@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