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

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

Issue 1683593002: Don't use pending NavigationEntries for navigation transfers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Clean up Created 4 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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 708 matching lines...) Expand 10 before | Expand all | Expand 10 after
719 // Note also that we hide the referrer for Web UI pages. We don't really 719 // Note also that we hide the referrer for Web UI pages. We don't really
720 // want web sites to see a referrer of "chrome://blah" (and some 720 // want web sites to see a referrer of "chrome://blah" (and some
721 // chrome: URLs might have search terms or other stuff we don't want to 721 // chrome: URLs might have search terms or other stuff we don't want to
722 // send to the site), so we send no referrer. 722 // send to the site), so we send no referrer.
723 referrer_to_use = Referrer(); 723 referrer_to_use = Referrer();
724 724
725 // Navigations in Web UI pages count as browser-initiated navigations. 725 // Navigations in Web UI pages count as browser-initiated navigations.
726 is_renderer_initiated = false; 726 is_renderer_initiated = false;
727 } 727 }
728 728
729 NavigationController::LoadURLParams load_url_params(dest_url); 729 // Create a NavigationEntry for the transfer, without making it the pending
730 // entry. Subframe transfers should only be possible in OOPIF-enabled modes,
731 // and should have a clone of the last committed entry with a
732 // FrameNavigationEntry for the target frame. Main frame transfers should
733 // have a new NavigationEntry.
734 // TODO(creis): Make this unnecessary by creating (and validating) the params
735 // directly, passing them to the destination RenderFrameHost.
736 scoped_ptr<NavigationEntryImpl> entry;
737 if (!node->IsMainFrame()) {
738 // Subframe case: create FrameNavigationEntry.
739 CHECK(SiteIsolationPolicy::UseSubframeNavigationEntries());
740 if (controller_->GetLastCommittedEntry()) {
741 entry = controller_->GetLastCommittedEntry()->Clone();
742 entry->SetPageID(-1);
743 } else {
744 // If there's no last committed entry, create an entry for about:blank
745 // with a subframe entry for our destination.
alexmos 2016/03/21 21:41:26 Just curious, the old path through LoadURLWithPara
Charlie Reis 2016/03/30 15:26:07 Yes, now we can create OOPIFs in the initial blank
746 // TODO(creis): Ensure this case can't exist in https://crbug.com/524208.
747 entry = NavigationEntryImpl::FromNavigationEntry(
748 controller_->CreateNavigationEntry(
749 GURL(url::kAboutBlankURL), referrer, page_transition,
alexmos 2016/03/21 21:41:26 Should this pass referrer_to_use? Same for two ot
Charlie Reis 2016/03/30 15:26:07 Good catch!
750 is_renderer_initiated, std::string(),
751 controller_->GetBrowserContext()));
752 }
753 entry->AddOrUpdateFrameEntry(node, std::string(), -1, -1, nullptr, dest_url,
754 referrer, PageState());
755 } else {
756 // Main frame case.
757 entry = NavigationEntryImpl::FromNavigationEntry(
758 controller_->CreateNavigationEntry(dest_url, referrer, page_transition,
759 is_renderer_initiated, std::string(),
760 controller_->GetBrowserContext()));
761 }
762
730 // The source_site_instance may matter for navigations via RenderFrameProxy. 763 // The source_site_instance may matter for navigations via RenderFrameProxy.
731 load_url_params.source_site_instance = source_site_instance; 764 entry->set_source_site_instance(
732 load_url_params.transition_type = page_transition; 765 static_cast<SiteInstanceImpl*>(source_site_instance));
733 load_url_params.frame_tree_node_id = node->frame_tree_node_id(); 766 entry->SetRedirectChain(redirect_chain);
734 load_url_params.referrer = referrer_to_use; 767 // Don't allow an entry replacement if there is no entry to replace.
735 load_url_params.redirect_chain = redirect_chain; 768 // http://crbug.com/457149
736 load_url_params.is_renderer_initiated = is_renderer_initiated; 769 if (should_replace_current_entry && controller_->GetEntryCount() > 0)
737 load_url_params.transferred_global_request_id = transferred_global_request_id; 770 entry->set_should_replace_entry(true);
738 load_url_params.should_replace_current_entry = should_replace_current_entry; 771 entry->set_transferred_global_request_id(transferred_global_request_id);
alexmos 2016/03/21 21:41:26 Does entry->SetIsOverridingUserAgent() also need t
Charlie Reis 2016/03/30 15:26:07 Ah, nice find. I must have assumed there was no e
739 772 // TODO(creis): Set user gesture and intent received timestamp on Android.
740 controller_->LoadURLWithParams(load_url_params); 773 FrameNavigationEntry* frame_entry = entry->GetFrameEntry(node);
alexmos 2016/03/21 21:41:26 The old path used to return early if the target UR
Charlie Reis 2016/03/30 15:26:08 Right, we can't get a transfer for a debug URL.
774 NavigateToEntry(node, *frame_entry, *entry.get(),
775 NavigationController::NO_RELOAD, false, false);
741 } 776 }
742 777
743 // PlzNavigate 778 // PlzNavigate
744 void NavigatorImpl::OnBeforeUnloadACK(FrameTreeNode* frame_tree_node, 779 void NavigatorImpl::OnBeforeUnloadACK(FrameTreeNode* frame_tree_node,
745 bool proceed) { 780 bool proceed) {
746 CHECK(IsBrowserSideNavigationEnabled()); 781 CHECK(IsBrowserSideNavigationEnabled());
747 DCHECK(frame_tree_node); 782 DCHECK(frame_tree_node);
748 783
749 NavigationRequest* navigation_request = frame_tree_node->navigation_request(); 784 NavigationRequest* navigation_request = frame_tree_node->navigation_request();
750 785
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
1131 if (pending_entry != controller_->GetVisibleEntry() || 1166 if (pending_entry != controller_->GetVisibleEntry() ||
1132 !should_preserve_entry) { 1167 !should_preserve_entry) {
1133 controller_->DiscardPendingEntry(true); 1168 controller_->DiscardPendingEntry(true);
1134 1169
1135 // Also force the UI to refresh. 1170 // Also force the UI to refresh.
1136 controller_->delegate()->NotifyNavigationStateChanged(INVALIDATE_TYPE_URL); 1171 controller_->delegate()->NotifyNavigationStateChanged(INVALIDATE_TYPE_URL);
1137 } 1172 }
1138 } 1173 }
1139 1174
1140 } // namespace content 1175 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698