| Index: chrome/android/java/src/org/chromium/chrome/browser/ServiceTabLauncher.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ServiceTabLauncher.java b/chrome/android/java/src/org/chromium/chrome/browser/ServiceTabLauncher.java
|
| index b8b840b967d719ed591910d1cddc24ff7f144350..6298660ebca303285109387a8872b31176315cfc 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/ServiceTabLauncher.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/ServiceTabLauncher.java
|
| @@ -6,8 +6,10 @@ package org.chromium.chrome.browser;
|
|
|
| import android.content.Intent;
|
| import android.os.AsyncTask;
|
| +import android.support.annotation.Nullable;
|
|
|
| import org.chromium.base.ContextUtils;
|
| +import org.chromium.base.ThreadUtils;
|
| import org.chromium.base.annotations.CalledByNative;
|
| import org.chromium.chrome.browser.tab.Tab;
|
| import org.chromium.chrome.browser.tabmodel.TabModel.TabLaunchType;
|
| @@ -21,6 +23,7 @@ import org.chromium.content_public.browser.WebContents;
|
| import org.chromium.content_public.common.Referrer;
|
| import org.chromium.content_public.common.ResourceRequestBody;
|
| import org.chromium.ui.base.PageTransition;
|
| +import org.chromium.ui.mojom.WindowOpenDisposition;
|
| import org.chromium.webapk.lib.client.WebApkNavigationClient;
|
| import org.chromium.webapk.lib.client.WebApkValidator;
|
|
|
| @@ -39,14 +42,14 @@ public class ServiceTabLauncher {
|
|
|
| /**
|
| * Launches the browser activity and launches a tab for |url|.
|
| - * @param requestId Id of the request for launching this tab.
|
| - * @param incognito Whether the tab should be launched in incognito mode.
|
| - * @param url The URL which should be launched in a tab.
|
| - * @param disposition The disposition requested by the navigation source.
|
| - * @param referrerUrl URL of the referrer which is opening the page.
|
| + * @param requestId Id of the request for launching this tab.
|
| + * @param incognito Whether the tab should be launched in incognito mode.
|
| + * @param url The URL which should be launched in a tab.
|
| + * @param disposition The disposition requested by the navigation source.
|
| + * @param referrerUrl URL of the referrer which is opening the page.
|
| * @param referrerPolicy The referrer policy to consider when applying the referrer.
|
| - * @param extraHeaders Extra headers to apply when requesting the tab's URL.
|
| - * @param postData Post-data to include in the tab URL's request body.
|
| + * @param extraHeaders Extra headers to apply when requesting the tab's URL.
|
| + * @param postData Post-data to include in the tab URL's request body.
|
| */
|
| @CalledByNative
|
| public static void launchTab(final int requestId, final boolean incognito, final String url,
|
| @@ -54,6 +57,20 @@ public class ServiceTabLauncher {
|
| final String extraHeaders, final ResourceRequestBody postData) {
|
| final TabDelegate tabDelegate = new TabDelegate(incognito);
|
|
|
| + // Open popup window in custom tab.
|
| + // Note that this is used by PaymentRequestEvent.openWindow().
|
| + if (disposition == WindowOpenDisposition.NEW_POPUP) {
|
| + if (!tabDelegate.createPopupCustomTab(requestId, url)) {
|
| + ThreadUtils.postOnUiThread(new Runnable() {
|
| + @Override
|
| + public void run() {
|
| + onWebContentsForRequestAvailable(requestId, null);
|
| + }
|
| + });
|
| + }
|
| + return;
|
| + }
|
| +
|
| // 1. Launch WebAPK if one matches the target URL.
|
| if (ChromeWebApkHost.isEnabled()) {
|
| String webApkPackageName =
|
| @@ -122,11 +139,13 @@ public class ServiceTabLauncher {
|
| * To be called by the activity when the WebContents for |requestId| has been created, or has
|
| * been recycled from previous use. The |webContents| must not yet have started provisional
|
| * load for the main frame.
|
| + * The |webContents| could be null if the request is failed.
|
| *
|
| * @param requestId Id of the tab launching request which has been fulfilled.
|
| * @param webContents The WebContents instance associated with this request.
|
| */
|
| - public static void onWebContentsForRequestAvailable(int requestId, WebContents webContents) {
|
| + public static void onWebContentsForRequestAvailable(
|
| + int requestId, @Nullable WebContents webContents) {
|
| nativeOnWebContentsForRequestAvailable(requestId, webContents);
|
| }
|
|
|
|
|