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

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

Issue 2061493002: Adds support for attaching a market referrer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/javatests/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandlerTest.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/externalnav/ExternalNavigationHandler.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandler.java b/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandler.java
index 62e7b26e134f1410c79c85b6eb56c6c04d801d72..0afeea8559af32668610bff213b24912f75d2e04 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandler.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandler.java
@@ -43,7 +43,12 @@ public class ExternalNavigationHandler {
private static final String SCHEME_SMS = "sms";
@VisibleForTesting
- public static final String EXTRA_BROWSER_FALLBACK_URL = "browser_fallback_url";
+ static final String EXTRA_BROWSER_FALLBACK_URL = "browser_fallback_url";
+
+ // An extra that may be specified on an intent:// URL that contains an encoded value for the
+ // referrer field passed to the market:// URL in the case where the app is not present.
+ @VisibleForTesting
+ static final String EXTRA_MARKET_REFERRER = "market_referrer";
private final ExternalNavigationDelegate mDelegate;
@@ -300,10 +305,19 @@ public class ExternalNavigationHandler {
}
String packagename = intent.getPackage();
if (packagename != null) {
+ String marketReferrer =
+ IntentUtils.safeGetStringExtra(intent, EXTRA_MARKET_REFERRER);
+ if (TextUtils.isEmpty(marketReferrer)) {
+ marketReferrer = mDelegate.getPackageName();
+ }
try {
- intent = new Intent(Intent.ACTION_VIEW, Uri.parse(
- "market://details?id=" + packagename
- + "&referrer=" + mDelegate.getPackageName()));
+ Uri marketUri = new Uri.Builder()
+ .scheme("market")
+ .authority("details")
+ .appendQueryParameter("id", packagename)
+ .appendQueryParameter("referrer", Uri.decode(marketReferrer))
Ted C 2016/06/13 23:27:21 do we need to do any more sanity checking on the r
Maria 2016/06/13 23:46:26 Yeah, I was thinking about this too. I figured the
+ .build();
+ intent = new Intent(Intent.ACTION_VIEW, marketUri);
intent.addCategory(Intent.CATEGORY_BROWSABLE);
intent.setPackage("com.android.vending");
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
« no previous file with comments | « no previous file | chrome/android/javatests/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandlerTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698