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

Side by Side Diff: content/browser/frame_host/frame_tree_node.h

Issue 72233002: Move RenderViewHostManager from WebContents to FrameTreeNode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Initial patch Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #ifndef CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_ 5 #ifndef CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_
6 #define CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_ 6 #define CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/scoped_vector.h" 13 #include "base/memory/scoped_vector.h"
14 #include "content/browser/frame_host/render_view_host_manager.h"
14 #include "content/common/content_export.h" 15 #include "content/common/content_export.h"
15 #include "url/gurl.h" 16 #include "url/gurl.h"
16 17
17 namespace content { 18 namespace content {
18 19
19 class Navigator; 20 class Navigator;
20 class RenderFrameHostImpl; 21 class RenderFrameHostImpl;
21 22
22 // When a page contains iframes, its renderer process maintains a tree structure 23 // When a page contains iframes, its renderer process maintains a tree structure
23 // of those frames. We are mirroring this tree in the browser process. This 24 // of those frames. We are mirroring this tree in the browser process. This
24 // class represents a node in this tree and is a wrapper for all objects that 25 // class represents a node in this tree and is a wrapper for all objects that
25 // are frame-specific (as opposed to page-specific). 26 // are frame-specific (as opposed to page-specific).
26 class CONTENT_EXPORT FrameTreeNode { 27 class CONTENT_EXPORT FrameTreeNode {
27 public: 28 public:
28 static const int64 kInvalidFrameId; 29 static const int64 kInvalidFrameId;
29 30
30 FrameTreeNode( 31 FrameTreeNode(RenderViewHostDelegate* render_view_delegate,
31 int64 frame_id, 32 RenderWidgetHostDelegate* render_widget_delegate,
32 const std::string& name, 33 RenderViewHostManager::Delegate* manager_delegate,
33 Navigator* navigator, 34 int64 frame_id,
34 scoped_ptr<RenderFrameHostImpl> render_frame_host); 35 const std::string& name,
36 Navigator* navigator,
nasko 2013/11/14 08:23:38 nit: I'd move this up with the rest of the delegat
Charlie Reis 2013/11/14 19:01:16 Good idea. I've put it first to match the FrameTr
37 scoped_ptr<RenderFrameHostImpl> render_frame_host);
35 38
36 ~FrameTreeNode(); 39 ~FrameTreeNode();
37 40
38 void AddChild(scoped_ptr<FrameTreeNode> child); 41 void AddChild(scoped_ptr<FrameTreeNode> child);
39 void RemoveChild(FrameTreeNode* child); 42 void RemoveChild(FrameTreeNode* child);
40 43
41 // Transitional API allowing the RenderFrameHost of a FrameTreeNode 44 // Transitional API allowing the RenderFrameHost of a FrameTreeNode
42 // representing the main frame to be provided by someone else. After 45 // representing the main frame to be provided by someone else. After
43 // this is called, the FrameTreeNode no longer owns its RenderFrameHost. 46 // this is called, the FrameTreeNode no longer owns its RenderFrameHost.
44 // 47 //
45 // This should only be used for the main frame (aka root) in a frame tree. 48 // This should only be used for the main frame (aka root) in a frame tree.
46 // 49 //
47 // TODO(ajwong): Remove this method once the main frame RenderFrameHostImpl is 50 // TODO(ajwong): Remove this method once the main frame RenderFrameHostImpl is
48 // no longer owned by the RenderViewHostImpl. 51 // no longer owned by the RenderViewHostImpl.
49 void ResetForMainFrame(RenderFrameHostImpl* new_render_frame_host); 52 void ResetForMainFrame(RenderFrameHostImpl* new_render_frame_host);
50 53
54 RenderViewHostManager* render_manager() {
55 return &render_manager_;
56 }
57
51 int64 frame_tree_node_id() const { 58 int64 frame_tree_node_id() const {
52 return frame_tree_node_id_; 59 return frame_tree_node_id_;
53 } 60 }
54 61
55 // DO NOT USE. Only used by FrameTree until we replace renderer-specific 62 // DO NOT USE. Only used by FrameTree until we replace renderer-specific
56 // frame IDs with RenderFrameHost routing IDs. 63 // frame IDs with RenderFrameHost routing IDs.
57 void set_frame_id(int64 frame_id) { 64 void set_frame_id(int64 frame_id) {
58 DCHECK_EQ(frame_id_, kInvalidFrameId); 65 DCHECK_EQ(frame_id_, kInvalidFrameId);
59 frame_id_ = frame_id; 66 frame_id_ = frame_id;
60 } 67 }
(...skipping 26 matching lines...) Expand all
87 } 94 }
88 95
89 Navigator* navigator() { 96 Navigator* navigator() {
90 return navigator_.get(); 97 return navigator_.get();
91 } 98 }
92 99
93 private: 100 private:
94 // The next available browser-global FrameTreeNode ID. 101 // The next available browser-global FrameTreeNode ID.
95 static int64 next_frame_tree_node_id_; 102 static int64 next_frame_tree_node_id_;
96 103
104 // Manages creation and swapping of RenderViewHosts for this frame. This must
105 // be declared before |children_| so that it gets deleted after them. That's
106 // currently necessary so that RenderFrameHostImpl's destructor can call
107 // GetProcess.
108 // TODO(creis): This will become a RenderFrameHostManager, which eliminates
109 // the need for |render_frame_host_| below.
110 RenderViewHostManager render_manager_;
111
97 // A browser-global identifier for the frame in the page, which stays stable 112 // A browser-global identifier for the frame in the page, which stays stable
98 // even if the frame does a cross-process navigation. 113 // even if the frame does a cross-process navigation.
99 const int64 frame_tree_node_id_; 114 const int64 frame_tree_node_id_;
100 115
101 // The renderer-specific identifier for the frame in the page. 116 // The renderer-specific identifier for the frame in the page.
102 // TODO(creis): Remove this in favor of the RenderFrameHost's routing ID once 117 // TODO(creis): Remove this in favor of the RenderFrameHost's routing ID once
103 // we create FrameTreeNodes for all frames (even without a flag), since this 118 // we create FrameTreeNodes for all frames (even without a flag), since this
104 // value can change after cross-process navigations. 119 // value can change after cross-process navigations.
105 int64 frame_id_; 120 int64 frame_id_;
106 121
(...skipping 29 matching lines...) Expand all
136 // TODO(creis): Remove this when we can store subframe URLs in the 151 // TODO(creis): Remove this when we can store subframe URLs in the
137 // NavigationController. 152 // NavigationController.
138 GURL current_url_; 153 GURL current_url_;
139 154
140 DISALLOW_COPY_AND_ASSIGN(FrameTreeNode); 155 DISALLOW_COPY_AND_ASSIGN(FrameTreeNode);
141 }; 156 };
142 157
143 } // namespace content 158 } // namespace content
144 159
145 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_ 160 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698