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 #include "content/browser/frame_host/frame_tree.h" | 5 #include "content/browser/frame_host/frame_tree.h" |
6 | 6 |
7 #include <queue> | 7 #include <queue> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 root_(new FrameTreeNode(this, | 107 root_(new FrameTreeNode(this, |
108 navigator, | 108 navigator, |
109 render_frame_delegate, | 109 render_frame_delegate, |
110 render_view_delegate, | 110 render_view_delegate, |
111 render_widget_delegate, | 111 render_widget_delegate, |
112 manager_delegate, | 112 manager_delegate, |
113 // The top-level frame must always be in a | 113 // The top-level frame must always be in a |
114 // document scope. | 114 // document scope. |
115 blink::WebTreeScopeType::Document, | 115 blink::WebTreeScopeType::Document, |
116 std::string(), | 116 std::string(), |
117 blink::WebSandboxFlags::None)), | 117 blink::WebSandboxFlags::None, |
| 118 blink::WebFrameOwnerProperties())), |
118 focused_frame_tree_node_id_(-1), | 119 focused_frame_tree_node_id_(-1), |
119 load_progress_(0.0) { | 120 load_progress_(0.0) {} |
120 } | |
121 | 121 |
122 FrameTree::~FrameTree() { | 122 FrameTree::~FrameTree() { |
123 } | 123 } |
124 | 124 |
125 FrameTreeNode* FrameTree::FindByID(int frame_tree_node_id) { | 125 FrameTreeNode* FrameTree::FindByID(int frame_tree_node_id) { |
126 FrameTreeNode* node = nullptr; | 126 FrameTreeNode* node = nullptr; |
127 ForEach(base::Bind(&FrameTreeNodeForId, frame_tree_node_id, &node)); | 127 ForEach(base::Bind(&FrameTreeNodeForId, frame_tree_node_id, &node)); |
128 return node; | 128 return node; |
129 } | 129 } |
130 | 130 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 continue; | 175 continue; |
176 | 176 |
177 if (!on_node.Run(node)) | 177 if (!on_node.Run(node)) |
178 break; | 178 break; |
179 | 179 |
180 for (size_t i = 0; i < node->child_count(); ++i) | 180 for (size_t i = 0; i < node->child_count(); ++i) |
181 queue.push(node->child_at(i)); | 181 queue.push(node->child_at(i)); |
182 } | 182 } |
183 } | 183 } |
184 | 184 |
185 RenderFrameHostImpl* FrameTree::AddFrame(FrameTreeNode* parent, | 185 RenderFrameHostImpl* FrameTree::AddFrame( |
186 int process_id, | 186 FrameTreeNode* parent, |
187 int new_routing_id, | 187 int process_id, |
188 blink::WebTreeScopeType scope, | 188 int new_routing_id, |
189 const std::string& frame_name, | 189 blink::WebTreeScopeType scope, |
190 blink::WebSandboxFlags sandbox_flags) { | 190 const std::string& frame_name, |
| 191 blink::WebSandboxFlags sandbox_flags, |
| 192 const blink::WebFrameOwnerProperties& frame_owner_properties) { |
191 // A child frame always starts with an initial empty document, which means | 193 // A child frame always starts with an initial empty document, which means |
192 // it is in the same SiteInstance as the parent frame. Ensure that the process | 194 // it is in the same SiteInstance as the parent frame. Ensure that the process |
193 // which requested a child frame to be added is the same as the process of the | 195 // which requested a child frame to be added is the same as the process of the |
194 // parent node. | 196 // parent node. |
195 // We return nullptr if this is not the case, which can happen in a race if an | 197 // We return nullptr if this is not the case, which can happen in a race if an |
196 // old RFH sends a CreateChildFrame message as we're swapping to a new RFH. | 198 // old RFH sends a CreateChildFrame message as we're swapping to a new RFH. |
197 if (parent->current_frame_host()->GetProcess()->GetID() != process_id) | 199 if (parent->current_frame_host()->GetProcess()->GetID() != process_id) |
198 return nullptr; | 200 return nullptr; |
199 | 201 |
200 scoped_ptr<FrameTreeNode> node( | 202 scoped_ptr<FrameTreeNode> node(new FrameTreeNode( |
201 new FrameTreeNode(this, parent->navigator(), render_frame_delegate_, | 203 this, parent->navigator(), render_frame_delegate_, render_view_delegate_, |
202 render_view_delegate_, render_widget_delegate_, | 204 render_widget_delegate_, manager_delegate_, scope, frame_name, |
203 manager_delegate_, scope, frame_name, sandbox_flags)); | 205 sandbox_flags, frame_owner_properties)); |
204 FrameTreeNode* node_ptr = node.get(); | 206 FrameTreeNode* node_ptr = node.get(); |
205 // AddChild is what creates the RenderFrameHost. | 207 // AddChild is what creates the RenderFrameHost. |
206 parent->AddChild(node.Pass(), process_id, new_routing_id); | 208 parent->AddChild(node.Pass(), process_id, new_routing_id); |
207 return node_ptr->current_frame_host(); | 209 return node_ptr->current_frame_host(); |
208 } | 210 } |
209 | 211 |
210 void FrameTree::RemoveFrame(FrameTreeNode* child) { | 212 void FrameTree::RemoveFrame(FrameTreeNode* child) { |
211 FrameTreeNode* parent = child->parent(); | 213 FrameTreeNode* parent = child->parent(); |
212 if (!parent) { | 214 if (!parent) { |
213 NOTREACHED() << "Unexpected RemoveFrame call for main frame."; | 215 NOTREACHED() << "Unexpected RemoveFrame call for main frame."; |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 load_progress_ = 0.0; | 399 load_progress_ = 0.0; |
398 } | 400 } |
399 | 401 |
400 bool FrameTree::IsLoading() { | 402 bool FrameTree::IsLoading() { |
401 bool is_loading = false; | 403 bool is_loading = false; |
402 ForEach(base::Bind(&IsNodeLoading, &is_loading)); | 404 ForEach(base::Bind(&IsNodeLoading, &is_loading)); |
403 return is_loading; | 405 return is_loading; |
404 } | 406 } |
405 | 407 |
406 } // namespace content | 408 } // namespace content |
OLD | NEW |