Index: content/browser/service_worker/service_worker_client_utils.cc |
diff --git a/content/browser/service_worker/service_worker_client_utils.cc b/content/browser/service_worker/service_worker_client_utils.cc |
index 2888bd48de6fa6f1f0374f70b58940686f576798..1b00a8ae22ad313167593dc49b1d2825d788161b 100644 |
--- a/content/browser/service_worker/service_worker_client_utils.cc |
+++ b/content/browser/service_worker/service_worker_client_utils.cc |
@@ -176,6 +176,7 @@ void DidOpenURLOnUI(const OpenURLCallback& callback, |
} |
void OpenWindowOnUI( |
+ const GURL& redirect_url, |
const GURL& url, |
const GURL& script_url, |
int worker_process_id, |
@@ -205,9 +206,14 @@ void OpenWindowOnUI( |
url, |
Referrer::SanitizeForRequest( |
url, Referrer(script_url, blink::kWebReferrerPolicyDefault)), |
- WindowOpenDisposition::NEW_FOREGROUND_TAB, |
+ redirect_url.is_valid() ? WindowOpenDisposition::NEW_POPUP |
+ : WindowOpenDisposition::NEW_FOREGROUND_TAB, |
ui::PAGE_TRANSITION_AUTO_TOPLEVEL, true /* is_renderer_initiated */); |
+ if (redirect_url.is_valid()) { |
+ params.redirect_chain.emplace_back(redirect_url); |
+ } |
+ |
GetContentClient()->browser()->OpenURL(browser_context, params, |
base::Bind(&DidOpenURLOnUI, callback)); |
} |
@@ -434,7 +440,8 @@ void FocusWindowClient(ServiceWorkerProviderHost* provider_host, |
callback); |
} |
-void OpenWindow(const GURL& url, |
+void OpenWindow(const GURL& redirect_url, |
+ const GURL& url, |
const GURL& script_url, |
int worker_process_id, |
const base::WeakPtr<ServiceWorkerContextCore>& context, |
@@ -443,7 +450,7 @@ void OpenWindow(const GURL& url, |
BrowserThread::PostTask( |
BrowserThread::UI, FROM_HERE, |
base::Bind( |
- &OpenWindowOnUI, url, script_url, worker_process_id, |
+ &OpenWindowOnUI, redirect_url, url, script_url, worker_process_id, |
make_scoped_refptr(context->wrapper()), |
base::Bind(&DidNavigate, context, script_url.GetOrigin(), callback))); |
} |