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 |
84 // knows its process. Until then, we would just be asking the RenderViewHost | 90 // knows its process. Until then, we would just be asking the RenderViewHost |
85 // for its process, so we'll skip that step. | 91 // for its process, so we'll skip that step. |
86 void RenderProcessGone(RenderViewHost* render_view_host); | 92 void RenderProcessGone(RenderViewHost* render_view_host); |
87 | 93 |
88 // Convenience accessor for the main frame's RenderFrameHostImpl. | 94 // Convenience accessor for the main frame's RenderFrameHostImpl. |
89 RenderFrameHostImpl* GetMainFrame() const; | 95 RenderFrameHostImpl* GetMainFrame() const; |
90 | 96 |
91 // Returns the focused frame. | 97 // Returns the focused frame. |
92 FrameTreeNode* GetFocusedFrame(); | 98 FrameTreeNode* GetFocusedFrame(); |
93 | 99 |
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 void SetFrameRemoveListener( | 106 void SetFrameRemoveListener( |
101 const base::Callback<void(RenderFrameHost*)>& on_frame_removed); | 107 const base::Callback<void(RenderFrameHost*)>& on_frame_removed); |
102 | 108 |
103 // Creates a RenderViewHost for a new main frame RenderFrameHost in the given | 109 // Creates a RenderViewHost for a new RenderFrameHost in the given |
104 // |site_instance|. The RenderViewHost will have its Shutdown method called | 110 // |site_instance|. The RenderViewHost will have its Shutdown method called |
105 // when all of the RenderFrameHosts using it are deleted. | 111 // when all of the RenderFrameHosts using it are deleted. |
106 RenderViewHostImpl* CreateRenderViewHostForMainFrame( | 112 RenderViewHostImpl* CreateRenderViewHost(SiteInstance* site_instance, |
107 SiteInstance* site_instance, | 113 int routing_id, |
108 int routing_id, | 114 int main_frame_routing_id, |
109 int main_frame_routing_id, | 115 bool swapped_out, |
110 bool swapped_out, | 116 bool hidden); |
111 bool hidden); | |
112 | 117 |
113 // Returns the existing RenderViewHost for a new subframe RenderFrameHost. | 118 // Returns the existing RenderViewHost for a new RenderFrameHost. |
114 // There should always be such a RenderViewHost, because the main frame | 119 // There should always be such a RenderViewHost, because the main frame |
115 // RenderFrameHost for each SiteInstance should be created before subframes. | 120 // RenderFrameHost for each SiteInstance should be created before subframes. |
116 RenderViewHostImpl* GetRenderViewHostForSubFrame(SiteInstance* site_instance); | 121 RenderViewHostImpl* GetRenderViewHost(SiteInstance* site_instance); |
117 | 122 |
118 // Keeps track of which RenderFrameHosts are using each RenderViewHost. When | 123 // Keeps track of which RenderFrameHosts are using each RenderViewHost. When |
119 // the number drops to zero, we call Shutdown on the RenderViewHost. | 124 // the number drops to zero, we call Shutdown on the RenderViewHost. |
120 void RegisterRenderFrameHost(RenderFrameHostImpl* render_frame_host); | 125 void RegisterRenderFrameHost(RenderFrameHostImpl* render_frame_host); |
121 void UnregisterRenderFrameHost(RenderFrameHostImpl* render_frame_host); | 126 void UnregisterRenderFrameHost(RenderFrameHostImpl* render_frame_host); |
122 | 127 |
123 private: | 128 private: |
124 typedef base::hash_map<int, RenderViewHostImpl*> RenderViewHostMap; | 129 typedef base::hash_map<int, RenderViewHostImpl*> RenderViewHostMap; |
125 typedef std::multimap<int, RenderViewHostImpl*> RenderViewHostMultiMap; | 130 typedef std::multimap<int, RenderViewHostImpl*> RenderViewHostMultiMap; |
126 | 131 |
(...skipping 26 matching lines...) Expand all Loading... |
153 int64 focused_frame_tree_node_id_; | 158 int64 focused_frame_tree_node_id_; |
154 | 159 |
155 base::Callback<void(RenderFrameHost*)> on_frame_removed_; | 160 base::Callback<void(RenderFrameHost*)> on_frame_removed_; |
156 | 161 |
157 DISALLOW_COPY_AND_ASSIGN(FrameTree); | 162 DISALLOW_COPY_AND_ASSIGN(FrameTree); |
158 }; | 163 }; |
159 | 164 |
160 } // namespace content | 165 } // namespace content |
161 | 166 |
162 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_H_ | 167 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_H_ |
OLD | NEW |