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

Unified Diff: content/browser/frame_host/interstitial_page_impl.cc

Issue 117693002: Make RenderFrameHostManager swap RenderFrameHosts, not RenderViewHosts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix merge conflicts Created 7 years 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/frame_host/interstitial_page_impl.cc
diff --git a/content/browser/frame_host/interstitial_page_impl.cc b/content/browser/frame_host/interstitial_page_impl.cc
index 7e56e4fb95668f6dd5a0d912b60a49b4b04e5e45..8d33a46deaec930772d6981c03b29118115770de 100644
--- a/content/browser/frame_host/interstitial_page_impl.cc
+++ b/content/browser/frame_host/interstitial_page_impl.cc
@@ -162,7 +162,7 @@ InterstitialPageImpl::InterstitialPageImpl(
// TODO(creis): We will also need to pass delegates for the RVHM as we
// start to use it.
frame_tree_(new InterstitialPageNavigatorImpl(this, controller_),
- NULL, NULL, NULL, NULL),
+ this, this, this, NULL),
original_child_id_(web_contents->GetRenderProcessHost()->GetID()),
original_rvh_id_(web_contents->GetRenderViewHost()->GetRoutingID()),
should_revert_web_contents_title_(false),
@@ -284,15 +284,15 @@ void InterstitialPageImpl::Hide() {
controller_->delegate()->GetRenderViewHost()->GetView())->Focus();
}
- // Shutdown the RVH asynchronously, as we may have been called from a RVH
- // delegate method, and we can't delete the RVH out from under itself.
+ // Delete this and call Shutdown on the RVH asynchronously, as we may have
+ // been called from a RVH delegate method, and we can't delete the RVH out
+ // from under itself.
base::MessageLoop::current()->PostNonNestableTask(
FROM_HERE,
base::Bind(&InterstitialPageImpl::Shutdown,
- weak_ptr_factory_.GetWeakPtr(),
- render_view_host_));
+ weak_ptr_factory_.GetWeakPtr()));
render_view_host_ = NULL;
- frame_tree_.SwapMainFrame(NULL);
+ frame_tree_.ResetForMainFrameSwap();
controller_->delegate()->DetachInterstitialPage();
// Let's revert to the original title if necessary.
NavigationEntry* entry = controller_->GetVisibleEntry();
@@ -487,7 +487,8 @@ WebPreferences InterstitialPageImpl::GetWebkitPrefs() {
void InterstitialPageImpl::RenderWidgetDeleted(
RenderWidgetHostImpl* render_widget_host) {
- delete this;
+ // TODO(creis): Remove this method once we verify the shutdown path is sane.
+ CHECK(!web_contents_);
}
bool InterstitialPageImpl::PreHandleKeyboardEvent(
@@ -532,14 +533,10 @@ RenderViewHost* InterstitialPageImpl::CreateRenderViewHost() {
session_storage_namespace_ =
new SessionStorageNamespaceImpl(dom_storage_context);
- return RenderViewHostFactory::Create(site_instance.get(),
- this,
- this,
- this,
- MSG_ROUTING_NONE,
- MSG_ROUTING_NONE,
- false,
- false);
+ // Use the RenderViewHost from our FrameTree.
+ frame_tree_.root()->render_manager()->Init(
+ browser_context, site_instance.get(), MSG_ROUTING_NONE, MSG_ROUTING_NONE);
+ return frame_tree_.root()->current_frame_host()->render_view_host();
}
WebContentsView* InterstitialPageImpl::CreateWebContentsView() {
@@ -559,7 +556,7 @@ WebContentsView* InterstitialPageImpl::CreateWebContentsView() {
MSG_ROUTING_NONE,
max_page_id);
controller_->delegate()->RenderFrameForInterstitialPageCreated(
- frame_tree_.root()->render_frame_host());
+ frame_tree_.root()->current_frame_host());
view->SetSize(web_contents_view->GetContainerSize());
// Don't show the interstitial until we have navigated to it.
view->Hide();
@@ -757,9 +754,8 @@ void InterstitialPageImpl::Disable() {
enabled_ = false;
}
-void InterstitialPageImpl::Shutdown(RenderViewHostImpl* render_view_host) {
- render_view_host->Shutdown();
- // We are deleted now.
+void InterstitialPageImpl::Shutdown() {
+ delete this;
}
void InterstitialPageImpl::OnNavigatingAwayOrTabClosing() {
« no previous file with comments | « content/browser/frame_host/interstitial_page_impl.h ('k') | content/browser/frame_host/render_frame_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698