| 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
|
| index a95aab54955c1c172841afbb0d80c41bef7d963f..e113f2607a43f68a677746d764439aac6a1cf1db 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/metrics/LaunchMetrics.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/metrics/LaunchMetrics.java
|
| @@ -15,23 +15,47 @@ import java.util.List;
|
| */
|
| @JNINamespace("metrics")
|
| public class LaunchMetrics {
|
| - private static final List<String> sActivityUrls = new ArrayList<String>();
|
| - private static final List<String> sTabUrls = new ArrayList<String>();
|
| + private static class UrlSourcePair {
|
| + // The source member stores the origin of the url, e.g. from the add to homescreen menu
|
| + // item, an app banner, or unknown. The mapping of int source values to their string names
|
| + // is found in the C++ ShortcutInfo struct.
|
| + private String mUrl;
|
| + private int mSource;
|
| +
|
| + public UrlSourcePair(String url, int source) {
|
| + mUrl = url;
|
| + mSource = source;
|
| + }
|
| +
|
| + public String getUrl() {
|
| + return mUrl;
|
| + }
|
| +
|
| + public int getSource() {
|
| + return mSource;
|
| + }
|
| + }
|
| +
|
| + private static final List<UrlSourcePair> sActivityUrls = new ArrayList<UrlSourcePair>();
|
| + private static final List<UrlSourcePair> sTabUrls = new ArrayList<UrlSourcePair>();
|
|
|
| /**
|
| - * Records the launch of a standalone Activity for a URL (i.e. a WebappActivity).
|
| + * Records the launch of a standalone Activity for a URL (i.e. a WebappActivity)
|
| + * added from a specific source.
|
| * @param url URL that kicked off the Activity's creation.
|
| + * @param source integer id of the source from where the URL was added.
|
| */
|
| - public static void recordHomeScreenLaunchIntoStandaloneActivity(String url) {
|
| - sActivityUrls.add(url);
|
| + public static void recordHomeScreenLaunchIntoStandaloneActivity(String url, int source) {
|
| + sActivityUrls.add(new UrlSourcePair(url, source));
|
| }
|
|
|
| /**
|
| * 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.
|
| + * @param source integer id of the source from where the URL was added.
|
| */
|
| - public static void recordHomeScreenLaunchIntoTab(String url) {
|
| - sTabUrls.add(url);
|
| + public static void recordHomeScreenLaunchIntoTab(String url, int source) {
|
| + sTabUrls.add(new UrlSourcePair(url, source));
|
| }
|
|
|
| /**
|
| @@ -41,16 +65,16 @@ public class LaunchMetrics {
|
| * @param webContents WebContents for the current Tab.
|
| */
|
| public static void commitLaunchMetrics(WebContents webContents) {
|
| - for (String url : sActivityUrls) {
|
| - nativeRecordLaunch(true, url, webContents);
|
| + for (UrlSourcePair item : sActivityUrls) {
|
| + nativeRecordLaunch(true, item.getUrl(), item.getSource(), webContents);
|
| }
|
| - for (String url : sTabUrls) {
|
| - nativeRecordLaunch(false, url, webContents);
|
| + for (UrlSourcePair item : sTabUrls) {
|
| + nativeRecordLaunch(false, item.getUrl(), item.getSource(), webContents);
|
| }
|
| sActivityUrls.clear();
|
| sTabUrls.clear();
|
| }
|
|
|
| private static native void nativeRecordLaunch(
|
| - boolean standalone, String url, WebContents webContents);
|
| + boolean standalone, String url, int source, WebContents webContents);
|
| }
|
|
|