Chromium Code Reviews| 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_controller_impl.h" | |
| 19 #include "content/browser/frame_host/navigation_entry_impl.h" | |
| 18 #include "content/browser/frame_host/navigator.h" | 20 #include "content/browser/frame_host/navigator.h" |
| 19 #include "content/browser/frame_host/render_frame_host_factory.h" | 21 #include "content/browser/frame_host/render_frame_host_factory.h" |
| 20 #include "content/browser/frame_host/render_frame_host_impl.h" | 22 #include "content/browser/frame_host/render_frame_host_impl.h" |
| 21 #include "content/browser/frame_host/render_frame_proxy_host.h" | 23 #include "content/browser/frame_host/render_frame_proxy_host.h" |
| 22 #include "content/browser/renderer_host/render_view_host_factory.h" | 24 #include "content/browser/renderer_host/render_view_host_factory.h" |
| 23 #include "content/browser/renderer_host/render_view_host_impl.h" | 25 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 24 #include "content/common/content_switches_internal.h" | 26 #include "content/common/content_switches_internal.h" |
| 25 #include "content/common/frame_owner_properties.h" | 27 #include "content/common/frame_owner_properties.h" |
| 26 #include "content/common/input_messages.h" | 28 #include "content/common/input_messages.h" |
| 27 #include "content/common/site_isolation_policy.h" | 29 #include "content/common/site_isolation_policy.h" |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 185 return false; | 187 return false; |
| 186 | 188 |
| 187 // AddChild is what creates the RenderFrameHost. | 189 // AddChild is what creates the RenderFrameHost. |
| 188 FrameTreeNode* added_node = parent->AddChild( | 190 FrameTreeNode* added_node = parent->AddChild( |
| 189 base::WrapUnique(new FrameTreeNode( | 191 base::WrapUnique(new FrameTreeNode( |
| 190 this, parent->navigator(), render_frame_delegate_, | 192 this, parent->navigator(), render_frame_delegate_, |
| 191 render_widget_delegate_, manager_delegate_, parent, scope, frame_name, | 193 render_widget_delegate_, manager_delegate_, parent, scope, frame_name, |
| 192 frame_unique_name, frame_owner_properties)), | 194 frame_unique_name, frame_owner_properties)), |
| 193 process_id, new_routing_id); | 195 process_id, new_routing_id); |
| 194 | 196 |
| 197 // The last committed NavigationEntry may have a FrameNavigationEntry with the | |
| 198 // same |frame_unique_name|, since we don't remove FrameNavigationEntries if | |
| 199 // their frames are deleted. If there is a stale one, remove it to avoid | |
| 200 // conflicts on future updates. | |
| 201 NavigationEntryImpl* last_committed_entry = static_cast<NavigationEntryImpl*>( | |
| 202 parent->navigator()->GetController()->GetLastCommittedEntry()); | |
| 203 if (last_committed_entry) | |
| 204 last_committed_entry->ClearMatchingFrameEntries(added_node); | |
|
Charlie Reis
2016/07/29 17:21:35
Maybe the name can be clearer about the fact that
nasko
2016/08/01 20:42:16
Done.
| |
| 205 | |
| 195 // Set sandbox flags and make them effective immediately, since initial | 206 // Set sandbox flags and make them effective immediately, since initial |
| 196 // sandbox flags should apply to the initial empty document in the frame. | 207 // sandbox flags should apply to the initial empty document in the frame. |
| 197 added_node->SetPendingSandboxFlags(sandbox_flags); | 208 added_node->SetPendingSandboxFlags(sandbox_flags); |
| 198 added_node->CommitPendingSandboxFlags(); | 209 added_node->CommitPendingSandboxFlags(); |
| 199 | 210 |
| 200 // Now that the new node is part of the FrameTree and has a RenderFrameHost, | 211 // 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 | 212 // we can announce the creation of the initial RenderFrame which already |
| 202 // exists in the renderer process. | 213 // exists in the renderer process. |
| 203 added_node->current_frame_host()->SetRenderFrameCreated(true); | 214 added_node->current_frame_host()->SetRenderFrameCreated(true); |
| 204 return true; | 215 return true; |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 461 // This is only used to set page-level focus in cross-process subframes, and | 472 // This is only used to set page-level focus in cross-process subframes, and |
| 462 // requests to set focus in main frame's SiteInstance are ignored. | 473 // requests to set focus in main frame's SiteInstance are ignored. |
| 463 if (instance != root_manager->current_frame_host()->GetSiteInstance()) { | 474 if (instance != root_manager->current_frame_host()->GetSiteInstance()) { |
| 464 RenderFrameProxyHost* proxy = | 475 RenderFrameProxyHost* proxy = |
| 465 root_manager->GetRenderFrameProxyHost(instance); | 476 root_manager->GetRenderFrameProxyHost(instance); |
| 466 proxy->Send(new InputMsg_SetFocus(proxy->GetRoutingID(), is_focused)); | 477 proxy->Send(new InputMsg_SetFocus(proxy->GetRoutingID(), is_focused)); |
| 467 } | 478 } |
| 468 } | 479 } |
| 469 | 480 |
| 470 } // namespace content | 481 } // namespace content |
| OLD | NEW |