OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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.preferences.datareduction; | 5 package org.chromium.chrome.browser.preferences.datareduction; |
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 the Data Reduction Proxy. | 10 * Centralizes UMA data collection for the Data Reduction Proxy. |
11 */ | 11 */ |
12 public class DataReductionProxyUma { | 12 public class DataReductionProxyUma { |
13 // Represent the possible user actions in the promo and settings menu. This
must | 13 |
14 // remain in sync with DataReductionProxy.UIAction in | 14 public static final String UI_ACTION_HISTOGRAM_NAME = "DataReductionProxy.UI
Action"; |
| 15 public static final String SNACKBAR_HISTOGRAM_NAME = "DataReductionProxy.Sna
ckbarPromo"; |
| 16 public static final String PREVIEWS_HISTOGRAM_NAME = "Previews.ContextMenuAc
tion.LoFi"; |
| 17 |
| 18 // Represent the possible user actions in the various data reduction promos
and settings menu. |
| 19 // This must remain in sync with DataReductionProxy.UIAction in |
15 // tools/metrics/histograms/histograms.xml. | 20 // tools/metrics/histograms/histograms.xml. |
16 public static final int ACTION_ENABLED = 0; | 21 public static final int ACTION_ENABLED = 0; |
17 // The value of 1 is reserved for an iOS-specific action. Values 2 and 3 are | 22 // The value of 1 is reserved for an iOS-specific action. Values 2 and 3 are |
18 // deprecated promo actions. | 23 // deprecated promo actions. |
19 public static final int ACTION_DISMISSED = 4; | 24 public static final int ACTION_DISMISSED = 4; |
20 public static final int ACTION_OFF_TO_OFF = 5; | 25 public static final int ACTION_OFF_TO_OFF = 5; |
21 public static final int ACTION_OFF_TO_ON = 6; | 26 public static final int ACTION_OFF_TO_ON = 6; |
22 public static final int ACTION_ON_TO_OFF = 7; | 27 public static final int ACTION_ON_TO_OFF = 7; |
23 public static final int ACTION_ON_TO_ON = 8; | 28 public static final int ACTION_ON_TO_ON = 8; |
24 public static final int ACTION_FRE_ENABLED = 9; | 29 public static final int ACTION_FRE_ENABLED = 9; |
25 public static final int ACTION_FRE_DISABLED = 10; | 30 public static final int ACTION_FRE_DISABLED = 10; |
26 public static final int ACTION_INFOBAR_ENABLED = 11; | 31 public static final int ACTION_INFOBAR_ENABLED = 11; |
27 public static final int ACTION_INFOBAR_DISMISSED = 12; | 32 public static final int ACTION_INFOBAR_DISMISSED = 12; |
28 public static final int ACTION_INDEX_BOUNDARY = 13; | 33 public static final int ACTION_SNACKBAR_LINK_CLICKED = 13; |
| 34 public static final int ACTION_SNACKBAR_LINK_CLICKED_DISABLED = 14; |
| 35 public static final int ACTION_SNACKBAR_DISMISSED = 15; |
| 36 public static final int ACTION_INDEX_BOUNDARY = 16; |
29 | 37 |
30 // Represent the possible Lo-Fi context menu user actions. This must remain
in sync with | 38 // Represent the possible Lo-Fi context menu user actions. This must remain
in sync with |
31 // Previews.ContextMenuAction.LoFi in tools/metrics/histograms/histograms.xm
l. | 39 // Previews.ContextMenuAction.LoFi in tools/metrics/histograms/histograms.xm
l. |
32 public static final int ACTION_LOFI_LOAD_IMAGE_CONTEXT_MENU_SHOWN = 0; | 40 public static final int ACTION_LOFI_LOAD_IMAGE_CONTEXT_MENU_SHOWN = 0; |
33 public static final int ACTION_LOFI_LOAD_IMAGE_CONTEXT_MENU_CLICKED = 1; | 41 public static final int ACTION_LOFI_LOAD_IMAGE_CONTEXT_MENU_CLICKED = 1; |
34 public static final int ACTION_LOFI_LOAD_IMAGE_CONTEXT_MENU_CLICKED_ON_PAGE
= 2; | 42 public static final int ACTION_LOFI_LOAD_IMAGE_CONTEXT_MENU_CLICKED_ON_PAGE
= 2; |
35 public static final int ACTION_LOFI_LOAD_IMAGES_CONTEXT_MENU_SHOWN = 3; | 43 public static final int ACTION_LOFI_LOAD_IMAGES_CONTEXT_MENU_SHOWN = 3; |
36 public static final int ACTION_LOFI_LOAD_IMAGES_CONTEXT_MENU_CLICKED = 4; | 44 public static final int ACTION_LOFI_LOAD_IMAGES_CONTEXT_MENU_CLICKED = 4; |
37 public static final int ACTION_LOFI_CONTEXT_MENU_INDEX_BOUNDARY = 5; | 45 public static final int ACTION_LOFI_CONTEXT_MENU_INDEX_BOUNDARY = 5; |
| 46 |
38 /** | 47 /** |
39 * Record the DataReductionProxy.UIAction histogram. | 48 * Record the DataReductionProxy.UIAction histogram. |
40 * @param action User action at the promo, first run experience, or settings
screen | 49 * @param action User action at the promo, first run experience, or settings
screen |
41 */ | 50 */ |
42 public static void dataReductionProxyUIAction(int action) { | 51 public static void dataReductionProxyUIAction(int action) { |
43 assert action >= 0 && action < ACTION_INDEX_BOUNDARY; | 52 assert action >= 0 && action < ACTION_INDEX_BOUNDARY; |
44 RecordHistogram.recordEnumeratedHistogram( | 53 RecordHistogram.recordEnumeratedHistogram( |
45 "DataReductionProxy.UIAction", action, | 54 UI_ACTION_HISTOGRAM_NAME, action, |
46 DataReductionProxyUma.ACTION_INDEX_BOUNDARY); | 55 DataReductionProxyUma.ACTION_INDEX_BOUNDARY); |
47 } | 56 } |
48 | 57 |
49 /** | 58 /** |
| 59 * Record the DataReductionProxy.SnackbarPromo histogram. |
| 60 * @param contentLength The content length in MB of the promo that was shown
. |
| 61 */ |
| 62 public static void dataReductionProxySnackbarPromo(int contentLength) { |
| 63 RecordHistogram.recordCustomCountHistogram( |
| 64 SNACKBAR_HISTOGRAM_NAME, contentLength, 1, 10000, 200); |
| 65 } |
| 66 |
| 67 /** |
50 * Record the Previews.ContextMenuAction.LoFi histogram. | 68 * Record the Previews.ContextMenuAction.LoFi histogram. |
51 * @param action LoFi user action on the context menu | 69 * @param action LoFi user action on the context menu |
52 */ | 70 */ |
53 public static void previewsLoFiContextMenuAction(int action) { | 71 public static void previewsLoFiContextMenuAction(int action) { |
54 assert action >= 0 && action < ACTION_LOFI_CONTEXT_MENU_INDEX_BOUNDARY; | 72 assert action >= 0 && action < ACTION_LOFI_CONTEXT_MENU_INDEX_BOUNDARY; |
55 RecordHistogram.recordEnumeratedHistogram( | 73 RecordHistogram.recordEnumeratedHistogram( |
56 "Previews.ContextMenuAction.LoFi", action, | 74 PREVIEWS_HISTOGRAM_NAME, action, |
57 ACTION_LOFI_CONTEXT_MENU_INDEX_BOUNDARY); | 75 ACTION_LOFI_CONTEXT_MENU_INDEX_BOUNDARY); |
58 } | 76 } |
59 } | 77 } |
OLD | NEW |