Stop passing Navigator into each FrameTreeNode.

They were all getting a reference to the same object. Instead, let them
all access it via the FrameTree.

Make Navigator a direct member of FrameTree, accessed as a reference
since it cannot be null.

This is a mechanical change apart from web_contents_impl.cc:4645
which removes what looks like pointless pointer chasing to get to the
NavigationController.


Change-Id: Ie809f19f7772113ea9005d2996d0ef9aec05a2d3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2210040
Commit-Queue: Fergal Daly <[email protected]>
Reviewed-by: Nasko Oskov <[email protected]>
Cr-Commit-Position: refs/heads/master@{#773002}
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 41f845894..eae4849 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -339,8 +339,8 @@
 
   for (auto it = session_storage_namespace_map.begin();
        it != session_storage_namespace_map.end(); ++it) {
-    new_contents->GetController()
-        .SetSessionStorageNamespace(it->first, it->second.get());
+    new_contents->GetController().SetSessionStorageNamespace(it->first,
+                                                             it->second.get());
   }
 
   WebContentsImpl* outer_web_contents = nullptr;
@@ -409,9 +409,7 @@
 class WebContentsImpl::DestructionObserver : public WebContentsObserver {
  public:
   DestructionObserver(WebContentsImpl* owner, WebContents* watched_contents)
-      : WebContentsObserver(watched_contents),
-        owner_(owner) {
-  }
+      : WebContentsObserver(watched_contents), owner_(owner) {}
 
   // WebContentsObserver:
   void WebContentsDestroyed() override {
@@ -567,7 +565,7 @@
       render_view_host_delegate_view_(nullptr),
       created_with_opener_(false),
       node_(this),
-      frame_tree_(new Navigator(&controller_, this), this, this, this, this),
+      frame_tree_(&controller_, this, this, this, this, this),
       is_load_to_different_document_(false),
       crashed_status_(base::TERMINATION_STATUS_STILL_RUNNING),
       crashed_error_code_(0),
@@ -4637,10 +4635,7 @@
   // Use the last committed entry, since the pending entry hasn't loaded yet and
   // won't be copied into the cloned tab.
   NavigationEntryImpl* last_committed_entry =
-      static_cast<NavigationEntryImpl*>(frame->frame_tree_node()
-                                            ->navigator()
-                                            ->GetController()
-                                            ->GetLastCommittedEntry());
+      GetController().GetLastCommittedEntry();
   if (!last_committed_entry)
     return;