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

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

Issue 2096073002: Record how often we end up in Chrome from external navigations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add null check for activity info. Created 4 years, 6 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/externalnav/ExternalNavigationDelegate.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/IntentHandler.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/IntentHandler.java b/chrome/android/java/src/org/chromium/chrome/browser/IntentHandler.java
index cb59ac679ea6d9c257432a4fccc456a837421156..44cc669483566b82d0b342204147ec6b2289aee3 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/IntentHandler.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/IntentHandler.java
@@ -23,10 +23,12 @@ import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.base.Log;
import org.chromium.base.VisibleForTesting;
import org.chromium.base.metrics.RecordHistogram;
+import org.chromium.base.metrics.RecordUserAction;
import org.chromium.chrome.browser.externalauth.ExternalAuthUtils;
import org.chromium.chrome.browser.externalnav.ExternalNavigationDelegateImpl;
import org.chromium.chrome.browser.externalnav.IntentWithGesturesHandler;
import org.chromium.chrome.browser.omnibox.AutocompleteController;
+import org.chromium.chrome.browser.rappor.RapporServiceBridge;
import org.chromium.chrome.browser.search_engines.TemplateUrlService;
import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.tabmodel.document.ActivityDelegate;
@@ -133,6 +135,12 @@ public class IntentHandler {
public static final String EXTRA_WINDOW_ID = "org.chromium.chrome.browser.window_id";
/**
+ * Records package names of other applications in the system that could have handled
+ * this intent.
+ */
+ public static final String EXTRA_EXTERNAL_NAV_PACKAGES = "org.chromium.chrome.browser.eenp";
+
+ /**
* Fake ComponentName used in constructing TRUSTED_APPLICATION_CODE_EXTRA.
*/
private static ComponentName sFakeComponentName = null;
@@ -290,6 +298,22 @@ public class IntentHandler {
}
/**
+ * Records an action when a user chose to handle a URL in Chrome that could have been handled
+ * by an application installed on the phone. Also records the name of that application.
+ * This doesn't include generic URL handlers, such as browsers.
+ */
+ private void recordAppHandlersForIntent(Intent intent) {
+ List<String> packages = IntentUtils.safeGetStringArrayListExtra(intent,
+ IntentHandler.EXTRA_EXTERNAL_NAV_PACKAGES);
+ if (packages != null && packages.size() > 0) {
+ RecordUserAction.record("MobileExternalNavigationReceived");
+ for (String name : packages) {
+ RapporServiceBridge.sampleString("Android.ExternalNavigationNotChosen", name);
+ }
+ }
+ }
+
+ /**
* Handles an Intent after the ChromeTabbedActivity decides that it shouldn't ignore the
* Intent.
*
@@ -316,6 +340,7 @@ public class IntentHandler {
IntentUtils.safeGetStringExtra(intent, Browser.EXTRA_APPLICATION_ID),
tabIdToBringToFront, hasUserGesture, intent);
recordExternalIntentSourceUMA(intent);
+ recordAppHandlersForIntent(intent);
return true;
}
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationDelegate.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698