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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 // top-down and visits a node before adding its children to the queue, making | 64 // top-down and visits a node before adding its children to the queue, making |
65 // it safe to remove children during the callback. | 65 // it safe to remove children during the callback. |
66 void ForEach(const base::Callback<bool(FrameTreeNode*)>& on_node) const; | 66 void ForEach(const base::Callback<bool(FrameTreeNode*)>& on_node) const; |
67 | 67 |
68 // Frame tree manipulation routines. | 68 // Frame tree manipulation routines. |
69 RenderFrameHostImpl* AddFrame(FrameTreeNode* parent, | 69 RenderFrameHostImpl* AddFrame(FrameTreeNode* parent, |
70 int new_routing_id, | 70 int new_routing_id, |
71 const std::string& frame_name); | 71 const std::string& frame_name); |
72 void RemoveFrame(FrameTreeNode* child); | 72 void RemoveFrame(FrameTreeNode* child); |
73 | 73 |
| 74 // Walks the entire frame tree and creates a RenderFrameProxyHost for the |
| 75 // given |site_instance| in every node except the |source| one. |
| 76 void CreateProxiesForSiteInstance( |
| 77 FrameTreeNode* source, |
| 78 const scoped_refptr<SiteInstance>& site_instance); |
| 79 |
74 // Clears process specific-state after a main frame process swap. | 80 // Clears process specific-state after a main frame process swap. |
75 // This destroys most of the frame tree but retains the root node so that | 81 // This destroys most of the frame tree but retains the root node so that |
76 // navigation state may be kept on it between process swaps. Used to | 82 // navigation state may be kept on it between process swaps. Used to |
77 // support bookkeeping for top-level navigations. | 83 // support bookkeeping for top-level navigations. |
78 // TODO(creis): Look into how we can remove the need for this method. | 84 // TODO(creis): Look into how we can remove the need for this method. |
79 void ResetForMainFrameSwap(); | 85 void ResetForMainFrameSwap(); |
80 | 86 |
81 // Update the frame tree after a process exits. Any nodes currently using the | 87 // Update the frame tree after a process exits. Any nodes currently using the |
82 // given |render_view_host| will lose all their children. | 88 // given |render_view_host| will lose all their children. |
83 // TODO(creis): This should take a RenderProcessHost once RenderFrameHost | 89 // TODO(creis): This should take a RenderProcessHost once RenderFrameHost |
(...skipping 10 matching lines...) Expand all Loading... |
94 // Sets the focused frame. | 100 // Sets the focused frame. |
95 void SetFocusedFrame(FrameTreeNode* node); | 101 void SetFocusedFrame(FrameTreeNode* node); |
96 | 102 |
97 // Allows a client to listen for frame removal. The listener should expect | 103 // Allows a client to listen for frame removal. The listener should expect |
98 // to receive the RenderViewHostImpl containing the frame and the renderer- | 104 // to receive the RenderViewHostImpl containing the frame and the renderer- |
99 // specific frame routing ID of the removed frame. | 105 // specific frame routing ID of the removed frame. |
100 // TODO(creis): These parameters will later change to be the RenderFrameHost. | 106 // TODO(creis): These parameters will later change to be the RenderFrameHost. |
101 void SetFrameRemoveListener( | 107 void SetFrameRemoveListener( |
102 const base::Callback<void(RenderViewHostImpl*, int)>& on_frame_removed); | 108 const base::Callback<void(RenderViewHostImpl*, int)>& on_frame_removed); |
103 | 109 |
104 // Creates a RenderViewHost for a new main frame RenderFrameHost in the given | 110 // Creates a RenderViewHost for a new RenderFrameHost in the given |
105 // |site_instance|. The RenderViewHost will have its Shutdown method called | 111 // |site_instance|. The RenderViewHost will have its Shutdown method called |
106 // when all of the RenderFrameHosts using it are deleted. | 112 // when all of the RenderFrameHosts using it are deleted. |
107 RenderViewHostImpl* CreateRenderViewHostForMainFrame( | 113 RenderViewHostImpl* CreateRenderViewHost(SiteInstance* site_instance, |
108 SiteInstance* site_instance, | 114 int routing_id, |
109 int routing_id, | 115 int main_frame_routing_id, |
110 int main_frame_routing_id, | 116 bool swapped_out, |
111 bool swapped_out, | 117 bool hidden); |
112 bool hidden); | |
113 | 118 |
114 // Returns the existing RenderViewHost for a new subframe RenderFrameHost. | 119 // Returns the existing RenderViewHost for a new RenderFrameHost. |
115 // There should always be such a RenderViewHost, because the main frame | 120 // There should always be such a RenderViewHost, because the main frame |
116 // RenderFrameHost for each SiteInstance should be created before subframes. | 121 // RenderFrameHost for each SiteInstance should be created before subframes. |
117 RenderViewHostImpl* GetRenderViewHostForSubFrame(SiteInstance* site_instance); | 122 RenderViewHostImpl* GetRenderViewHost(SiteInstance* site_instance); |
118 | 123 |
119 // Keeps track of which RenderFrameHosts are using each RenderViewHost. When | 124 // Keeps track of which RenderFrameHosts are using each RenderViewHost. When |
120 // the number drops to zero, we call Shutdown on the RenderViewHost. | 125 // the number drops to zero, we call Shutdown on the RenderViewHost. |
121 void RegisterRenderFrameHost(RenderFrameHostImpl* render_frame_host); | 126 void RegisterRenderFrameHost(RenderFrameHostImpl* render_frame_host); |
122 void UnregisterRenderFrameHost(RenderFrameHostImpl* render_frame_host); | 127 void UnregisterRenderFrameHost(RenderFrameHostImpl* render_frame_host); |
123 | 128 |
124 private: | 129 private: |
125 typedef base::hash_map<int, RenderViewHostImpl*> RenderViewHostMap; | 130 typedef base::hash_map<int, RenderViewHostImpl*> RenderViewHostMap; |
126 typedef std::multimap<int, RenderViewHostImpl*> RenderViewHostMultiMap; | 131 typedef std::multimap<int, RenderViewHostImpl*> RenderViewHostMultiMap; |
127 | 132 |
(...skipping 26 matching lines...) Expand all Loading... |
154 int64 focused_frame_tree_node_id_; | 159 int64 focused_frame_tree_node_id_; |
155 | 160 |
156 base::Callback<void(RenderViewHostImpl*, int)> on_frame_removed_; | 161 base::Callback<void(RenderViewHostImpl*, int)> on_frame_removed_; |
157 | 162 |
158 DISALLOW_COPY_AND_ASSIGN(FrameTree); | 163 DISALLOW_COPY_AND_ASSIGN(FrameTree); |
159 }; | 164 }; |
160 | 165 |
161 } // namespace content | 166 } // namespace content |
162 | 167 |
163 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_H_ | 168 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_H_ |
OLD | NEW |