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

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

Issue 2885983002: Fixes intent chooser being shown incorrectly when going from HTTPS to HTTP for (Closed)
Patch Set: Minor cleanup Created 3 years, 7 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/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 b55cb35573e489e953ecfa32da82b40a3b23e5b9..36f13027c5e385208c2382bc808a3296d4bed1b7 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
@@ -429,15 +429,18 @@ public class ExternalNavigationHandler {
return OverrideUrlLoadingResult.NO_OVERRIDE;
}
- if (params.getReferrerUrl() != null && (isLink || isFormSubmit)) {
+ String previousUriString = params.getReferrerUrl() != null ? params.getReferrerUrl()
+ : mDelegate.getPreviousUrl();
Maria 2017/05/17 00:29:18 I wonder if we should use previous URL by default
Maria 2017/05/17 00:29:18 did you run git cl format on this CL, the formatti
troyhildebrandt 2017/05/17 20:19:10 Done.
troyhildebrandt 2017/05/17 20:19:10 I've switched it, but is there any case where we'd
+ if (previousUriString != null && (isLink || isFormSubmit)) {
// Current URL has at least one specialized handler available. For navigations
// within the same host, keep the navigation inside the browser unless the set of
// available apps to handle the new navigation is different. http://crbug.com/463138
URI currentUri;
URI previousUri;
+
try {
currentUri = new URI(params.getUrl());
- previousUri = new URI(params.getReferrerUrl());
+ previousUri = new URI(previousUriString);
} catch (Exception e) {
currentUri = null;
previousUri = null;
@@ -447,15 +450,15 @@ public class ExternalNavigationHandler {
&& TextUtils.equals(currentUri.getHost(), previousUri.getHost())) {
Intent previousIntent;
try {
- previousIntent = Intent.parseUri(
- params.getReferrerUrl(), Intent.URI_INTENT_SCHEME);
+ previousIntent =
+ Intent.parseUri(previousUriString, Intent.URI_INTENT_SCHEME);
} catch (Exception e) {
previousIntent = null;
}
if (previousIntent != null
&& resolversSubsetOf(resolvingInfos,
- mDelegate.queryIntentActivities(previousIntent))) {
+ mDelegate.queryIntentActivities(previousIntent))) {
if (DEBUG) Log.i(TAG, "NO_OVERRIDE: Same host, no new resolvers");
return OverrideUrlLoadingResult.NO_OVERRIDE;
}

Powered by Google App Engine
This is Rietveld 408576698