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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/metrics/WebApkUma.java

Issue 2707993003: [Android]: Hide add-to-homescreen app menu item when WebAPK is installed (Closed)
Patch Set: Add new state for 'Add to Homescreen' Menu item Created 3 years, 10 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/metrics/WebApkUma.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/metrics/WebApkUma.java b/chrome/android/java/src/org/chromium/chrome/browser/metrics/WebApkUma.java
index 87cb3db0ace0c30634d943f5cc5d1561357c5f4a..ef772ee7b72b23d459fc311fa6b8f403171f6587 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/metrics/WebApkUma.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/metrics/WebApkUma.java
@@ -4,6 +4,8 @@
package org.chromium.chrome.browser.metrics;
+import android.support.annotation.IntDef;
+
import org.chromium.base.metrics.RecordHistogram;
/**
@@ -29,6 +31,15 @@ public class WebApkUma {
public static final String HISTOGRAM_UPDATE_REQUEST_QUEUED = "WebApk.Update.RequestQueued";
+ // This enum is used to back UMA histograms, and should therefore be treated as append-only.
+ @IntDef({WEBAPK_OPEN_LAUNCH_SUCCESS, WEBAPK_OPEN_NO_LAUNCH_INTENT,
+ WEBAPK_OPEN_ACTIVITY_NOT_FOUND})
+ public @interface WebApkOpenResult {}
+ public static final int WEBAPK_OPEN_LAUNCH_SUCCESS = 0;
+ public static final int WEBAPK_OPEN_NO_LAUNCH_INTENT = 1;
+ public static final int WEBAPK_OPEN_ACTIVITY_NOT_FOUND = 2;
+ public static final int WEBAPK_OPEN_MAX = 3;
+
/**
* Records the time point when a request to update a WebAPK is sent to the WebAPK Server.
* @param type representing when the update request is sent to the WebAPK server.
@@ -48,4 +59,14 @@ public class WebApkUma {
RecordHistogram.recordEnumeratedHistogram(HISTOGRAM_UPDATE_REQUEST_QUEUED, times,
UPDATE_REQUEST_QUEUED_MAX);
}
+
+ /**
+ * When a user presses on the "Open WebAPK" menu item, this records whether the WebAPK was
+ * opened successfully.
+ * @param type Result of trying to open WebAPK.
+ */
+ public static void recordWebApkOpenAttempt(@WebApkOpenResult int type) {
+ assert type >= 0 && type < WEBAPK_OPEN_MAX;
nyquist 2017/02/28 18:19:17 I'm not sure this is technically necessary now, bu
gonzalon 2017/02/28 20:46:04 Done.
+ RecordHistogram.recordEnumeratedHistogram("WebApk.OpenFromMenu", type, WEBAPK_OPEN_MAX);
+ }
}

Powered by Google App Engine
This is Rietveld 408576698