| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 root_(new FrameTreeNode(this, | 92 root_(new FrameTreeNode(this, |
| 93 navigator, | 93 navigator, |
| 94 render_frame_delegate, | 94 render_frame_delegate, |
| 95 render_view_delegate, | 95 render_view_delegate, |
| 96 render_widget_delegate, | 96 render_widget_delegate, |
| 97 manager_delegate, | 97 manager_delegate, |
| 98 // The top-level frame must always be in a | 98 // The top-level frame must always be in a |
| 99 // document scope. | 99 // document scope. |
| 100 blink::WebTreeScopeType::Document, | 100 blink::WebTreeScopeType::Document, |
| 101 std::string(), | 101 std::string(), |
| 102 std::string(), |
| 102 blink::WebFrameOwnerProperties())), | 103 blink::WebFrameOwnerProperties())), |
| 103 focused_frame_tree_node_id_(-1), | 104 focused_frame_tree_node_id_(-1), |
| 104 load_progress_(0.0) {} | 105 load_progress_(0.0) {} |
| 105 | 106 |
| 106 FrameTree::~FrameTree() { | 107 FrameTree::~FrameTree() { |
| 107 delete root_; | 108 delete root_; |
| 108 root_ = nullptr; | 109 root_ = nullptr; |
| 109 } | 110 } |
| 110 | 111 |
| 111 FrameTreeNode* FrameTree::FindByID(int frame_tree_node_id) { | 112 FrameTreeNode* FrameTree::FindByID(int frame_tree_node_id) { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 FrameTree::NodeRange FrameTree::NodesExcept(FrameTreeNode* node_to_skip) { | 156 FrameTree::NodeRange FrameTree::NodesExcept(FrameTreeNode* node_to_skip) { |
| 156 return NodeRange(this, node_to_skip); | 157 return NodeRange(this, node_to_skip); |
| 157 } | 158 } |
| 158 | 159 |
| 159 bool FrameTree::AddFrame( | 160 bool FrameTree::AddFrame( |
| 160 FrameTreeNode* parent, | 161 FrameTreeNode* parent, |
| 161 int process_id, | 162 int process_id, |
| 162 int new_routing_id, | 163 int new_routing_id, |
| 163 blink::WebTreeScopeType scope, | 164 blink::WebTreeScopeType scope, |
| 164 const std::string& frame_name, | 165 const std::string& frame_name, |
| 166 const std::string& frame_unique_name, |
| 165 blink::WebSandboxFlags sandbox_flags, | 167 blink::WebSandboxFlags sandbox_flags, |
| 166 const blink::WebFrameOwnerProperties& frame_owner_properties) { | 168 const blink::WebFrameOwnerProperties& frame_owner_properties) { |
| 167 CHECK_NE(new_routing_id, MSG_ROUTING_NONE); | 169 CHECK_NE(new_routing_id, MSG_ROUTING_NONE); |
| 168 | 170 |
| 169 // A child frame always starts with an initial empty document, which means | 171 // A child frame always starts with an initial empty document, which means |
| 170 // it is in the same SiteInstance as the parent frame. Ensure that the process | 172 // it is in the same SiteInstance as the parent frame. Ensure that the process |
| 171 // which requested a child frame to be added is the same as the process of the | 173 // which requested a child frame to be added is the same as the process of the |
| 172 // parent node. | 174 // parent node. |
| 173 if (parent->current_frame_host()->GetProcess()->GetID() != process_id) | 175 if (parent->current_frame_host()->GetProcess()->GetID() != process_id) |
| 174 return false; | 176 return false; |
| 175 | 177 |
| 176 // AddChild is what creates the RenderFrameHost. | 178 // AddChild is what creates the RenderFrameHost. |
| 177 FrameTreeNode* added_node = parent->AddChild( | 179 FrameTreeNode* added_node = parent->AddChild( |
| 178 make_scoped_ptr(new FrameTreeNode( | 180 make_scoped_ptr(new FrameTreeNode( |
| 179 this, parent->navigator(), render_frame_delegate_, | 181 this, parent->navigator(), render_frame_delegate_, |
| 180 render_view_delegate_, render_widget_delegate_, manager_delegate_, | 182 render_view_delegate_, render_widget_delegate_, manager_delegate_, |
| 181 scope, frame_name, frame_owner_properties)), | 183 scope, frame_name, frame_unique_name, frame_owner_properties)), |
| 182 process_id, new_routing_id); | 184 process_id, new_routing_id); |
| 183 | 185 |
| 184 // Set sandbox flags and make them effective immediately, since initial | 186 // Set sandbox flags and make them effective immediately, since initial |
| 185 // sandbox flags should apply to the initial empty document in the frame. | 187 // sandbox flags should apply to the initial empty document in the frame. |
| 186 added_node->SetPendingSandboxFlags(sandbox_flags); | 188 added_node->SetPendingSandboxFlags(sandbox_flags); |
| 187 added_node->CommitPendingSandboxFlags(); | 189 added_node->CommitPendingSandboxFlags(); |
| 188 | 190 |
| 189 // Now that the new node is part of the FrameTree and has a RenderFrameHost, | 191 // Now that the new node is part of the FrameTree and has a RenderFrameHost, |
| 190 // we can announce the creation of the initial RenderFrame which already | 192 // we can announce the creation of the initial RenderFrame which already |
| 191 // exists in the renderer process. | 193 // exists in the renderer process. |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 // This is only used to set page-level focus in cross-process subframes, and | 454 // This is only used to set page-level focus in cross-process subframes, and |
| 453 // requests to set focus in main frame's SiteInstance are ignored. | 455 // requests to set focus in main frame's SiteInstance are ignored. |
| 454 if (instance != root_manager->current_frame_host()->GetSiteInstance()) { | 456 if (instance != root_manager->current_frame_host()->GetSiteInstance()) { |
| 455 RenderFrameProxyHost* proxy = | 457 RenderFrameProxyHost* proxy = |
| 456 root_manager->GetRenderFrameProxyHost(instance); | 458 root_manager->GetRenderFrameProxyHost(instance); |
| 457 proxy->Send(new InputMsg_SetFocus(proxy->GetRoutingID(), is_focused)); | 459 proxy->Send(new InputMsg_SetFocus(proxy->GetRoutingID(), is_focused)); |
| 458 } | 460 } |
| 459 } | 461 } |
| 460 | 462 |
| 461 } // namespace content | 463 } // namespace content |
| OLD | NEW |