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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/metrics/MediaNotificationUma.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/metrics/MediaNotificationUma.java b/chrome/android/java/src/org/chromium/chrome/browser/metrics/MediaNotificationUma.java
new file mode 100644
index 0000000000000000000000000000000000000000..625c1f59cf5babb0d431dfaaf5e381764021705d
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/metrics/MediaNotificationUma.java
@@ -0,0 +1,40 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chrome.browser.metrics;
+
+import static org.chromium.chrome.browser.metrics.LaunchMetrics.EnumeratedHistogramSample;
+
+import android.content.Intent;
+
+/**
+ * Helper class to record which kind of media notifications does the user click to go back to
+ * Chrome.
+ */
+public class MediaNotificationUma {
+ public static final int SOURCE_INVALID = -1;
+ public static final int SOURCE_MEDIA = 0;
+ public static final int SOURCE_PRESENTATION = 1;
+ public static final int SOURCE_MEDIA_FLING = 2;
+ public static final int SOURCE_MAX = 3;
+
+ public static final String INTENT_EXTRA_NAME =
+ "org.chromium.chrome.browser.metrics.MediaNotificationUma.EXTRA_CLICK_SOURCE";
+
+ private static final EnumeratedHistogramSample sClickSourceHistogram =
+ new LaunchMetrics.EnumeratedHistogramSample(
+ "Media.Notification.Click", SOURCE_MAX);
+
+ /**
+ * Record the UMA as specified by {@link intent}. The {@link intent} should contain intent extra
+ * of name {@link INTENT_EXTRA_NAME} indicating the type.
+ * @param intent The intent starting the activity.
+ */
+ public static void recordClickSource(Intent intent) {
+ if (intent == null) return;
+ int source = intent.getIntExtra(INTENT_EXTRA_NAME, SOURCE_INVALID);
+ if (source == SOURCE_INVALID || source >= SOURCE_MAX) return;
+ sClickSourceHistogram.record(source);
+ }
+}
« 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