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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <iterator> | 10 #include <iterator> |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 // node cannot be removed this way. | 133 // node cannot be removed this way. |
134 void RemoveFrame(FrameTreeNode* child); | 134 void RemoveFrame(FrameTreeNode* child); |
135 | 135 |
136 // This method walks the entire frame tree and creates a RenderFrameProxyHost | 136 // This method walks the entire frame tree and creates a RenderFrameProxyHost |
137 // for the given |site_instance| in each node except the |source| one -- | 137 // for the given |site_instance| in each node except the |source| one -- |
138 // the source will have a RenderFrameHost. |source| may be null if there is | 138 // the source will have a RenderFrameHost. |source| may be null if there is |
139 // no node navigating in this frame tree (such as when this is called | 139 // no node navigating in this frame tree (such as when this is called |
140 // for an opener's frame tree), in which case no nodes are skipped for | 140 // for an opener's frame tree), in which case no nodes are skipped for |
141 // RenderFrameProxyHost creation. | 141 // RenderFrameProxyHost creation. |
142 void CreateProxiesForSiteInstance(FrameTreeNode* source, | 142 void CreateProxiesForSiteInstance(FrameTreeNode* source, |
143 SiteInstance* site_instance); | 143 SiteInstanceImpl* site_instance); |
144 | 144 |
145 // Convenience accessor for the main frame's RenderFrameHostImpl. | 145 // Convenience accessor for the main frame's RenderFrameHostImpl. |
146 RenderFrameHostImpl* GetMainFrame() const; | 146 RenderFrameHostImpl* GetMainFrame() const; |
147 | 147 |
148 // Returns the focused frame. | 148 // Returns the focused frame. |
149 FrameTreeNode* GetFocusedFrame(); | 149 FrameTreeNode* GetFocusedFrame(); |
150 | 150 |
151 // Sets the focused frame to |node|. |source| identifies the SiteInstance | 151 // Sets the focused frame to |node|. |source| identifies the SiteInstance |
152 // that initiated this focus change. If this FrameTree has SiteInstances | 152 // that initiated this focus change. If this FrameTree has SiteInstances |
153 // other than |source|, those SiteInstances will be notified about the new | 153 // other than |source|, those SiteInstances will be notified about the new |
154 // focused frame. Note that |source| may differ from |node|'s current | 154 // focused frame. Note that |source| may differ from |node|'s current |
155 // SiteInstance (e.g., this happens for cross-process window.focus() calls). | 155 // SiteInstance (e.g., this happens for cross-process window.focus() calls). |
156 void SetFocusedFrame(FrameTreeNode* node, SiteInstance* source); | 156 void SetFocusedFrame(FrameTreeNode* node, SiteInstanceImpl* source); |
157 | 157 |
158 // Allows a client to listen for frame removal. The listener should expect | 158 // Allows a client to listen for frame removal. The listener should expect |
159 // to receive the RenderViewHostImpl containing the frame and the renderer- | 159 // to receive the RenderViewHostImpl containing the frame and the renderer- |
160 // specific frame routing ID of the removed frame. | 160 // specific frame routing ID of the removed frame. |
161 void SetFrameRemoveListener( | 161 void SetFrameRemoveListener( |
162 const base::Callback<void(RenderFrameHost*)>& on_frame_removed); | 162 const base::Callback<void(RenderFrameHost*)>& on_frame_removed); |
163 | 163 |
164 // Creates a RenderViewHost for a new RenderFrameHost in the given | 164 // Creates a RenderViewHost for a new RenderFrameHost in the given |
165 // |site_instance|. The RenderViewHost will have its Shutdown method called | 165 // |site_instance|. The RenderViewHost will have its Shutdown method called |
166 // when all of the RenderFrameHosts using it are deleted. | 166 // when all of the RenderFrameHosts using it are deleted. |
167 RenderViewHostImpl* CreateRenderViewHost(SiteInstance* site_instance, | 167 RenderViewHostImpl* CreateRenderViewHost(SiteInstanceImpl* site_instance, |
168 int32_t routing_id, | 168 int32_t routing_id, |
169 int32_t main_frame_routing_id, | 169 int32_t main_frame_routing_id, |
170 bool swapped_out, | 170 bool swapped_out, |
171 bool hidden); | 171 bool hidden); |
172 | 172 |
173 // Returns the existing RenderViewHost for a new RenderFrameHost. | 173 // Returns the existing RenderViewHost for a new RenderFrameHost. |
174 // There should always be such a RenderViewHost, because the main frame | 174 // There should always be such a RenderViewHost, because the main frame |
175 // RenderFrameHost for each SiteInstance should be created before subframes. | 175 // RenderFrameHost for each SiteInstance should be created before subframes. |
176 RenderViewHostImpl* GetRenderViewHost(SiteInstance* site_instance); | 176 RenderViewHostImpl* GetRenderViewHost(SiteInstanceImpl* site_instance); |
177 | 177 |
178 // Keeps track of which RenderFrameHosts and RenderFrameProxyHosts are using | 178 // Keeps track of which RenderFrameHosts and RenderFrameProxyHosts are using |
179 // each RenderViewHost. When the number drops to zero, we call Shutdown on | 179 // each RenderViewHost. When the number drops to zero, we call Shutdown on |
180 // the RenderViewHost. | 180 // the RenderViewHost. |
181 void AddRenderViewHostRef(RenderViewHostImpl* render_view_host); | 181 void AddRenderViewHostRef(RenderViewHostImpl* render_view_host); |
182 void ReleaseRenderViewHostRef(RenderViewHostImpl* render_view_host); | 182 void ReleaseRenderViewHostRef(RenderViewHostImpl* render_view_host); |
183 | 183 |
184 // This is only meant to be called by FrameTreeNode. Triggers calling | 184 // This is only meant to be called by FrameTreeNode. Triggers calling |
185 // the listener installed by SetFrameRemoveListener. | 185 // the listener installed by SetFrameRemoveListener. |
186 void FrameRemoved(FrameTreeNode* frame); | 186 void FrameRemoved(FrameTreeNode* frame); |
(...skipping 11 matching lines...) Expand all Loading... |
198 bool IsLoading() const; | 198 bool IsLoading() const; |
199 | 199 |
200 // Set page-level focus in all SiteInstances involved in rendering | 200 // Set page-level focus in all SiteInstances involved in rendering |
201 // this FrameTree, not including the current main frame's | 201 // this FrameTree, not including the current main frame's |
202 // SiteInstance. The focus update will be sent via the main frame's proxies | 202 // SiteInstance. The focus update will be sent via the main frame's proxies |
203 // in those SiteInstances. | 203 // in those SiteInstances. |
204 void ReplicatePageFocus(bool is_focused); | 204 void ReplicatePageFocus(bool is_focused); |
205 | 205 |
206 // Updates page-level focus for this FrameTree in the subframe renderer | 206 // Updates page-level focus for this FrameTree in the subframe renderer |
207 // identified by |instance|. | 207 // identified by |instance|. |
208 void SetPageFocus(SiteInstance* instance, bool is_focused); | 208 void SetPageFocus(SiteInstanceImpl* instance, bool is_focused); |
209 | 209 |
210 private: | 210 private: |
211 friend class FrameTreeTest; | 211 friend class FrameTreeTest; |
212 FRIEND_TEST_ALL_PREFIXES(RenderFrameHostImplBrowserTest, RemoveFocusedFrame); | 212 FRIEND_TEST_ALL_PREFIXES(RenderFrameHostImplBrowserTest, RemoveFocusedFrame); |
213 typedef base::hash_map<int, RenderViewHostImpl*> RenderViewHostMap; | 213 typedef base::hash_map<int, RenderViewHostImpl*> RenderViewHostMap; |
214 typedef std::multimap<int, RenderViewHostImpl*> RenderViewHostMultiMap; | 214 typedef std::multimap<int, RenderViewHostImpl*> RenderViewHostMultiMap; |
215 | 215 |
216 // Returns a range to iterate over all FrameTreeNodes in the frame tree in | 216 // Returns a range to iterate over all FrameTreeNodes in the frame tree in |
217 // breadth-first traversal order, skipping the subtree rooted at | 217 // breadth-first traversal order, skipping the subtree rooted at |
218 // |node_to_skip|. | 218 // |node_to_skip|. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 | 254 |
255 // Overall load progress. | 255 // Overall load progress. |
256 double load_progress_; | 256 double load_progress_; |
257 | 257 |
258 DISALLOW_COPY_AND_ASSIGN(FrameTree); | 258 DISALLOW_COPY_AND_ASSIGN(FrameTree); |
259 }; | 259 }; |
260 | 260 |
261 } // namespace content | 261 } // namespace content |
262 | 262 |
263 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_H_ | 263 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_H_ |
OLD | NEW |