Create a frame tree in WebContents on the browser side.

This is a small delta from the original patch at https://codereview.chromium.org/14374002/.

BUG=235879

Review URL: https://chromiumcodereview.appspot.com/14580004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@199087 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h
index 39cf2ae..a7a408b 100644
--- a/content/browser/web_contents/web_contents_impl.h
+++ b/content/browser/web_contents/web_contents_impl.h
@@ -14,6 +14,7 @@
 #include "base/memory/scoped_ptr.h"
 #include "base/observer_list.h"
 #include "base/process.h"
+#include "content/browser/renderer_host/frame_tree_node.h"
 #include "content/browser/renderer_host/render_view_host_delegate.h"
 #include "content/browser/renderer_host/render_widget_host_delegate.h"
 #include "content/browser/web_contents/navigation_controller_impl.h"
@@ -184,6 +185,10 @@
   void DragSourceMovedTo(int client_x, int client_y,
                          int screen_x, int screen_y);
 
+  FrameTreeNode* GetFrameTreeRootForTesting() {
+    return frame_tree_root_.get();
+  }
+
   // WebContents ------------------------------------------------------
   virtual WebContentsDelegate* GetDelegate() OVERRIDE;
   virtual void SetDelegate(WebContentsDelegate* delegate) OVERRIDE;
@@ -488,6 +493,7 @@
   FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest,
                            CrossSiteCantPreemptAfterUnload);
   FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, PendingContents);
+  FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, FrameTreeShape);
   FRIEND_TEST_ALL_PREFIXES(FormStructureBrowserTest, HTMLFiles);
   FRIEND_TEST_ALL_PREFIXES(NavigationControllerTest, HistoryNavigate);
   FRIEND_TEST_ALL_PREFIXES(RenderViewHostManagerTest, PageDoesBackAndReload);
@@ -588,7 +594,10 @@
                           const std::vector<SkBitmap>& bitmaps);
   void OnUpdateFaviconURL(int32 page_id,
                           const std::vector<FaviconURL>& candidates);
-  void OnFrameDetached(int64 frame_id);
+  void OnFrameAttached(int64 parent_frame_id,
+                       int64 frame_id,
+                       const std::string& frame_name);
+  void OnFrameDetached(int64 parent_frame_id, int64 frame_id);
 
   // Changes the IsLoading state and notifies delegate as needed
   // |details| is used to provide details on the load that just finished
@@ -697,6 +706,8 @@
 
   RenderViewHostImpl* GetRenderViewHostImpl();
 
+  FrameTreeNode* FindFrameTreeNodeByID(int64 frame_id);
+
   // Removes browser plugin embedder if there is one.
   void RemoveBrowserPluginEmbedder();
 
@@ -800,6 +811,9 @@
   // True if this is a secure page which displayed insecure content.
   bool displayed_insecure_content_;
 
+  // The frame tree structure of the current page.
+  scoped_ptr<FrameTreeNode> frame_tree_root_;
+
   // Data for misc internal state ----------------------------------------------
 
   // When > 0, the WebContents is currently being captured (e.g., for