OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/web_contents/web_contents_impl.h" | 5 #include "content/browser/web_contents/web_contents_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 3390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3401 } | 3401 } |
3402 | 3402 |
3403 int WebContentsImpl::CreateOpenerRenderViews(SiteInstance* instance) { | 3403 int WebContentsImpl::CreateOpenerRenderViews(SiteInstance* instance) { |
3404 int opener_route_id = MSG_ROUTING_NONE; | 3404 int opener_route_id = MSG_ROUTING_NONE; |
3405 | 3405 |
3406 // If this tab has an opener, ensure it has a RenderView in the given | 3406 // If this tab has an opener, ensure it has a RenderView in the given |
3407 // SiteInstance as well. | 3407 // SiteInstance as well. |
3408 if (opener_) | 3408 if (opener_) |
3409 opener_route_id = opener_->CreateOpenerRenderViews(instance); | 3409 opener_route_id = opener_->CreateOpenerRenderViews(instance); |
3410 | 3410 |
3411 // If any of the renderers for this WebContents has the same SiteInstance, | 3411 // If any of the renderers (current, pending, or swapped out) for this |
3412 // use it. | 3412 // WebContents has the same SiteInstance, use it. |
3413 if (render_manager_.current_host()->GetSiteInstance() == instance) | 3413 if (render_manager_.current_host()->GetSiteInstance() == instance) |
3414 return render_manager_.current_host()->GetRoutingID(); | 3414 return render_manager_.current_host()->GetRoutingID(); |
3415 | 3415 |
| 3416 if (render_manager_.pending_render_view_host() && |
| 3417 render_manager_.pending_render_view_host()->GetSiteInstance() == instance) |
| 3418 return render_manager_.pending_render_view_host()->GetRoutingID(); |
| 3419 |
3416 RenderViewHostImpl* rvh = render_manager_.GetSwappedOutRenderViewHost( | 3420 RenderViewHostImpl* rvh = render_manager_.GetSwappedOutRenderViewHost( |
3417 instance); | 3421 instance); |
3418 if (rvh) | 3422 if (rvh) |
3419 return rvh->GetRoutingID(); | 3423 return rvh->GetRoutingID(); |
3420 | 3424 |
3421 // Create a swapped out RenderView in the given SiteInstance if none exists, | 3425 // Create a swapped out RenderView in the given SiteInstance if none exists, |
3422 // setting its opener to the given route_id. Return the new view's route_id. | 3426 // setting its opener to the given route_id. Return the new view's route_id. |
3423 return render_manager_.CreateRenderView(instance, opener_route_id, true); | 3427 return render_manager_.CreateRenderView(instance, opener_route_id, true); |
3424 } | 3428 } |
3425 | 3429 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3529 | 3533 |
3530 BrowserPluginGuest* WebContentsImpl::GetBrowserPluginGuest() const { | 3534 BrowserPluginGuest* WebContentsImpl::GetBrowserPluginGuest() const { |
3531 return browser_plugin_guest_.get(); | 3535 return browser_plugin_guest_.get(); |
3532 } | 3536 } |
3533 | 3537 |
3534 BrowserPluginEmbedder* WebContentsImpl::GetBrowserPluginEmbedder() const { | 3538 BrowserPluginEmbedder* WebContentsImpl::GetBrowserPluginEmbedder() const { |
3535 return browser_plugin_embedder_.get(); | 3539 return browser_plugin_embedder_.get(); |
3536 } | 3540 } |
3537 | 3541 |
3538 } // namespace content | 3542 } // namespace content |
OLD | NEW |