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

Unified Diff: content/browser/web_contents/web_contents_impl.cc

Issue 2821473002: Service CreateNewWindow on the UI thread with a new mojo interface (Closed)
Patch Set: dcheng fixes + security exploit browsertest nerfing Created 3 years, 8 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/web_contents/web_contents_impl.cc
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index e0d64d07eab267edf2e559e905078c3dfda9145c..8c8b0af600c0f2944d61ad2e6cdba782d657ff9e 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -2045,6 +2045,7 @@ void WebContentsImpl::OnRenderFrameProxyVisibilityChanged(bool visible) {
void WebContentsImpl::CreateNewWindow(
SiteInstance* source_site_instance,
+ RenderFrameHost* opener,
int32_t render_view_route_id,
int32_t main_frame_route_id,
int32_t main_frame_widget_route_id,
@@ -2112,6 +2113,8 @@ void WebContentsImpl::CreateNewWindow(
return;
}
+ int opener_render_frame_id = opener->GetRoutingID();
ncarter (slow) 2017/04/20 21:30:36 Just inline this: there are multiple render_frame_
Charlie Harrison 2017/04/21 15:30:07 Done.
+
// Create the new web contents. This will automatically create the new
// WebContentsView. In the future, we may want to create the view separately.
CreateParams create_params(GetBrowserContext(), site_instance.get());
@@ -2120,7 +2123,7 @@ void WebContentsImpl::CreateNewWindow(
create_params.main_frame_widget_routing_id = main_frame_widget_route_id;
create_params.main_frame_name = params.frame_name;
create_params.opener_render_process_id = render_process_id;
- create_params.opener_render_frame_id = params.opener_render_frame_id;
+ create_params.opener_render_frame_id = opener_render_frame_id;
create_params.opener_suppressed = params.opener_suppressed;
if (params.disposition == WindowOpenDisposition::NEW_BACKGROUND_TAB)
create_params.initially_hidden = true;
@@ -2167,19 +2170,16 @@ void WebContentsImpl::CreateNewWindow(
}
if (delegate_) {
- delegate_->WebContentsCreated(
- this, render_process_id, params.opener_render_frame_id,
- params.frame_name, params.target_url, new_contents);
+ delegate_->WebContentsCreated(this, render_process_id,
+ opener->GetRoutingID(), params.frame_name,
+ params.target_url, new_contents);
}
- RenderFrameHost* source_render_frame_host =
- RenderFrameHost::FromID(render_process_id, params.opener_render_frame_id);
-
- if (source_render_frame_host) {
+ if (opener) {
for (auto& observer : observers_) {
- observer.DidOpenRequestedURL(new_contents, source_render_frame_host,
- params.target_url, params.referrer,
- params.disposition, ui::PAGE_TRANSITION_LINK,
+ observer.DidOpenRequestedURL(new_contents, opener, params.target_url,
+ params.referrer, params.disposition,
+ ui::PAGE_TRANSITION_LINK,
false, // started_from_context_menu
true); // renderer_initiated
}

Powered by Google App Engine
This is Rietveld 408576698