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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/tab/TabRedirectHandler.java

Issue 2387293005: Change external link handling policy for CCTs (Closed)
Patch Set: nits Created 4 years, 2 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/tab/TabRedirectHandler.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tab/TabRedirectHandler.java b/chrome/android/java/src/org/chromium/chrome/browser/tab/TabRedirectHandler.java
index c65b17552a230a51194b50edd827248164df616b..cde7bd39aa98f3098003496bae8e90046dcba847 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/tab/TabRedirectHandler.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/tab/TabRedirectHandler.java
@@ -12,6 +12,8 @@ import android.os.SystemClock;
import android.provider.Browser;
import android.text.TextUtils;
+import org.chromium.chrome.browser.ChromeFeatureList;
+import org.chromium.chrome.browser.customtabs.CustomTabIntentDataProvider;
import org.chromium.chrome.browser.document.ChromeLauncherActivity;
import org.chromium.chrome.browser.util.IntentUtils;
import org.chromium.ui.base.PageTransition;
@@ -70,15 +72,19 @@ public class TabRedirectHandler {
if (mContext == null || intent == null || !Intent.ACTION_VIEW.equals(intent.getAction())) {
return;
}
+ mIsCustomTabIntent = ChromeLauncherActivity.isCustomTabIntent(intent);
+ boolean sendToExternalApps = IntentUtils.safeGetBooleanExtra(
Ted C 2016/10/05 23:51:38 This is getting harder to read, and I wonder if so
+ intent, CustomTabIntentDataProvider.EXTRA_SEND_TO_EXTERNAL_DEFAULT_HANDLER, false);
+ boolean dontMarkAsHeadingToChrome = mIsCustomTabIntent && sendToExternalApps
+ && ChromeFeatureList.isEnabled(ChromeFeatureList.CCT_EXTERNAL_LINK_HANDLING);
String chromePackageName = mContext.getPackageName();
// If an intent is heading explicitly to Chrome, we should stay in Chrome.
- if (TextUtils.equals(chromePackageName, intent.getPackage())
+ if ((TextUtils.equals(chromePackageName, intent.getPackage())
|| TextUtils.equals(chromePackageName, IntentUtils.safeGetStringExtra(intent,
- Browser.EXTRA_APPLICATION_ID))) {
+ Browser.EXTRA_APPLICATION_ID))) && !dontMarkAsHeadingToChrome) {
mIsInitialIntentHeadingToChrome = true;
}
- mIsCustomTabIntent = ChromeLauncherActivity.isCustomTabIntent(intent);
// Copies minimum information to retrieve resolvers.
mInitialIntent = new Intent(Intent.ACTION_VIEW);

Powered by Google App Engine
This is Rietveld 408576698