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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/document/ChromeLauncherActivity.java

Issue 1220813010: Add UMA metrics to track the source of homescreen icons on launch. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing reviewer comments Created 5 years, 5 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/document/ChromeLauncherActivity.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/document/ChromeLauncherActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/document/ChromeLauncherActivity.java
index e5f02c068c2eb40902f45931c0a1d85e7f0246d0..d2a7f09661ec30f2d021331bf969092b9cea6a4b 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/document/ChromeLauncherActivity.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/document/ChromeLauncherActivity.java
@@ -328,7 +328,9 @@ public class ChromeLauncherActivity extends Activity
// Try to relaunch an existing task.
if (reuse && !append) {
- LaunchMetrics.recordHomeScreenLaunchIntoTab(url);
+ int shortcutSource = getIntent().getIntExtra(
+ ShortcutHelper.EXTRA_SOURCE, ShortcutHelper.SOURCE_UNKNOWN);
+ LaunchMetrics.recordHomeScreenLaunchIntoTab(url, shortcutSource);
if (relaunchTask(incognito, url)) return;
}
@@ -768,6 +770,8 @@ public class ChromeLauncherActivity extends Activity
String webappIcon = IntentUtils.safeGetStringExtra(intent, ShortcutHelper.EXTRA_ICON);
int webappOrientation = IntentUtils.safeGetIntExtra(intent,
ShortcutHelper.EXTRA_ORIENTATION, ScreenOrientationValues.DEFAULT);
+ int webappSource = IntentUtils.safeGetIntExtra(intent,
+ ShortcutHelper.EXTRA_SOURCE, ShortcutHelper.SOURCE_UNKNOWN);
if (webappId != null && webappUrl != null) {
String webappMacString = IntentUtils.safeGetStringExtra(
@@ -777,11 +781,12 @@ public class ChromeLauncherActivity extends Activity
if (webappMac != null && WebappAuthenticator.isUrlValid(this, webappUrl, webappMac)) {
if (TextUtils.equals(ACTION_START_WEBAPP, intent.getAction())) {
- LaunchMetrics.recordHomeScreenLaunchIntoStandaloneActivity(webappUrl);
+ LaunchMetrics.recordHomeScreenLaunchIntoStandaloneActivity(
+ webappUrl, webappSource);
}
- WebappActivity.launchInstance(
- this, webappId, webappUrl, webappIcon, webappTitle, webappOrientation);
+ WebappActivity.launchInstance(this, webappId,
+ webappUrl, webappIcon, webappTitle, webappOrientation, webappSource);
} else {
Log.e(TAG, "Shortcut (" + webappUrl + ") opened in Chrome.");
@@ -790,6 +795,7 @@ public class ChromeLauncherActivity extends Activity
fallbackIntent.setAction(Intent.ACTION_VIEW);
fallbackIntent.setData(Uri.parse(webappUrl));
fallbackIntent.putExtra(BookmarkUtils.REUSE_URL_MATCHING_TAB_ELSE_NEW_TAB, true);
+ fallbackIntent.putExtra(ShortcutHelper.EXTRA_SOURCE, webappSource);
return fallbackIntent;
}
}

Powered by Google App Engine
This is Rietveld 408576698