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

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

Issue 1861773002: Revert of Don't use pending NavigationEntries for navigation transfers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 | « content/browser/frame_host/navigation_controller_impl_browsertest.cc ('k') | 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 738 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 // Note also that we hide the referrer for Web UI pages. We don't really 749 // Note also that we hide the referrer for Web UI pages. We don't really
750 // want web sites to see a referrer of "chrome://blah" (and some 750 // want web sites to see a referrer of "chrome://blah" (and some
751 // chrome: URLs might have search terms or other stuff we don't want to 751 // chrome: URLs might have search terms or other stuff we don't want to
752 // send to the site), so we send no referrer. 752 // send to the site), so we send no referrer.
753 referrer_to_use = Referrer(); 753 referrer_to_use = Referrer();
754 754
755 // Navigations in Web UI pages count as browser-initiated navigations. 755 // Navigations in Web UI pages count as browser-initiated navigations.
756 is_renderer_initiated = false; 756 is_renderer_initiated = false;
757 } 757 }
758 758
759 // Create a NavigationEntry for the transfer, without making it the pending 759 NavigationController::LoadURLParams load_url_params(dest_url);
760 // entry. Subframe transfers should only be possible in OOPIF-enabled modes, 760 // The source_site_instance may matter for navigations via RenderFrameProxy.
761 // and should have a clone of the last committed entry with a 761 load_url_params.source_site_instance = source_site_instance;
762 // FrameNavigationEntry for the target frame. Main frame transfers should 762 load_url_params.transition_type = page_transition;
763 // have a new NavigationEntry. 763 load_url_params.frame_tree_node_id = node->frame_tree_node_id();
764 // TODO(creis): Make this unnecessary by creating (and validating) the params 764 load_url_params.referrer = referrer_to_use;
765 // directly, passing them to the destination RenderFrameHost. 765 load_url_params.redirect_chain = redirect_chain;
766 scoped_ptr<NavigationEntryImpl> entry; 766 load_url_params.is_renderer_initiated = is_renderer_initiated;
767 if (!node->IsMainFrame()) { 767 load_url_params.transferred_global_request_id = transferred_global_request_id;
768 // Subframe case: create FrameNavigationEntry. 768 load_url_params.should_replace_current_entry = should_replace_current_entry;
769 CHECK(SiteIsolationPolicy::UseSubframeNavigationEntries());
770 if (controller_->GetLastCommittedEntry()) {
771 entry = controller_->GetLastCommittedEntry()->Clone();
772 entry->SetPageID(-1);
773 } else {
774 // If there's no last committed entry, create an entry for about:blank
775 // with a subframe entry for our destination.
776 // TODO(creis): Ensure this case can't exist in https://crbug.com/524208.
777 entry = NavigationEntryImpl::FromNavigationEntry(
778 controller_->CreateNavigationEntry(
779 GURL(url::kAboutBlankURL), referrer_to_use, page_transition,
780 is_renderer_initiated, std::string(),
781 controller_->GetBrowserContext()));
782 }
783 entry->AddOrUpdateFrameEntry(node, std::string(), -1, -1, nullptr, dest_url,
784 referrer_to_use, PageState());
785 } else {
786 // Main frame case.
787 entry = NavigationEntryImpl::FromNavigationEntry(
788 controller_->CreateNavigationEntry(
789 dest_url, referrer_to_use, page_transition, is_renderer_initiated,
790 std::string(), controller_->GetBrowserContext()));
791 }
792 769
793 // The source_site_instance may matter for navigations via RenderFrameProxy. 770 controller_->LoadURLWithParams(load_url_params);
794 entry->set_source_site_instance(
795 static_cast<SiteInstanceImpl*>(source_site_instance));
796 entry->SetRedirectChain(redirect_chain);
797 // Don't allow an entry replacement if there is no entry to replace.
798 // http://crbug.com/457149
799 if (should_replace_current_entry && controller_->GetEntryCount() > 0)
800 entry->set_should_replace_entry(true);
801 if (controller_->GetLastCommittedEntry() &&
802 controller_->GetLastCommittedEntry()->GetIsOverridingUserAgent()) {
803 entry->SetIsOverridingUserAgent(true);
804 }
805 entry->set_transferred_global_request_id(transferred_global_request_id);
806 // TODO(creis): Set user gesture and intent received timestamp on Android.
807 FrameNavigationEntry* frame_entry = entry->GetFrameEntry(node);
808 NavigateToEntry(node, *frame_entry, *entry.get(),
809 NavigationController::NO_RELOAD, false, false);
810 } 771 }
811 772
812 // PlzNavigate 773 // PlzNavigate
813 void NavigatorImpl::OnBeforeUnloadACK(FrameTreeNode* frame_tree_node, 774 void NavigatorImpl::OnBeforeUnloadACK(FrameTreeNode* frame_tree_node,
814 bool proceed) { 775 bool proceed) {
815 CHECK(IsBrowserSideNavigationEnabled()); 776 CHECK(IsBrowserSideNavigationEnabled());
816 DCHECK(frame_tree_node); 777 DCHECK(frame_tree_node);
817 778
818 NavigationRequest* navigation_request = frame_tree_node->navigation_request(); 779 NavigationRequest* navigation_request = frame_tree_node->navigation_request();
819 780
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
1135 if (pending_entry != controller_->GetVisibleEntry() || 1096 if (pending_entry != controller_->GetVisibleEntry() ||
1136 !should_preserve_entry) { 1097 !should_preserve_entry) {
1137 controller_->DiscardPendingEntry(true); 1098 controller_->DiscardPendingEntry(true);
1138 1099
1139 // Also force the UI to refresh. 1100 // Also force the UI to refresh.
1140 controller_->delegate()->NotifyNavigationStateChanged(INVALIDATE_TYPE_URL); 1101 controller_->delegate()->NotifyNavigationStateChanged(INVALIDATE_TYPE_URL);
1141 } 1102 }
1142 } 1103 }
1143 1104
1144 } // namespace content 1105 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/navigation_controller_impl_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698