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

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: . 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..e045e2117950d78b9606711aa0859aa25ad2818b 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,19 @@ public class ExternalNavigationHandler {
return OverrideUrlLoadingResult.NO_OVERRIDE;
}
- if (params.getReferrerUrl() != null && (isLink || isFormSubmit)) {
+ String delegatePreviousUrl = mDelegate.getPreviousUrl();
+ String previousUriString =
+ delegatePreviousUrl != null ? delegatePreviousUrl : params.getReferrerUrl();
+ 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 +451,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