OLD | NEW |
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" |
(...skipping 15 matching lines...) Expand all Loading... |
26 class RenderFrameHostImpl; | 26 class RenderFrameHostImpl; |
27 | 27 |
28 // When a page contains iframes, its renderer process maintains a tree structure | 28 // When a page contains iframes, its renderer process maintains a tree structure |
29 // of those frames. We are mirroring this tree in the browser process. This | 29 // of those frames. We are mirroring this tree in the browser process. This |
30 // class represents a node in this tree and is a wrapper for all objects that | 30 // class represents a node in this tree and is a wrapper for all objects that |
31 // are frame-specific (as opposed to page-specific). | 31 // are frame-specific (as opposed to page-specific). |
32 class CONTENT_EXPORT FrameTreeNode { | 32 class CONTENT_EXPORT FrameTreeNode { |
33 public: | 33 public: |
34 // Returns the FrameTreeNode with the given global |frame_tree_node_id|, | 34 // Returns the FrameTreeNode with the given global |frame_tree_node_id|, |
35 // regardless of which FrameTree it is in. | 35 // regardless of which FrameTree it is in. |
36 static FrameTreeNode* GloballyFindByID(int64 frame_tree_node_id); | 36 static FrameTreeNode* GloballyFindByID(int frame_tree_node_id); |
37 | 37 |
38 FrameTreeNode(FrameTree* frame_tree, | 38 FrameTreeNode(FrameTree* frame_tree, |
39 Navigator* navigator, | 39 Navigator* navigator, |
40 RenderFrameHostDelegate* render_frame_delegate, | 40 RenderFrameHostDelegate* render_frame_delegate, |
41 RenderViewHostDelegate* render_view_delegate, | 41 RenderViewHostDelegate* render_view_delegate, |
42 RenderWidgetHostDelegate* render_widget_delegate, | 42 RenderWidgetHostDelegate* render_widget_delegate, |
43 RenderFrameHostManager::Delegate* manager_delegate, | 43 RenderFrameHostManager::Delegate* manager_delegate, |
44 const std::string& name); | 44 const std::string& name); |
45 | 45 |
46 ~FrameTreeNode(); | 46 ~FrameTreeNode(); |
(...skipping 13 matching lines...) Expand all Loading... |
60 } | 60 } |
61 | 61 |
62 Navigator* navigator() { | 62 Navigator* navigator() { |
63 return navigator_.get(); | 63 return navigator_.get(); |
64 } | 64 } |
65 | 65 |
66 RenderFrameHostManager* render_manager() { | 66 RenderFrameHostManager* render_manager() { |
67 return &render_manager_; | 67 return &render_manager_; |
68 } | 68 } |
69 | 69 |
70 int64 frame_tree_node_id() const { | 70 int frame_tree_node_id() const { |
71 return frame_tree_node_id_; | 71 return frame_tree_node_id_; |
72 } | 72 } |
73 | 73 |
74 const std::string& frame_name() const { | 74 const std::string& frame_name() const { |
75 return replication_state_.name; | 75 return replication_state_.name; |
76 } | 76 } |
77 | 77 |
78 size_t child_count() const { | 78 size_t child_count() const { |
79 return children_.size(); | 79 return children_.size(); |
80 } | 80 } |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 | 160 |
161 // The load progress for a RenderFrameHost in this node was updated to | 161 // The load progress for a RenderFrameHost in this node was updated to |
162 // |load_progress|. This will notify the FrameTree which will in turn notify | 162 // |load_progress|. This will notify the FrameTree which will in turn notify |
163 // the WebContents. | 163 // the WebContents. |
164 void DidChangeLoadProgress(double load_progress); | 164 void DidChangeLoadProgress(double load_progress); |
165 | 165 |
166 private: | 166 private: |
167 void set_parent(FrameTreeNode* parent) { parent_ = parent; } | 167 void set_parent(FrameTreeNode* parent) { parent_ = parent; } |
168 | 168 |
169 // The next available browser-global FrameTreeNode ID. | 169 // The next available browser-global FrameTreeNode ID. |
170 static int64 next_frame_tree_node_id_; | 170 static int next_frame_tree_node_id_; |
171 | 171 |
172 // The FrameTree that owns us. | 172 // The FrameTree that owns us. |
173 FrameTree* frame_tree_; // not owned. | 173 FrameTree* frame_tree_; // not owned. |
174 | 174 |
175 // The Navigator object responsible for managing navigations at this node | 175 // The Navigator object responsible for managing navigations at this node |
176 // of the frame tree. | 176 // of the frame tree. |
177 scoped_refptr<Navigator> navigator_; | 177 scoped_refptr<Navigator> navigator_; |
178 | 178 |
179 // Manages creation and swapping of RenderFrameHosts for this frame. This | 179 // Manages creation and swapping of RenderFrameHosts for this frame. This |
180 // must be declared before |children_| so that it gets deleted after them. | 180 // must be declared before |children_| so that it gets deleted after them. |
181 // That's currently necessary so that RenderFrameHostImpl's destructor can | 181 // That's currently necessary so that RenderFrameHostImpl's destructor can |
182 // call GetProcess. | 182 // call GetProcess. |
183 RenderFrameHostManager render_manager_; | 183 RenderFrameHostManager render_manager_; |
184 | 184 |
185 // A browser-global identifier for the frame in the page, which stays stable | 185 // A browser-global identifier for the frame in the page, which stays stable |
186 // even if the frame does a cross-process navigation. | 186 // even if the frame does a cross-process navigation. |
187 const int64 frame_tree_node_id_; | 187 const int frame_tree_node_id_; |
188 | 188 |
189 // The parent node of this frame. NULL if this node is the root or if it has | 189 // The parent node of this frame. NULL if this node is the root or if it has |
190 // not yet been attached to the frame tree. | 190 // not yet been attached to the frame tree. |
191 FrameTreeNode* parent_; | 191 FrameTreeNode* parent_; |
192 | 192 |
193 // The immediate children of this specific frame. | 193 // The immediate children of this specific frame. |
194 ScopedVector<FrameTreeNode> children_; | 194 ScopedVector<FrameTreeNode> children_; |
195 | 195 |
196 // Track the current frame's last committed URL, so we can estimate the | 196 // Track the current frame's last committed URL, so we can estimate the |
197 // process impact of out-of-process iframes. | 197 // process impact of out-of-process iframes. |
(...skipping 22 matching lines...) Expand all Loading... |
220 // Owns an ongoing NavigationRequest until it is ready to commit. It will then | 220 // Owns an ongoing NavigationRequest until it is ready to commit. It will then |
221 // be reset and a RenderFrameHost will be responsible for the navigation. | 221 // be reset and a RenderFrameHost will be responsible for the navigation. |
222 scoped_ptr<NavigationRequest> navigation_request_; | 222 scoped_ptr<NavigationRequest> navigation_request_; |
223 | 223 |
224 DISALLOW_COPY_AND_ASSIGN(FrameTreeNode); | 224 DISALLOW_COPY_AND_ASSIGN(FrameTreeNode); |
225 }; | 225 }; |
226 | 226 |
227 } // namespace content | 227 } // namespace content |
228 | 228 |
229 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_ | 229 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_ |
OLD | NEW |