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

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

Issue 1425293006: Move nav_entry_id from RenderViewHost to RenderFrameHost. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Initial patch Created 5 years, 1 month 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 | « no previous file | content/browser/frame_host/render_frame_host_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/frame_host/navigation_controller_impl.cc
diff --git a/content/browser/frame_host/navigation_controller_impl.cc b/content/browser/frame_host/navigation_controller_impl.cc
index 4264c62530615b8591dc7d43129da0d7e648783e..6ceff9aaf77d75f603fccee95f94611d92d51d7f 100644
--- a/content/browser/frame_host/navigation_controller_impl.cc
+++ b/content/browser/frame_host/navigation_controller_impl.cc
@@ -145,6 +145,13 @@ bool ShouldKeepOverride(const NavigationEntry* last_entry) {
return last_entry && last_entry->GetIsOverridingUserAgent();
}
+// Helper method for FrameTree::ForEach to set the nav_entry_id on each current
+// RenderFrameHost in the tree.
+bool SetFrameNavEntryID(int nav_entry_id, FrameTreeNode* node) {
+ node->current_frame_host()->set_nav_entry_id(nav_entry_id);
+ return true;
+}
+
} // namespace
// NavigationControllerImpl ----------------------------------------------------
@@ -947,13 +954,13 @@ bool NavigationControllerImpl::RendererDidNavigate(
NotifyNavigationEntryCommitted(details);
- // Update the RenderViewHost of the top-level RenderFrameHost's notion of what
- // entry it's showing for use later.
- RenderFrameHostImpl* main_frame =
- rfh->frame_tree_node()->frame_tree()->root()->current_frame_host();
- static_cast<RenderViewHostImpl*>(main_frame->GetRenderViewHost())->
- set_nav_entry_id(active_entry->GetUniqueID());
-
+ // Update the nav_entry_id for each RenderFrameHost in the tree, so that each
+ // one knows the latest NavigationEntry it is showing (whether it has
+ // committed anything in this navigation or not). This allows things like
+ // state and title updates from RenderFrames to apply to the latest relevant
+ // NavigationEntry.
+ delegate_->GetFrameTree()->ForEach(
+ base::Bind(&SetFrameNavEntryID, active_entry->GetUniqueID()));
return true;
}
« no previous file with comments | « no previous file | content/browser/frame_host/render_frame_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698