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