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

Unified Diff: content/browser/service_worker/service_worker_client_utils.cc

Issue 2893823004: [Payments] Implement openWindow for service worker based payment handler (Closed)
Patch Set: address comments Created 3 years, 7 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: 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)));
}

Powered by Google App Engine
This is Rietveld 408576698