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