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

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

Issue 2537293002: Instant Apps: Allow custom tab redirects to Instant Apps. (Closed)
Patch Set: Created 4 years, 1 month 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 74de988d8e83d05f32924d6e7fef9d6d8031e1f7..89b3a028b19e1ba70d4ee56a054e7de5544614ae 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
@@ -206,12 +206,35 @@ public class ExternalNavigationHandler {
return OverrideUrlLoadingResult.OVERRIDE_WITH_ASYNC_ACTION;
}
+ // http://crbug.com/149218: We want to show the intent picker for ordinary links, providing
+ // the link is not an incoming intent from another application, unless it's a redirect (see
+ // below).
+ boolean linkNotFromIntent = isLink && !isFromIntent;
+
+ boolean isOnEffectiveIntentRedirect = params.getRedirectHandler() == null ? false
+ : params.getRedirectHandler().isOnEffectiveIntentRedirectChain();
+
+ // http://crbug.com/170925: We need to show the intent picker when we receive an intent from
+ // another app that 30x redirects to a YouTube/Google Maps/Play Store/Google+ URL etc.
+ boolean incomingIntentRedirect = (isLink && isFromIntent && params.isRedirect())
+ || isOnEffectiveIntentRedirect;
+
+
// http://crbug/331571 : Do not override a navigation started from user typing.
// http://crbug/424029 : Need to stay in Chrome for an intent heading explicitly to Chrome.
if (params.getRedirectHandler() != null) {
TabRedirectHandler handler = params.getRedirectHandler();
if (handler.shouldStayInChrome(isExternalProtocol)
|| handler.shouldNotOverrideUrlLoading()) {
+ // http://crbug.com/659301: Handle redirects to Instant Apps out of Custom Tabs.
+ if (handler.isFromCustomTabIntent()
+ && !isExternalProtocol
+ && incomingIntentRedirect
+ && !handler.shouldNavigationTypeStayInChrome()
+ && mDelegate.maybeLaunchInstantApp(params.getTab(), params.getUrl(),
+ params.getReferrerUrl(), true)) {
+ return OverrideUrlLoadingResult.OVERRIDE_WITH_EXTERNAL_INTENT;
+ }
return OverrideUrlLoadingResult.NO_OVERRIDE;
}
}
@@ -221,19 +244,6 @@ public class ExternalNavigationHandler {
return OverrideUrlLoadingResult.NO_OVERRIDE;
}
- // http://crbug.com/149218: We want to show the intent picker for ordinary links, providing
- // the link is not an incoming intent from another application, unless it's a redirect (see
- // below).
- boolean linkNotFromIntent = isLink && !isFromIntent;
-
- boolean isOnEffectiveIntentRedirect = params.getRedirectHandler() == null ? false
- : params.getRedirectHandler().isOnEffectiveIntentRedirectChain();
-
- // http://crbug.com/170925: We need to show the intent picker when we receive an intent from
- // another app that 30x redirects to a YouTube/Google Maps/Play Store/Google+ URL etc.
- boolean incomingIntentRedirect = (isLink && isFromIntent && params.isRedirect())
- || isOnEffectiveIntentRedirect;
-
// http://crbug.com/181186: We need to show the intent picker when we receive a redirect
// following a form submit.
boolean isRedirectFromFormSubmit = isFormSubmit && params.isRedirect();
« 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