| 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 3402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3413 } | 3413 } |
| 3414 | 3414 |
| 3415 int WebContentsImpl::CreateOpenerRenderViews(SiteInstance* instance) { | 3415 int WebContentsImpl::CreateOpenerRenderViews(SiteInstance* instance) { |
| 3416 int opener_route_id = MSG_ROUTING_NONE; | 3416 int opener_route_id = MSG_ROUTING_NONE; |
| 3417 | 3417 |
| 3418 // If this tab has an opener, ensure it has a RenderView in the given | 3418 // If this tab has an opener, ensure it has a RenderView in the given |
| 3419 // SiteInstance as well. | 3419 // SiteInstance as well. |
| 3420 if (opener_) | 3420 if (opener_) |
| 3421 opener_route_id = opener_->CreateOpenerRenderViews(instance); | 3421 opener_route_id = opener_->CreateOpenerRenderViews(instance); |
| 3422 | 3422 |
| 3423 // If any of the renderers for this WebContents has the same SiteInstance, | 3423 // If any of the renderers (current, pending, or swapped out) for this |
| 3424 // use it. | 3424 // WebContents has the same SiteInstance, use it. |
| 3425 if (render_manager_.current_host()->GetSiteInstance() == instance) | 3425 if (render_manager_.current_host()->GetSiteInstance() == instance) |
| 3426 return render_manager_.current_host()->GetRoutingID(); | 3426 return render_manager_.current_host()->GetRoutingID(); |
| 3427 | 3427 |
| 3428 if (render_manager_.pending_render_view_host() && |
| 3429 render_manager_.pending_render_view_host()->GetSiteInstance() == instance) |
| 3430 return render_manager_.pending_render_view_host()->GetRoutingID(); |
| 3431 |
| 3428 RenderViewHostImpl* rvh = render_manager_.GetSwappedOutRenderViewHost( | 3432 RenderViewHostImpl* rvh = render_manager_.GetSwappedOutRenderViewHost( |
| 3429 instance); | 3433 instance); |
| 3430 if (rvh) | 3434 if (rvh) |
| 3431 return rvh->GetRoutingID(); | 3435 return rvh->GetRoutingID(); |
| 3432 | 3436 |
| 3433 // Create a swapped out RenderView in the given SiteInstance if none exists, | 3437 // Create a swapped out RenderView in the given SiteInstance if none exists, |
| 3434 // setting its opener to the given route_id. Return the new view's route_id. | 3438 // setting its opener to the given route_id. Return the new view's route_id. |
| 3435 return render_manager_.CreateRenderView(instance, opener_route_id, true); | 3439 return render_manager_.CreateRenderView(instance, opener_route_id, true); |
| 3436 } | 3440 } |
| 3437 | 3441 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3541 | 3545 |
| 3542 BrowserPluginGuest* WebContentsImpl::GetBrowserPluginGuest() const { | 3546 BrowserPluginGuest* WebContentsImpl::GetBrowserPluginGuest() const { |
| 3543 return browser_plugin_guest_.get(); | 3547 return browser_plugin_guest_.get(); |
| 3544 } | 3548 } |
| 3545 | 3549 |
| 3546 BrowserPluginEmbedder* WebContentsImpl::GetBrowserPluginEmbedder() const { | 3550 BrowserPluginEmbedder* WebContentsImpl::GetBrowserPluginEmbedder() const { |
| 3547 return browser_plugin_embedder_.get(); | 3551 return browser_plugin_embedder_.get(); |
| 3548 } | 3552 } |
| 3549 | 3553 |
| 3550 } // namespace content | 3554 } // namespace content |
| OLD | NEW |