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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/metrics/LaunchMetrics.java

Issue 989523003: Add metrics for tracking how Chrome handled shortcut launches (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Renaming Created 5 years, 9 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
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappMetrics.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/metrics/LaunchMetrics.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/metrics/LaunchMetrics.java b/chrome/android/java/src/org/chromium/chrome/browser/metrics/LaunchMetrics.java
new file mode 100644
index 0000000000000000000000000000000000000000..e1a4e1b5aababdd79cf4f29472a48207532f380d
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/metrics/LaunchMetrics.java
@@ -0,0 +1,53 @@
+// Copyright 2015 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 org.chromium.base.JNINamespace;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Used for recording metrics about Chrome launches.
+ */
+@JNINamespace("metrics")
+public class LaunchMetrics {
+ private static final List<String> sActivityUrls = new ArrayList<String>();
+ private static final List<String> sTabUrls = new ArrayList<String>();
+
+ /**
+ * Records the launch of a standalone Activity for a URL (i.e. a WebappActivity).
+ * @param url URL that kicked off the Activity's creation.
+ */
+ public static void recordHomeScreenLaunchIntoStandaloneActivity(String url) {
+ sActivityUrls.add(url);
+ }
+
+ /**
+ * Records the launch of a Tab for a URL (i.e. a Home screen shortcut).
+ * @param url URL that kicked off the Tab's creation.
+ */
+ public static void recordHomeScreenLaunchIntoTab(String url) {
+ sTabUrls.add(url);
+ }
+
+ /**
+ * Calls out to native code to record URLs that have been launched via the Home screen.
+ * This intermediate step is necessary because Activity.onCreate() may be called when
+ * the native library has not yet been loaded.
+ */
+ public static void commitLaunchMetrics() {
+ for (String url : sActivityUrls) {
+ nativeRecordLaunch(true, url);
+ }
+ for (String url : sTabUrls) {
+ nativeRecordLaunch(false, url);
+ }
+ sActivityUrls.clear();
+ sTabUrls.clear();
+ }
+
+ private static native void nativeRecordLaunch(boolean standalone, String url);
+}
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappMetrics.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698