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