Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: content/browser/frame_host/frame_tree.cc

Issue 2191543003: Remove existing FrameNavigationEntry when new named frame is added. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
Charlie Reis 2016/07/27 22:48:27 I suppose we should include NavigationController a
nasko 2016/07/29 15:52:19 Acknowledged.
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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 const FrameOwnerProperties& frame_owner_properties) { 178 const FrameOwnerProperties& frame_owner_properties) {
178 CHECK_NE(new_routing_id, MSG_ROUTING_NONE); 179 CHECK_NE(new_routing_id, MSG_ROUTING_NONE);
179 180
180 // A child frame always starts with an initial empty document, which means 181 // 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 182 // 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 183 // which requested a child frame to be added is the same as the process of the
183 // parent node. 184 // parent node.
184 if (parent->current_frame_host()->GetProcess()->GetID() != process_id) 185 if (parent->current_frame_host()->GetProcess()->GetID() != process_id)
185 return false; 186 return false;
186 187
188 // If the last committed NavigationEntry has FrameNavigationEntry with the
189 // same |frame_unique_name|, it has to be removed to avoid conflicts with
190 // future updates.
Charlie Reis 2016/07/27 22:48:27 Let's clarify a bit how this is an expected case:
nasko 2016/07/29 15:52:19 Done.
191 NavigationEntryImpl* last_committed_entry = static_cast<NavigationEntryImpl*>(
192 root_->navigator()->GetController()->GetLastCommittedEntry());
Charlie Reis 2016/07/27 22:48:27 This should be parent->navigator() to be consisten
nasko 2016/07/29 15:52:19 Done.
193 if (last_committed_entry)
194 last_committed_entry->ClearNamedFrameEntries(frame_unique_name);
195
187 // AddChild is what creates the RenderFrameHost. 196 // AddChild is what creates the RenderFrameHost.
188 FrameTreeNode* added_node = parent->AddChild( 197 FrameTreeNode* added_node = parent->AddChild(
189 base::WrapUnique(new FrameTreeNode( 198 base::WrapUnique(new FrameTreeNode(
190 this, parent->navigator(), render_frame_delegate_, 199 this, parent->navigator(), render_frame_delegate_,
191 render_widget_delegate_, manager_delegate_, parent, scope, frame_name, 200 render_widget_delegate_, manager_delegate_, parent, scope, frame_name,
192 frame_unique_name, frame_owner_properties)), 201 frame_unique_name, frame_owner_properties)),
193 process_id, new_routing_id); 202 process_id, new_routing_id);
194 203
195 // Set sandbox flags and make them effective immediately, since initial 204 // Set sandbox flags and make them effective immediately, since initial
196 // sandbox flags should apply to the initial empty document in the frame. 205 // sandbox flags should apply to the initial empty document in the frame.
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 // This is only used to set page-level focus in cross-process subframes, and 457 // 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. 458 // requests to set focus in main frame's SiteInstance are ignored.
450 if (instance != root_manager->current_frame_host()->GetSiteInstance()) { 459 if (instance != root_manager->current_frame_host()->GetSiteInstance()) {
451 RenderFrameProxyHost* proxy = 460 RenderFrameProxyHost* proxy =
452 root_manager->GetRenderFrameProxyHost(instance); 461 root_manager->GetRenderFrameProxyHost(instance);
453 proxy->Send(new InputMsg_SetFocus(proxy->GetRoutingID(), is_focused)); 462 proxy->Send(new InputMsg_SetFocus(proxy->GetRoutingID(), is_focused));
454 } 463 }
455 } 464 }
456 465
457 } // namespace content 466 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698