OLD | NEW |
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 Loading... |
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 private static final int WEBAPK_OPEN_MAX = 3; |
| 33 public static final int WEBAPK_OPEN_LAUNCH_SUCCESS = 0; |
| 34 public static final int WEBAPK_OPEN_NO_LAUNCH_INTENT = 1; |
| 35 public static final int WEBAPK_OPEN_ACTIVITY_NOT_FOUND = 2; |
| 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) { |
| 63 assert type >= 0 && type < WEBAPK_OPEN_MAX; |
| 64 RecordHistogram.recordEnumeratedHistogram("WebApk.OpenFromMenu", type, W
EBAPK_OPEN_MAX); |
| 65 } |
51 } | 66 } |
OLD | NEW |