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

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

Issue 13649007: Browser Plugin: Simplify NewWindow code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comment Created 7 years, 9 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
« no previous file with comments | « content/browser/browser_plugin/browser_plugin_guest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 a4ff3e39f1f5582bb0efccdde877ccaa6b7159ec..ed9cb5ed2102259bb1ab061d4e04ae98c0ae4921 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -1355,15 +1355,15 @@ void WebContentsImpl::CreateNewWindow(
new_contents->Init(create_params);
// Save the window for later if we're not suppressing the opener (since it
- // will be shown immediately) and if it's not a guest (since we separately
- // track when to show guests).
- if (!params.opener_suppressed && !is_guest) {
- WebContentsViewPort* new_view = new_contents->view_.get();
-
- // TODO(brettw): It seems bogus that we have to call this function on the
- // newly created object and give it one of its own member variables.
- new_view->CreateViewForWidget(new_contents->GetRenderViewHost());
-
+ // will be shown immediately).
+ if (!params.opener_suppressed) {
+ if (!is_guest) {
+ WebContentsViewPort* new_view = new_contents->view_.get();
+
+ // TODO(brettw): It seems bogus that we have to call this function on the
+ // newly created object and give it one of its own member variables.
+ new_view->CreateViewForWidget(new_contents->GetRenderViewHost());
+ }
// Save the created window associated with the route so we can show it
// later.
DCHECK_NE(MSG_ROUTING_NONE, route_id);
@@ -1507,6 +1507,10 @@ WebContentsImpl* WebContentsImpl::GetCreatedWindow(int route_id) {
registrar_.Remove(this, NOTIFICATION_WEB_CONTENTS_DESTROYED,
Source<WebContents>(new_contents));
+ // Don't initialize the guest WebContents immediately.
+ if (new_contents->GetRenderProcessHost()->IsGuest())
+ return new_contents;
+
if (!new_contents->GetRenderProcessHost()->HasConnection() ||
!new_contents->GetRenderViewHost()->GetView())
return NULL;
« no previous file with comments | « content/browser/browser_plugin/browser_plugin_guest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698