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

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: correct file changes 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..d675bbdd89d142fda9f55e6b13f1ba94c33471f9 100644
--- a/content/browser/service_worker/service_worker_client_utils.cc
+++ b/content/browser/service_worker/service_worker_client_utils.cc
@@ -176,7 +176,8 @@ void DidOpenURLOnUI(const OpenURLCallback& callback,
}
void OpenWindowOnUI(
- const GURL& url,
+ const GURL& redirect_url,
+ const GURL& url_to_open,
const GURL& script_url,
int worker_process_id,
const scoped_refptr<ServiceWorkerContextWrapper>& context_wrapper,
@@ -202,12 +203,17 @@ void OpenWindowOnUI(
}
OpenURLParams params(
- url,
+ url_to_open,
Referrer::SanitizeForRequest(
- url, Referrer(script_url, blink::kWebReferrerPolicyDefault)),
- WindowOpenDisposition::NEW_FOREGROUND_TAB,
+ url_to_open, Referrer(script_url, blink::kWebReferrerPolicyDefault)),
+ 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);
falken 2017/06/01 07:24:07 Is there a specific reason you must add to the red
gogerald 2017/06/01 13:47:36 Your understanding is correct. Didn't know redirec
please use gerrit instead 2017/06/01 17:50:37 I would recommend to add "source_type" parameter t
gogerald1 2017/06/02 03:33:11 Acknowledged.
+ }
+
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_to_open,
const GURL& script_url,
int worker_process_id,
const base::WeakPtr<ServiceWorkerContextCore>& context,
@@ -443,8 +450,8 @@ void OpenWindow(const GURL& url,
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
base::Bind(
- &OpenWindowOnUI, url, script_url, worker_process_id,
- make_scoped_refptr(context->wrapper()),
+ &OpenWindowOnUI, redirect_url, url_to_open, 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