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

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

Issue 1136443004: Allow an Intent navigation even when a user types if a URL is server redirect and has an external p… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 5 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
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/tab/TabRedirectHandler.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 2ef867b3d7efe92fff52724ab59f63a42e6d1c77..28fb29d8470e1552c65186b201328e6bf93cd867 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
@@ -125,6 +125,13 @@ public class ExternalNavigationHandler {
boolean isFromIntent = (params.getPageTransition() & PageTransition.FROM_API) != 0;
boolean isForwardBackNavigation =
(params.getPageTransition() & PageTransition.FORWARD_BACK) != 0;
+ boolean isExternalProtocol = !UrlUtilities.isAcceptedScheme(params.getUrl());
+
+ // http://crbug.com/169549 : If you type in a URL that then redirects in server side to an
+ // link that cannot be rendered by the browser, we want to show the intent picker.
+ boolean isTyped = pageTransitionCore == PageTransition.TYPED;
+ boolean typedRedirectToExternalProtocol = isTyped && params.isRedirect()
+ && isExternalProtocol;
// We do not want to show the intent picker for core types typed, bookmarks, auto toplevel,
// generated, keyword, keyword generated. See below for exception to typed URL and
@@ -167,8 +174,14 @@ public class ExternalNavigationHandler {
// following a form submit.
boolean isRedirectFromFormSubmit = isFormSubmit && params.isRedirect();
- if (!linkNotFromIntent && !incomingIntentRedirect && !isRedirectFromFormSubmit) {
- return OverrideUrlLoadingResult.NO_OVERRIDE;
+ if (!typedRedirectToExternalProtocol) {
+ if (!linkNotFromIntent && !incomingIntentRedirect && !isRedirectFromFormSubmit) {
+ return OverrideUrlLoadingResult.NO_OVERRIDE;
+ }
+ if (params.getRedirectHandler() != null
+ && params.getRedirectHandler().isNavigationFromUserTyping()) {
+ return OverrideUrlLoadingResult.NO_OVERRIDE;
+ }
}
// Don't override navigation from a chrome:* url to http or https. For example,
@@ -270,7 +283,7 @@ public class ExternalNavigationHandler {
// Make sure webkit can handle it internally before checking for specialized
// handlers. If webkit can't handle it internally, we need to call
// startActivityIfNeeded or startActivity.
- if (UrlUtilities.isAcceptedScheme(params.getUrl())) {
+ if (!isExternalProtocol) {
if (!mDelegate.isSpecializedHandlerAvailable(intent)) {
return OverrideUrlLoadingResult.NO_OVERRIDE;
} else if (params.getReferrerUrl() != null && isLink) {
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/tab/TabRedirectHandler.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698