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> |
11 | 11 |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/callback.h" | 13 #include "base/callback.h" |
14 #include "base/containers/hash_tables.h" | 14 #include "base/containers/hash_tables.h" |
15 #include "base/lazy_instance.h" | 15 #include "base/lazy_instance.h" |
16 #include "base/memory/ptr_util.h" | 16 #include "base/memory/ptr_util.h" |
17 #include "content/browser/frame_host/frame_tree_node.h" | 17 #include "content/browser/frame_host/frame_tree_node.h" |
18 #include "content/browser/frame_host/navigator.h" | 18 #include "content/browser/frame_host/navigator.h" |
19 #include "content/browser/frame_host/render_frame_host_factory.h" | 19 #include "content/browser/frame_host/render_frame_host_factory.h" |
20 #include "content/browser/frame_host/render_frame_host_impl.h" | 20 #include "content/browser/frame_host/render_frame_host_impl.h" |
21 #include "content/browser/frame_host/render_frame_proxy_host.h" | 21 #include "content/browser/frame_host/render_frame_proxy_host.h" |
22 #include "content/browser/renderer_host/render_view_host_factory.h" | 22 #include "content/browser/renderer_host/render_view_host_factory.h" |
23 #include "content/browser/renderer_host/render_view_host_impl.h" | 23 #include "content/browser/renderer_host/render_view_host_impl.h" |
24 #include "content/common/content_switches_internal.h" | 24 #include "content/common/content_switches_internal.h" |
| 25 #include "content/common/frame_owner_properties.h" |
25 #include "content/common/input_messages.h" | 26 #include "content/common/input_messages.h" |
26 #include "content/common/site_isolation_policy.h" | 27 #include "content/common/site_isolation_policy.h" |
27 #include "third_party/WebKit/public/web/WebSandboxFlags.h" | 28 #include "third_party/WebKit/public/web/WebSandboxFlags.h" |
28 | 29 |
29 namespace content { | 30 namespace content { |
30 | 31 |
31 namespace { | 32 namespace { |
32 | 33 |
33 // Helper function to collect SiteInstances involved in rendering a single | 34 // Helper function to collect SiteInstances involved in rendering a single |
34 // FrameTree (which is a subset of SiteInstances in main frame's proxy_hosts_ | 35 // FrameTree (which is a subset of SiteInstances in main frame's proxy_hosts_ |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 navigator, | 99 navigator, |
99 render_frame_delegate, | 100 render_frame_delegate, |
100 render_widget_delegate, | 101 render_widget_delegate, |
101 manager_delegate, | 102 manager_delegate, |
102 nullptr, | 103 nullptr, |
103 // The top-level frame must always be in a | 104 // The top-level frame must always be in a |
104 // document scope. | 105 // document scope. |
105 blink::WebTreeScopeType::Document, | 106 blink::WebTreeScopeType::Document, |
106 std::string(), | 107 std::string(), |
107 std::string(), | 108 std::string(), |
108 blink::WebFrameOwnerProperties())), | 109 FrameOwnerProperties())), |
109 focused_frame_tree_node_id_(-1), | 110 focused_frame_tree_node_id_(-1), |
110 load_progress_(0.0) {} | 111 load_progress_(0.0) {} |
111 | 112 |
112 FrameTree::~FrameTree() { | 113 FrameTree::~FrameTree() { |
113 delete root_; | 114 delete root_; |
114 root_ = nullptr; | 115 root_ = nullptr; |
115 } | 116 } |
116 | 117 |
117 FrameTreeNode* FrameTree::FindByID(int frame_tree_node_id) { | 118 FrameTreeNode* FrameTree::FindByID(int frame_tree_node_id) { |
118 for (FrameTreeNode* node : Nodes()) { | 119 for (FrameTreeNode* node : Nodes()) { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 } | 160 } |
160 | 161 |
161 FrameTree::NodeRange FrameTree::SubtreeNodes(FrameTreeNode* subtree_root) { | 162 FrameTree::NodeRange FrameTree::SubtreeNodes(FrameTreeNode* subtree_root) { |
162 return NodeRange(subtree_root, nullptr); | 163 return NodeRange(subtree_root, nullptr); |
163 } | 164 } |
164 | 165 |
165 FrameTree::NodeRange FrameTree::NodesExcept(FrameTreeNode* node_to_skip) { | 166 FrameTree::NodeRange FrameTree::NodesExcept(FrameTreeNode* node_to_skip) { |
166 return NodeRange(root_, node_to_skip); | 167 return NodeRange(root_, node_to_skip); |
167 } | 168 } |
168 | 169 |
169 bool FrameTree::AddFrame( | 170 bool FrameTree::AddFrame(FrameTreeNode* parent, |
170 FrameTreeNode* parent, | 171 int process_id, |
171 int process_id, | 172 int new_routing_id, |
172 int new_routing_id, | 173 blink::WebTreeScopeType scope, |
173 blink::WebTreeScopeType scope, | 174 const std::string& frame_name, |
174 const std::string& frame_name, | 175 const std::string& frame_unique_name, |
175 const std::string& frame_unique_name, | 176 blink::WebSandboxFlags sandbox_flags, |
176 blink::WebSandboxFlags sandbox_flags, | 177 const FrameOwnerProperties& frame_owner_properties) { |
177 const blink::WebFrameOwnerProperties& frame_owner_properties) { | |
178 CHECK_NE(new_routing_id, MSG_ROUTING_NONE); | 178 CHECK_NE(new_routing_id, MSG_ROUTING_NONE); |
179 | 179 |
180 // A child frame always starts with an initial empty document, which means | 180 // A child frame always starts with an initial empty document, which means |
181 // it is in the same SiteInstance as the parent frame. Ensure that the process | 181 // it is in the same SiteInstance as the parent frame. Ensure that the process |
182 // which requested a child frame to be added is the same as the process of the | 182 // which requested a child frame to be added is the same as the process of the |
183 // parent node. | 183 // parent node. |
184 if (parent->current_frame_host()->GetProcess()->GetID() != process_id) | 184 if (parent->current_frame_host()->GetProcess()->GetID() != process_id) |
185 return false; | 185 return false; |
186 | 186 |
187 // AddChild is what creates the RenderFrameHost. | 187 // AddChild is what creates the RenderFrameHost. |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 // This is only used to set page-level focus in cross-process subframes, and | 448 // This is only used to set page-level focus in cross-process subframes, and |
449 // requests to set focus in main frame's SiteInstance are ignored. | 449 // requests to set focus in main frame's SiteInstance are ignored. |
450 if (instance != root_manager->current_frame_host()->GetSiteInstance()) { | 450 if (instance != root_manager->current_frame_host()->GetSiteInstance()) { |
451 RenderFrameProxyHost* proxy = | 451 RenderFrameProxyHost* proxy = |
452 root_manager->GetRenderFrameProxyHost(instance); | 452 root_manager->GetRenderFrameProxyHost(instance); |
453 proxy->Send(new InputMsg_SetFocus(proxy->GetRoutingID(), is_focused)); | 453 proxy->Send(new InputMsg_SetFocus(proxy->GetRoutingID(), is_focused)); |
454 } | 454 } |
455 } | 455 } |
456 | 456 |
457 } // namespace content | 457 } // namespace content |
OLD | NEW |