Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(288)

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/metrics/MediaNotificationUma.java

Issue 1909483003: [MediaNotification] Add UMA to record user clicking media notifications (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: renaming Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 }
OLDNEW
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/metrics/LaunchMetrics.java ('k') | chrome/android/java_sources.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698