Commit a49a594b authored by Peter Kotwicz's avatar Peter Kotwicz Committed by Commit Bot

[Android CCT] Do not use StartupTabPreloader's tab for POST share intent

This CL fixes the LoadUrlParams matching in
CustomTabActivityTabController#maybeTakeTabFromStartupTabPreloader()
and does not use StartupTabPreloader's tab if the CCT was launched
as a result of a POST share intent.

BUG=1035752

Change-Id: Ib0e3c4dde6811f85848fffbf585e6e2faea62038
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1974864Reviewed-by: default avatarPeter Conn <peconn@chromium.org>
Commit-Queue: Peter Kotwicz <pkotwicz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#729779}
parent cfa3485b
......@@ -14,6 +14,7 @@ import android.view.Window;
import androidx.annotation.IntDef;
import androidx.annotation.Nullable;
import androidx.browser.customtabs.CustomTabsSessionToken;
import androidx.browser.trusted.sharing.ShareTarget;
import org.chromium.base.metrics.RecordHistogram;
import org.chromium.chrome.browser.ActivityTabProvider;
......@@ -256,6 +257,15 @@ public class CustomTabActivityTabController
// Don't overwrite any pre-existing tab.
if (mTabProvider.getTab() != null) return null;
ShareTarget shareTarget = mIntentDataProvider.getShareTarget();
if (mIntentDataProvider.getShareData() != null && shareTarget != null
&& ShareTarget.METHOD_POST.equals(shareTarget.method)) {
// The navigation is likely a POST (We don't do a POST navigation if the POST
// target is outside of the TWA scope.) This does not match
// StartupTabPreloader's GET navigation.
return null;
}
LoadUrlParams loadUrlParams = new LoadUrlParams(mIntentDataProvider.getUrlToLoad());
String referrer = mConnection.getReferrer(mSession, mIntent);
if (referrer != null && !referrer.isEmpty()) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment