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

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

Issue 2604063002: Log intents received differently if they are internal or external. (Closed)
Patch Set: Fix compile Created 3 years, 11 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 | tools/metrics/actions/actions.xml » ('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/ChromeTabbedActivity.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java
index 6ea48095ad3cec016f3533bb3fdc9f9ae29726c9..1431d7ddbc85a2a6f9ec4f4bd4d03397192340b2 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java
@@ -774,6 +774,12 @@ public class ChromeTabbedActivity extends ChromeActivity implements OverviewMode
public void processUrlViewIntent(String url, String referer, String headers,
TabOpenType tabOpenType, String externalAppId, int tabIdToBringToFront,
boolean hasUserGesture, Intent intent) {
+ if (isFromChrome(intent, externalAppId)) {
+ RecordUserAction.record("MobileTabbedModeViewIntentFromChrome");
+ } else {
+ RecordUserAction.record("MobileTabbedModeViewIntentFromApp");
+ }
+
TabModel tabModel = getCurrentTabModel();
boolean fromLauncherShortcut = IntentUtils.safeGetBooleanExtra(
intent, IntentHandler.EXTRA_INVOKED_FROM_SHORTCUT, false);
@@ -794,7 +800,7 @@ public class ChromeTabbedActivity extends ChromeActivity implements OverviewMode
} else {
launchIntent(url, referer, headers, externalAppId, true, intent);
}
- RecordUserAction.record("MobileReceivedExternalIntent");
+ logMobileReceivedExternalIntent(externalAppId, intent);
int shortcutSource = intent.getIntExtra(
ShortcutHelper.EXTRA_SOURCE, ShortcutSource.UNKNOWN);
LaunchMetrics.recordHomeScreenLaunchIntoTab(url, shortcutSource);
@@ -817,7 +823,7 @@ public class ChromeTabbedActivity extends ChromeActivity implements OverviewMode
} else {
TabModelUtils.setIndex(tabModel, tabIndex);
}
- RecordUserAction.record("MobileReceivedExternalIntent");
+ logMobileReceivedExternalIntent(externalAppId, intent);
break;
case CLOBBER_CURRENT_TAB:
// The browser triggered the intent. This happens when clicking links which
@@ -904,7 +910,29 @@ public class ChromeTabbedActivity extends ChromeActivity implements OverviewMode
Tab newTab =
launchIntent(url, referer, headers, externalAppId, forceNewTab, intent);
newTab.setIsAllowedToReturnToExternalApp(isAllowedToReturnToExternalApp);
+ logMobileReceivedExternalIntent(externalAppId, intent);
+ }
+
+ // TODO(tedchoc): Remove once we have verified that MobileTabbedModeViewIntentFromChrome
+ // and MobileTabbedModeViewIntentFromApp are suitable/more correct
+ // replacments for these.
+ private void logMobileReceivedExternalIntent(String externalAppId, Intent intent) {
RecordUserAction.record("MobileReceivedExternalIntent");
+ if (isFromChrome(intent, externalAppId)) {
+ RecordUserAction.record("MobileReceivedExternalIntent.Chrome");
+ } else {
+ RecordUserAction.record("MobileReceivedExternalIntent.App");
+ }
+ }
+
+ private boolean isFromChrome(Intent intent, String externalAppId) {
+ // To determine if the processed intent is from Chrome, check for any of the following:
+ // 1.) The authentication token that will be added to trusted intents.
+ // 2.) The app ID matches Chrome. This value can be spoofed by other applications, but
+ // in cases where we were not able to add the authentication token this is our only
+ // indication the intent was from Chrome.
+ return IntentHandler.wasIntentSenderChrome(intent)
+ || TextUtils.equals(externalAppId, getPackageName());
}
}
« no previous file with comments | « no previous file | tools/metrics/actions/actions.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698