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.widget.bottomsheet; | 5 package org.chromium.chrome.browser.widget.bottomsheet; |
6 | 6 |
7 import android.support.annotation.IntDef; | 7 import android.support.annotation.IntDef; |
8 | 8 |
9 import org.chromium.base.metrics.RecordHistogram; | 9 import org.chromium.base.metrics.RecordHistogram; |
10 import org.chromium.base.metrics.RecordUserAction; | 10 import org.chromium.base.metrics.RecordUserAction; |
11 import org.chromium.chrome.browser.widget.bottomsheet.BottomSheet.BottomSheetCon
tent; | 11 import org.chromium.chrome.browser.widget.bottomsheet.BottomSheet.BottomSheetCon
tent; |
12 | 12 |
13 import java.lang.annotation.Retention; | 13 import java.lang.annotation.Retention; |
14 import java.lang.annotation.RetentionPolicy; | 14 import java.lang.annotation.RetentionPolicy; |
15 import java.util.concurrent.TimeUnit; | 15 import java.util.concurrent.TimeUnit; |
16 | 16 |
17 /** | 17 /** |
18 * Records user actions and histograms related to the {@link BottomSheet}. | 18 * Records user actions and histograms related to the {@link BottomSheet}. |
19 */ | 19 */ |
20 public class BottomSheetMetrics extends EmptyBottomSheetObserver { | 20 public class BottomSheetMetrics extends EmptyBottomSheetObserver { |
21 /** | 21 /** |
22 * The different ways that the bottom sheet can be opened. This is used to b
ack a UMA | 22 * The different ways that the bottom sheet can be opened. This is used to b
ack a UMA |
23 * histogram and should therefore be treated as append-only. | 23 * histogram and should therefore be treated as append-only. |
24 */ | 24 */ |
25 @IntDef({OPENED_BY_SWIPE, OPENED_BY_OMNIBOX_FOCUS, OPENED_BY_NEW_TAB_CREATIO
N}) | 25 @IntDef({OPENED_BY_SWIPE, OPENED_BY_OMNIBOX_FOCUS, OPENED_BY_NEW_TAB_CREATIO
N, |
| 26 OPENED_BY_EXPAND_BUTTON}) |
26 @Retention(RetentionPolicy.SOURCE) | 27 @Retention(RetentionPolicy.SOURCE) |
27 public @interface SheetOpenReason {} | 28 public @interface SheetOpenReason {} |
28 public static final int OPENED_BY_SWIPE = 0; | 29 public static final int OPENED_BY_SWIPE = 0; |
29 public static final int OPENED_BY_OMNIBOX_FOCUS = 1; | 30 public static final int OPENED_BY_OMNIBOX_FOCUS = 1; |
30 public static final int OPENED_BY_NEW_TAB_CREATION = 2; | 31 public static final int OPENED_BY_NEW_TAB_CREATION = 2; |
31 private static final int OPENED_BY_BOUNDARY = 3; | 32 public static final int OPENED_BY_EXPAND_BUTTON = 3; |
| 33 private static final int OPENED_BY_BOUNDARY = 4; |
32 | 34 |
33 /** Whether the sheet is currently open. */ | 35 /** Whether the sheet is currently open. */ |
34 private boolean mIsSheetOpen; | 36 private boolean mIsSheetOpen; |
35 | 37 |
36 /** The last {@link BottomSheetContent} that was displayed. */ | 38 /** The last {@link BottomSheetContent} that was displayed. */ |
37 private BottomSheetContent mLastContent; | 39 private BottomSheetContent mLastContent; |
38 | 40 |
39 /** When this class was created. Used as a proxy for when the app was starte
d. */ | 41 /** When this class was created. Used as a proxy for when the app was starte
d. */ |
40 private long mCreationTime; | 42 private long mCreationTime; |
41 | 43 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 | 116 |
115 /** | 117 /** |
116 * Records the reason the sheet was opened. | 118 * Records the reason the sheet was opened. |
117 * @param reason The {@link SheetOpenReason} that caused the bottom sheet to
open. | 119 * @param reason The {@link SheetOpenReason} that caused the bottom sheet to
open. |
118 */ | 120 */ |
119 public void recordSheetOpenReason(@SheetOpenReason int reason) { | 121 public void recordSheetOpenReason(@SheetOpenReason int reason) { |
120 RecordHistogram.recordEnumeratedHistogram( | 122 RecordHistogram.recordEnumeratedHistogram( |
121 "Android.ChromeHome.OpenReason", reason, OPENED_BY_BOUNDARY); | 123 "Android.ChromeHome.OpenReason", reason, OPENED_BY_BOUNDARY); |
122 } | 124 } |
123 } | 125 } |
OLD | NEW |