OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 static org.chromium.base.metrics.CachedMetrics.EnumeratedHistogramSample; | 7 import static org.chromium.chrome.browser.metrics.LaunchMetrics.EnumeratedHistog
ramSample; |
8 | 8 |
9 import android.content.Intent; | 9 import android.content.Intent; |
10 | 10 |
11 /** | 11 /** |
12 * Helper class to record which kind of media notifications does the user click
to go back to | 12 * Helper class to record which kind of media notifications does the user click
to go back to |
13 * Chrome. | 13 * Chrome. |
14 */ | 14 */ |
15 public class MediaNotificationUma { | 15 public class MediaNotificationUma { |
16 public static final int SOURCE_INVALID = -1; | 16 public static final int SOURCE_INVALID = -1; |
17 public static final int SOURCE_MEDIA = 0; | 17 public static final int SOURCE_MEDIA = 0; |
18 public static final int SOURCE_PRESENTATION = 1; | 18 public static final int SOURCE_PRESENTATION = 1; |
19 public static final int SOURCE_MEDIA_FLING = 2; | 19 public static final int SOURCE_MEDIA_FLING = 2; |
20 public static final int SOURCE_MAX = 3; | 20 public static final int SOURCE_MAX = 3; |
21 | 21 |
22 public static final String INTENT_EXTRA_NAME = | 22 public static final String INTENT_EXTRA_NAME = |
23 "org.chromium.chrome.browser.metrics.MediaNotificationUma.EXTRA_CLIC
K_SOURCE"; | 23 "org.chromium.chrome.browser.metrics.MediaNotificationUma.EXTRA_CLIC
K_SOURCE"; |
24 | 24 |
25 private static final EnumeratedHistogramSample sClickSourceHistogram = | 25 private static final EnumeratedHistogramSample sClickSourceHistogram = |
26 new EnumeratedHistogramSample("Media.Notification.Click", SOURCE_MAX
); | 26 new LaunchMetrics.EnumeratedHistogramSample( |
| 27 "Media.Notification.Click", SOURCE_MAX); |
27 | 28 |
28 /** | 29 /** |
29 * Record the UMA as specified by {@link intent}. The {@link intent} should
contain intent extra | 30 * Record the UMA as specified by {@link intent}. The {@link intent} should
contain intent extra |
30 * of name {@link INTENT_EXTRA_NAME} indicating the type. | 31 * of name {@link INTENT_EXTRA_NAME} indicating the type. |
31 * @param intent The intent starting the activity. | 32 * @param intent The intent starting the activity. |
32 */ | 33 */ |
33 public static void recordClickSource(Intent intent) { | 34 public static void recordClickSource(Intent intent) { |
34 if (intent == null) return; | 35 if (intent == null) return; |
35 int source = intent.getIntExtra(INTENT_EXTRA_NAME, SOURCE_INVALID); | 36 int source = intent.getIntExtra(INTENT_EXTRA_NAME, SOURCE_INVALID); |
36 if (source == SOURCE_INVALID || source >= SOURCE_MAX) return; | 37 if (source == SOURCE_INVALID || source >= SOURCE_MAX) return; |
37 sClickSourceHistogram.record(source); | 38 sClickSourceHistogram.record(source); |
38 } | 39 } |
39 } | 40 } |
OLD | NEW |