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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 RenderFrameHostManager::Delegate* manager_delegate); | 53 RenderFrameHostManager::Delegate* manager_delegate); |
54 ~FrameTree(); | 54 ~FrameTree(); |
55 | 55 |
56 FrameTreeNode* root() const { return root_.get(); } | 56 FrameTreeNode* root() const { return root_.get(); } |
57 | 57 |
58 // Returns the FrameTreeNode with the given |frame_tree_node_id|. | 58 // Returns the FrameTreeNode with the given |frame_tree_node_id|. |
59 FrameTreeNode* FindByID(int64 frame_tree_node_id); | 59 FrameTreeNode* FindByID(int64 frame_tree_node_id); |
60 | 60 |
61 // Executes |on_node| on each node in the frame tree. If |on_node| returns | 61 // Executes |on_node| on each node in the frame tree. If |on_node| returns |
62 // false, terminates the iteration immediately. Returning false is useful | 62 // false, terminates the iteration immediately. Returning false is useful |
63 // if |on_node| is just doing a search over the tree. | 63 // if |on_node| is just doing a search over the tree. The iteration proceeds |
| 64 // top-down and visits a node before adding its children to the queue, making |
| 65 // it safe to remove children during the callback. |
64 void ForEach(const base::Callback<bool(FrameTreeNode*)>& on_node) const; | 66 void ForEach(const base::Callback<bool(FrameTreeNode*)>& on_node) const; |
65 | 67 |
66 // After the FrameTree is created, or after SwapMainFrame() has been called, | 68 // After the FrameTree is created, or after SwapMainFrame() has been called, |
67 // the root node does not yet have a frame id. This is allocated by the | 69 // the root node does not yet have a frame id. This is allocated by the |
68 // renderer and is published to the browser process on the first navigation | 70 // renderer and is published to the browser process on the first navigation |
69 // after a swap. These two functions are used to set the root node's frame | 71 // after a swap. These two functions are used to set the root node's frame |
70 // id. | 72 // id. |
71 // | 73 // |
72 // TODO(ajwong): Remove these once RenderFrameHost's routing id replaces | 74 // TODO(ajwong): Remove these once RenderFrameHost's routing id replaces |
73 // frame_id. | 75 // frame_id. |
(...skipping 11 matching lines...) Expand all Loading... |
85 int64 frame_id); | 87 int64 frame_id); |
86 void SetFrameUrl(int64 frame_id, const GURL& url); | 88 void SetFrameUrl(int64 frame_id, const GURL& url); |
87 | 89 |
88 // Clears process specific-state after a main frame process swap. | 90 // Clears process specific-state after a main frame process swap. |
89 // This destroys most of the frame tree but retains the root node so that | 91 // This destroys most of the frame tree but retains the root node so that |
90 // navigation state may be kept on it between process swaps. Used to | 92 // navigation state may be kept on it between process swaps. Used to |
91 // support bookkeeping for top-level navigations. | 93 // support bookkeeping for top-level navigations. |
92 // TODO(creis): Look into how we can remove the need for this method. | 94 // TODO(creis): Look into how we can remove the need for this method. |
93 void ResetForMainFrameSwap(); | 95 void ResetForMainFrameSwap(); |
94 | 96 |
| 97 // Update the frame tree after a process exits. Any nodes currently using the |
| 98 // given |render_view_host| will lose all their children. |
| 99 // TODO(creis): This should take a RenderProcessHost once RenderFrameHost |
| 100 // knows its process. Until then, we would just be asking the RenderViewHost |
| 101 // for its process, so we'll skip that step. |
| 102 void RenderProcessGone(RenderViewHost* render_view_host); |
| 103 |
95 // Convenience accessor for the main frame's RenderFrameHostImpl. | 104 // Convenience accessor for the main frame's RenderFrameHostImpl. |
96 RenderFrameHostImpl* GetMainFrame() const; | 105 RenderFrameHostImpl* GetMainFrame() const; |
97 | 106 |
98 // Allows a client to listen for frame removal. The listener should expect | 107 // Allows a client to listen for frame removal. The listener should expect |
99 // to receive the RenderViewHostImpl containing the frame and the renderer- | 108 // to receive the RenderViewHostImpl containing the frame and the renderer- |
100 // specific frame ID of the removed frame. | 109 // specific frame ID of the removed frame. |
101 // TODO(creis): These parameters will later change to be the RenderFrameHost. | 110 // TODO(creis): These parameters will later change to be the RenderFrameHost. |
102 void SetFrameRemoveListener( | 111 void SetFrameRemoveListener( |
103 const base::Callback<void(RenderViewHostImpl*, int64)>& on_frame_removed); | 112 const base::Callback<void(RenderViewHostImpl*, int64)>& on_frame_removed); |
104 | 113 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 scoped_ptr<FrameTreeNode> root_; | 169 scoped_ptr<FrameTreeNode> root_; |
161 | 170 |
162 base::Callback<void(RenderViewHostImpl*, int64)> on_frame_removed_; | 171 base::Callback<void(RenderViewHostImpl*, int64)> on_frame_removed_; |
163 | 172 |
164 DISALLOW_COPY_AND_ASSIGN(FrameTree); | 173 DISALLOW_COPY_AND_ASSIGN(FrameTree); |
165 }; | 174 }; |
166 | 175 |
167 } // namespace content | 176 } // namespace content |
168 | 177 |
169 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_H_ | 178 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_H_ |
OLD | NEW |