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/navigator_impl.h" | 5 #include "content/browser/frame_host/navigator_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
427 } | 427 } |
428 | 428 |
429 bool NavigatorImpl::NavigateNewChildFrame( | 429 bool NavigatorImpl::NavigateNewChildFrame( |
430 RenderFrameHostImpl* render_frame_host, | 430 RenderFrameHostImpl* render_frame_host, |
431 const std::string& unique_name) { | 431 const std::string& unique_name) { |
432 NavigationEntryImpl* entry = | 432 NavigationEntryImpl* entry = |
433 controller_->GetEntryWithUniqueID(render_frame_host->nav_entry_id()); | 433 controller_->GetEntryWithUniqueID(render_frame_host->nav_entry_id()); |
434 if (!entry) | 434 if (!entry) |
435 return false; | 435 return false; |
436 | 436 |
437 DCHECK_EQ(render_frame_host->frame_tree_node() | |
438 ->current_replication_state() | |
439 .unique_name, | |
440 unique_name); | |
alexmos
2016/04/06 17:14:22
Would we want to strengthen this to a CHECK at som
Charlie Reis
2016/04/12 16:25:51
We avoid CHECKs on messages received from the rend
alexmos
2016/04/12 18:55:40
Acknowledged.
| |
437 FrameNavigationEntry* frame_entry = | 441 FrameNavigationEntry* frame_entry = |
438 entry->GetFrameEntryByUniqueName(unique_name); | 442 entry->GetFrameEntry(render_frame_host->frame_tree_node()); |
439 if (!frame_entry) | 443 if (!frame_entry) |
440 return false; | 444 return false; |
441 | 445 |
442 // Update the FrameNavigationEntry's FrameTreeNode ID (which is currently the | |
443 // ID of the old FrameTreeNode that no longer exists) to be the ID of the | |
444 // newly created frame. | |
445 frame_entry->set_frame_tree_node_id( | |
446 render_frame_host->frame_tree_node()->frame_tree_node_id()); | |
447 | |
448 return NavigateToEntry(render_frame_host->frame_tree_node(), *frame_entry, | 446 return NavigateToEntry(render_frame_host->frame_tree_node(), *frame_entry, |
449 *entry, NavigationControllerImpl::NO_RELOAD, false, | 447 *entry, NavigationControllerImpl::NO_RELOAD, false, |
450 false); | 448 false); |
451 } | 449 } |
452 | 450 |
453 void NavigatorImpl::DidNavigate( | 451 void NavigatorImpl::DidNavigate( |
454 RenderFrameHostImpl* render_frame_host, | 452 RenderFrameHostImpl* render_frame_host, |
455 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) { | 453 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) { |
456 FrameTree* frame_tree = render_frame_host->frame_tree_node()->frame_tree(); | 454 FrameTree* frame_tree = render_frame_host->frame_tree_node()->frame_tree(); |
457 bool oopifs_possible = SiteIsolationPolicy::AreCrossProcessFramesPossible(); | 455 bool oopifs_possible = SiteIsolationPolicy::AreCrossProcessFramesPossible(); |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
773 } else { | 771 } else { |
774 // If there's no last committed entry, create an entry for about:blank | 772 // If there's no last committed entry, create an entry for about:blank |
775 // with a subframe entry for our destination. | 773 // with a subframe entry for our destination. |
776 // TODO(creis): Ensure this case can't exist in https://crbug.com/524208. | 774 // TODO(creis): Ensure this case can't exist in https://crbug.com/524208. |
777 entry = NavigationEntryImpl::FromNavigationEntry( | 775 entry = NavigationEntryImpl::FromNavigationEntry( |
778 controller_->CreateNavigationEntry( | 776 controller_->CreateNavigationEntry( |
779 GURL(url::kAboutBlankURL), referrer_to_use, page_transition, | 777 GURL(url::kAboutBlankURL), referrer_to_use, page_transition, |
780 is_renderer_initiated, std::string(), | 778 is_renderer_initiated, std::string(), |
781 controller_->GetBrowserContext())); | 779 controller_->GetBrowserContext())); |
782 } | 780 } |
783 entry->AddOrUpdateFrameEntry(node, std::string(), -1, -1, nullptr, dest_url, | 781 entry->AddOrUpdateFrameEntry(node, -1, -1, nullptr, dest_url, |
784 referrer_to_use, PageState()); | 782 referrer_to_use, PageState()); |
785 } else { | 783 } else { |
786 // Main frame case. | 784 // Main frame case. |
787 entry = NavigationEntryImpl::FromNavigationEntry( | 785 entry = NavigationEntryImpl::FromNavigationEntry( |
788 controller_->CreateNavigationEntry( | 786 controller_->CreateNavigationEntry( |
789 dest_url, referrer_to_use, page_transition, is_renderer_initiated, | 787 dest_url, referrer_to_use, page_transition, is_renderer_initiated, |
790 std::string(), controller_->GetBrowserContext())); | 788 std::string(), controller_->GetBrowserContext())); |
791 } | 789 } |
792 | 790 |
793 // The source_site_instance may matter for navigations via RenderFrameProxy. | 791 // The source_site_instance may matter for navigations via RenderFrameProxy. |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1135 if (pending_entry != controller_->GetVisibleEntry() || | 1133 if (pending_entry != controller_->GetVisibleEntry() || |
1136 !should_preserve_entry) { | 1134 !should_preserve_entry) { |
1137 controller_->DiscardPendingEntry(true); | 1135 controller_->DiscardPendingEntry(true); |
1138 | 1136 |
1139 // Also force the UI to refresh. | 1137 // Also force the UI to refresh. |
1140 controller_->delegate()->NotifyNavigationStateChanged(INVALIDATE_TYPE_URL); | 1138 controller_->delegate()->NotifyNavigationStateChanged(INVALIDATE_TYPE_URL); |
1141 } | 1139 } |
1142 } | 1140 } |
1143 | 1141 |
1144 } // namespace content | 1142 } // namespace content |
OLD | NEW |