| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <queue> | 9 #include <queue> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 root_(new FrameTreeNode(this, | 130 root_(new FrameTreeNode(this, |
| 131 navigator, | 131 navigator, |
| 132 render_frame_delegate, | 132 render_frame_delegate, |
| 133 render_view_delegate, | 133 render_view_delegate, |
| 134 render_widget_delegate, | 134 render_widget_delegate, |
| 135 manager_delegate, | 135 manager_delegate, |
| 136 // The top-level frame must always be in a | 136 // The top-level frame must always be in a |
| 137 // document scope. | 137 // document scope. |
| 138 blink::WebTreeScopeType::Document, | 138 blink::WebTreeScopeType::Document, |
| 139 std::string(), | 139 std::string(), |
| 140 std::string(), |
| 140 blink::WebFrameOwnerProperties())), | 141 blink::WebFrameOwnerProperties())), |
| 141 focused_frame_tree_node_id_(-1), | 142 focused_frame_tree_node_id_(-1), |
| 142 load_progress_(0.0) {} | 143 load_progress_(0.0) {} |
| 143 | 144 |
| 144 FrameTree::~FrameTree() { | 145 FrameTree::~FrameTree() { |
| 145 delete root_; | 146 delete root_; |
| 146 root_ = nullptr; | 147 root_ = nullptr; |
| 147 } | 148 } |
| 148 | 149 |
| 149 FrameTreeNode* FrameTree::FindByID(int frame_tree_node_id) { | 150 FrameTreeNode* FrameTree::FindByID(int frame_tree_node_id) { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 FrameTree::ConstNodeRange FrameTree::ConstNodes() const { | 198 FrameTree::ConstNodeRange FrameTree::ConstNodes() const { |
| 198 return ConstNodeRange(this); | 199 return ConstNodeRange(this); |
| 199 } | 200 } |
| 200 | 201 |
| 201 bool FrameTree::AddFrame( | 202 bool FrameTree::AddFrame( |
| 202 FrameTreeNode* parent, | 203 FrameTreeNode* parent, |
| 203 int process_id, | 204 int process_id, |
| 204 int new_routing_id, | 205 int new_routing_id, |
| 205 blink::WebTreeScopeType scope, | 206 blink::WebTreeScopeType scope, |
| 206 const std::string& frame_name, | 207 const std::string& frame_name, |
| 208 const std::string& frame_unique_name, |
| 207 blink::WebSandboxFlags sandbox_flags, | 209 blink::WebSandboxFlags sandbox_flags, |
| 208 const blink::WebFrameOwnerProperties& frame_owner_properties) { | 210 const blink::WebFrameOwnerProperties& frame_owner_properties) { |
| 209 CHECK_NE(new_routing_id, MSG_ROUTING_NONE); | 211 CHECK_NE(new_routing_id, MSG_ROUTING_NONE); |
| 210 | 212 |
| 211 // A child frame always starts with an initial empty document, which means | 213 // A child frame always starts with an initial empty document, which means |
| 212 // it is in the same SiteInstance as the parent frame. Ensure that the process | 214 // it is in the same SiteInstance as the parent frame. Ensure that the process |
| 213 // which requested a child frame to be added is the same as the process of the | 215 // which requested a child frame to be added is the same as the process of the |
| 214 // parent node. | 216 // parent node. |
| 215 if (parent->current_frame_host()->GetProcess()->GetID() != process_id) | 217 if (parent->current_frame_host()->GetProcess()->GetID() != process_id) |
| 216 return false; | 218 return false; |
| 217 | 219 |
| 218 // AddChild is what creates the RenderFrameHost. | 220 // AddChild is what creates the RenderFrameHost. |
| 219 FrameTreeNode* added_node = parent->AddChild( | 221 FrameTreeNode* added_node = parent->AddChild( |
| 220 make_scoped_ptr(new FrameTreeNode( | 222 make_scoped_ptr(new FrameTreeNode( |
| 221 this, parent->navigator(), render_frame_delegate_, | 223 this, parent->navigator(), render_frame_delegate_, |
| 222 render_view_delegate_, render_widget_delegate_, manager_delegate_, | 224 render_view_delegate_, render_widget_delegate_, manager_delegate_, |
| 223 scope, frame_name, frame_owner_properties)), | 225 scope, frame_name, frame_unique_name, frame_owner_properties)), |
| 224 process_id, new_routing_id); | 226 process_id, new_routing_id); |
| 225 | 227 |
| 226 // Set sandbox flags and make them effective immediately, since initial | 228 // Set sandbox flags and make them effective immediately, since initial |
| 227 // sandbox flags should apply to the initial empty document in the frame. | 229 // sandbox flags should apply to the initial empty document in the frame. |
| 228 added_node->SetPendingSandboxFlags(sandbox_flags); | 230 added_node->SetPendingSandboxFlags(sandbox_flags); |
| 229 added_node->CommitPendingSandboxFlags(); | 231 added_node->CommitPendingSandboxFlags(); |
| 230 | 232 |
| 231 // Now that the new node is part of the FrameTree and has a RenderFrameHost, | 233 // Now that the new node is part of the FrameTree and has a RenderFrameHost, |
| 232 // we can announce the creation of the initial RenderFrame which already | 234 // we can announce the creation of the initial RenderFrame which already |
| 233 // exists in the renderer process. | 235 // exists in the renderer process. |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 // This is only used to set page-level focus in cross-process subframes, and | 496 // This is only used to set page-level focus in cross-process subframes, and |
| 495 // requests to set focus in main frame's SiteInstance are ignored. | 497 // requests to set focus in main frame's SiteInstance are ignored. |
| 496 if (instance != root_manager->current_frame_host()->GetSiteInstance()) { | 498 if (instance != root_manager->current_frame_host()->GetSiteInstance()) { |
| 497 RenderFrameProxyHost* proxy = | 499 RenderFrameProxyHost* proxy = |
| 498 root_manager->GetRenderFrameProxyHost(instance); | 500 root_manager->GetRenderFrameProxyHost(instance); |
| 499 proxy->Send(new InputMsg_SetFocus(proxy->GetRoutingID(), is_focused)); | 501 proxy->Send(new InputMsg_SetFocus(proxy->GetRoutingID(), is_focused)); |
| 500 } | 502 } |
| 501 } | 503 } |
| 502 | 504 |
| 503 } // namespace content | 505 } // namespace content |
| OLD | NEW |