| 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/navigation_entry_impl.h" |
| 18 #include "content/browser/frame_host/navigator.h" | 19 #include "content/browser/frame_host/navigator.h" |
| 19 #include "content/browser/frame_host/render_frame_host_factory.h" | 20 #include "content/browser/frame_host/render_frame_host_factory.h" |
| 20 #include "content/browser/frame_host/render_frame_host_impl.h" | 21 #include "content/browser/frame_host/render_frame_host_impl.h" |
| 21 #include "content/browser/frame_host/render_frame_proxy_host.h" | 22 #include "content/browser/frame_host/render_frame_proxy_host.h" |
| 22 #include "content/browser/renderer_host/render_view_host_factory.h" | 23 #include "content/browser/renderer_host/render_view_host_factory.h" |
| 23 #include "content/browser/renderer_host/render_view_host_impl.h" | 24 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 24 #include "content/common/content_switches_internal.h" | 25 #include "content/common/content_switches_internal.h" |
| 25 #include "content/common/frame_owner_properties.h" | 26 #include "content/common/frame_owner_properties.h" |
| 26 #include "content/common/input_messages.h" | 27 #include "content/common/input_messages.h" |
| 27 #include "content/common/site_isolation_policy.h" | 28 #include "content/common/site_isolation_policy.h" |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 return false; | 186 return false; |
| 186 | 187 |
| 187 // AddChild is what creates the RenderFrameHost. | 188 // AddChild is what creates the RenderFrameHost. |
| 188 FrameTreeNode* added_node = parent->AddChild( | 189 FrameTreeNode* added_node = parent->AddChild( |
| 189 base::WrapUnique(new FrameTreeNode( | 190 base::WrapUnique(new FrameTreeNode( |
| 190 this, parent->navigator(), render_frame_delegate_, | 191 this, parent->navigator(), render_frame_delegate_, |
| 191 render_widget_delegate_, manager_delegate_, parent, scope, frame_name, | 192 render_widget_delegate_, manager_delegate_, parent, scope, frame_name, |
| 192 frame_unique_name, frame_owner_properties)), | 193 frame_unique_name, frame_owner_properties)), |
| 193 process_id, new_routing_id); | 194 process_id, new_routing_id); |
| 194 | 195 |
| 196 // The last committed NavigationEntry may have a FrameNavigationEntry with the |
| 197 // same |frame_unique_name|, since we don't remove FrameNavigationEntries if |
| 198 // their frames are deleted. If there is a stale one, remove it to avoid |
| 199 // conflicts on future updates. |
| 200 NavigationEntryImpl* last_committed_entry = static_cast<NavigationEntryImpl*>( |
| 201 parent->navigator()->GetController()->GetLastCommittedEntry()); |
| 202 if (last_committed_entry) |
| 203 last_committed_entry->ClearMatchingFrameEntries(added_node); |
| 204 |
| 195 // Set sandbox flags and make them effective immediately, since initial | 205 // Set sandbox flags and make them effective immediately, since initial |
| 196 // sandbox flags should apply to the initial empty document in the frame. | 206 // sandbox flags should apply to the initial empty document in the frame. |
| 197 added_node->SetPendingSandboxFlags(sandbox_flags); | 207 added_node->SetPendingSandboxFlags(sandbox_flags); |
| 198 added_node->CommitPendingSandboxFlags(); | 208 added_node->CommitPendingSandboxFlags(); |
| 199 | 209 |
| 200 // Now that the new node is part of the FrameTree and has a RenderFrameHost, | 210 // Now that the new node is part of the FrameTree and has a RenderFrameHost, |
| 201 // we can announce the creation of the initial RenderFrame which already | 211 // we can announce the creation of the initial RenderFrame which already |
| 202 // exists in the renderer process. | 212 // exists in the renderer process. |
| 203 added_node->current_frame_host()->SetRenderFrameCreated(true); | 213 added_node->current_frame_host()->SetRenderFrameCreated(true); |
| 204 return true; | 214 return true; |
| (...skipping 243 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 | 458 // 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. | 459 // requests to set focus in main frame's SiteInstance are ignored. |
| 450 if (instance != root_manager->current_frame_host()->GetSiteInstance()) { | 460 if (instance != root_manager->current_frame_host()->GetSiteInstance()) { |
| 451 RenderFrameProxyHost* proxy = | 461 RenderFrameProxyHost* proxy = |
| 452 root_manager->GetRenderFrameProxyHost(instance); | 462 root_manager->GetRenderFrameProxyHost(instance); |
| 453 proxy->Send(new InputMsg_SetFocus(proxy->GetRoutingID(), is_focused)); | 463 proxy->Send(new InputMsg_SetFocus(proxy->GetRoutingID(), is_focused)); |
| 454 } | 464 } |
| 455 } | 465 } |
| 456 | 466 |
| 457 } // namespace content | 467 } // namespace content |
| OLD | NEW |