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_H_ | 5 #ifndef CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_H_ |
6 #define CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_H_ | 6 #define CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 FrameTreeNode* FindByRoutingID(int routing_id, int process_id); | 63 FrameTreeNode* FindByRoutingID(int routing_id, int process_id); |
64 | 64 |
65 // Executes |on_node| on each node in the frame tree. If |on_node| returns | 65 // Executes |on_node| on each node in the frame tree. If |on_node| returns |
66 // false, terminates the iteration immediately. Returning false is useful | 66 // false, terminates the iteration immediately. Returning false is useful |
67 // if |on_node| is just doing a search over the tree. The iteration proceeds | 67 // if |on_node| is just doing a search over the tree. The iteration proceeds |
68 // top-down and visits a node before adding its children to the queue, making | 68 // top-down and visits a node before adding its children to the queue, making |
69 // it safe to remove children during the callback. | 69 // it safe to remove children during the callback. |
70 void ForEach(const base::Callback<bool(FrameTreeNode*)>& on_node) const; | 70 void ForEach(const base::Callback<bool(FrameTreeNode*)>& on_node) const; |
71 | 71 |
72 // Frame tree manipulation routines. | 72 // Frame tree manipulation routines. |
| 73 // |process_id| is required to disambiguate |new_routing_id|, and it must |
| 74 // match the process of the |parent| node. Otherwise this method returns |
| 75 // nullptr. Passing MSG_ROUTING_NONE for |new_routing_id| will allocate a new |
| 76 // routing ID for the new frame. |
73 RenderFrameHostImpl* AddFrame(FrameTreeNode* parent, | 77 RenderFrameHostImpl* AddFrame(FrameTreeNode* parent, |
74 int process_id, | 78 int process_id, |
75 int new_routing_id, | 79 int new_routing_id, |
76 const std::string& frame_name); | 80 const std::string& frame_name); |
77 void RemoveFrame(FrameTreeNode* child); | 81 void RemoveFrame(FrameTreeNode* child); |
78 | 82 |
79 // This method walks the entire frame tree and creates a RenderFrameProxyHost | 83 // This method walks the entire frame tree and creates a RenderFrameProxyHost |
80 // for the given |site_instance| in each node except the |source| one -- | 84 // for the given |site_instance| in each node except the |source| one -- |
81 // the source will have a RenderFrameHost. It assumes that no frame tree | 85 // the source will have a RenderFrameHost. It assumes that no frame tree |
82 // nodes already have RenderFrameProxyHost for the given |site_instance|. | 86 // nodes already have RenderFrameProxyHost for the given |site_instance|. |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 int64 focused_frame_tree_node_id_; | 167 int64 focused_frame_tree_node_id_; |
164 | 168 |
165 base::Callback<void(RenderFrameHost*)> on_frame_removed_; | 169 base::Callback<void(RenderFrameHost*)> on_frame_removed_; |
166 | 170 |
167 DISALLOW_COPY_AND_ASSIGN(FrameTree); | 171 DISALLOW_COPY_AND_ASSIGN(FrameTree); |
168 }; | 172 }; |
169 | 173 |
170 } // namespace content | 174 } // namespace content |
171 | 175 |
172 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_H_ | 176 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_H_ |
OLD | NEW |