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

Side by Side 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, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.chrome.browser.metrics; 5 package org.chromium.chrome.browser.metrics;
6 6
7 import org.chromium.base.metrics.RecordHistogram; 7 import org.chromium.base.metrics.RecordHistogram;
8 8
9 /** 9 /**
10 * Centralizes UMA data collection for WebAPKs. NOTE: Histogram names and values are defined in 10 * Centralizes UMA data collection for WebAPKs. NOTE: Histogram names and values are defined in
(...skipping 11 matching lines...) Expand all
22 public static final int UPDATE_REQUEST_QUEUED_ONCE = 0; 22 public static final int UPDATE_REQUEST_QUEUED_ONCE = 0;
23 public static final int UPDATE_REQUEST_QUEUED_TWICE = 1; 23 public static final int UPDATE_REQUEST_QUEUED_TWICE = 1;
24 public static final int UPDATE_REQUEST_QUEUED_THREE_TIMES = 2; 24 public static final int UPDATE_REQUEST_QUEUED_THREE_TIMES = 2;
25 public static final int UPDATE_REQUEST_QUEUED_MAX = 3; 25 public static final int UPDATE_REQUEST_QUEUED_MAX = 3;
26 26
27 public static final String HISTOGRAM_UPDATE_REQUEST_SENT = 27 public static final String HISTOGRAM_UPDATE_REQUEST_SENT =
28 "WebApk.Update.RequestSent"; 28 "WebApk.Update.RequestSent";
29 29
30 public static final String HISTOGRAM_UPDATE_REQUEST_QUEUED = "WebApk.Update. RequestQueued"; 30 public static final String HISTOGRAM_UPDATE_REQUEST_QUEUED = "WebApk.Update. RequestQueued";
31 31
32 public static final int WEBAPK_OPEN_LAUNCH_SUCCESS = 0;
nyquist 2017/02/28 07:04:19 Could you add a comment about this enum that refer
gonzalon 2017/02/28 16:12:23 Done.
33 public static final int WEBAPK_OPEN_NO_LAUNCH_INTENT = 1;
34 public static final int WEBAPK_OPEN_ACTIVITY_NOT_FOUND = 2;
35 public static final int WEBAPK_OPEN_MAX = 3;
36
32 /** 37 /**
33 * Records the time point when a request to update a WebAPK is sent to the W ebAPK Server. 38 * Records the time point when a request to update a WebAPK is sent to the W ebAPK Server.
34 * @param type representing when the update request is sent to the WebAPK se rver. 39 * @param type representing when the update request is sent to the WebAPK se rver.
35 */ 40 */
36 public static void recordUpdateRequestSent(int type) { 41 public static void recordUpdateRequestSent(int type) {
37 assert type >= 0 && type < UPDATE_REQUEST_SENT_MAX; 42 assert type >= 0 && type < UPDATE_REQUEST_SENT_MAX;
38 RecordHistogram.recordEnumeratedHistogram(HISTOGRAM_UPDATE_REQUEST_SENT, 43 RecordHistogram.recordEnumeratedHistogram(HISTOGRAM_UPDATE_REQUEST_SENT,
39 type, UPDATE_REQUEST_SENT_MAX); 44 type, UPDATE_REQUEST_SENT_MAX);
40 } 45 }
41 46
42 /** 47 /**
43 * Records the times that an update request has been queued once, twice and three times before 48 * Records the times that an update request has been queued once, twice and three times before
44 * sending to WebAPK server. 49 * sending to WebAPK server.
45 * @param times representing the times that an update has been queued. 50 * @param times representing the times that an update has been queued.
46 */ 51 */
47 public static void recordUpdateRequestQueued(int times) { 52 public static void recordUpdateRequestQueued(int times) {
48 RecordHistogram.recordEnumeratedHistogram(HISTOGRAM_UPDATE_REQUEST_QUEUE D, times, 53 RecordHistogram.recordEnumeratedHistogram(HISTOGRAM_UPDATE_REQUEST_QUEUE D, times,
49 UPDATE_REQUEST_QUEUED_MAX); 54 UPDATE_REQUEST_QUEUED_MAX);
50 } 55 }
56
57 /**
58 * When a user presses on the "Open WebAPK" menu item, this records whether the WebAPK was
59 * opened successfully.
60 * @param type Result of trying to open WebAPK.
61 */
62 public static void recordWebApkOpenAttempt(int type) {
nyquist 2017/02/28 07:04:19 Any reason this isn't documented using @IntDef? Se
gonzalon 2017/02/28 16:12:23 I just followed the style on this file, I added th
nyquist 2017/02/28 17:57:17 Yeah, it's just for performance reasons.
63 assert type >= 0 && type < WEBAPK_OPEN_MAX;
64 RecordHistogram.recordEnumeratedHistogram("WebApk.OpenFromMenu", type, W EBAPK_OPEN_MAX);
65 }
51 } 66 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698