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

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

Issue 2368183004: Move redirect_chain from NavigationEntry to FrameNavigationEntry. (Closed)
Patch Set: Created 4 years, 2 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/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/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after
813 // with a subframe entry for our destination. 813 // with a subframe entry for our destination.
814 // TODO(creis): Ensure this case can't exist in https://crbug.com/524208. 814 // TODO(creis): Ensure this case can't exist in https://crbug.com/524208.
815 entry = NavigationEntryImpl::FromNavigationEntry( 815 entry = NavigationEntryImpl::FromNavigationEntry(
816 controller_->CreateNavigationEntry( 816 controller_->CreateNavigationEntry(
817 GURL(url::kAboutBlankURL), referrer_to_use, page_transition, 817 GURL(url::kAboutBlankURL), referrer_to_use, page_transition,
818 is_renderer_initiated, std::string(), 818 is_renderer_initiated, std::string(),
819 controller_->GetBrowserContext())); 819 controller_->GetBrowserContext()));
820 } 820 }
821 entry->AddOrUpdateFrameEntry( 821 entry->AddOrUpdateFrameEntry(
822 node, -1, -1, nullptr, 822 node, -1, -1, nullptr,
823 static_cast<SiteInstanceImpl*>(source_site_instance), dest_url, 823 static_cast<SiteInstanceImpl*>(source_site_instance),
824 referrer_to_use, PageState(), method, -1); 824 redirect_chain, dest_url, referrer_to_use, PageState(), method,
825 -1);
825 } else { 826 } else {
826 // Main frame case. 827 // Main frame case.
827 entry = NavigationEntryImpl::FromNavigationEntry( 828 entry = NavigationEntryImpl::FromNavigationEntry(
828 controller_->CreateNavigationEntry( 829 controller_->CreateNavigationEntry(
829 dest_url, referrer_to_use, page_transition, is_renderer_initiated, 830 dest_url, referrer_to_use, page_transition, is_renderer_initiated,
830 std::string(), controller_->GetBrowserContext())); 831 std::string(), controller_->GetBrowserContext()));
831 entry->root_node()->frame_entry->set_source_site_instance( 832 entry->root_node()->frame_entry->set_source_site_instance(
832 static_cast<SiteInstanceImpl*>(source_site_instance)); 833 static_cast<SiteInstanceImpl*>(source_site_instance));
834 entry->SetMainFrameRedirectChain(redirect_chain);
833 } 835 }
834 836
835 entry->SetRedirectChain(redirect_chain);
836 // Don't allow an entry replacement if there is no entry to replace. 837 // Don't allow an entry replacement if there is no entry to replace.
837 // http://crbug.com/457149 838 // http://crbug.com/457149
838 if (should_replace_current_entry && controller_->GetEntryCount() > 0) 839 if (should_replace_current_entry && controller_->GetEntryCount() > 0)
839 entry->set_should_replace_entry(true); 840 entry->set_should_replace_entry(true);
840 if (controller_->GetLastCommittedEntry() && 841 if (controller_->GetLastCommittedEntry() &&
841 controller_->GetLastCommittedEntry()->GetIsOverridingUserAgent()) { 842 controller_->GetLastCommittedEntry()->GetIsOverridingUserAgent()) {
842 entry->SetIsOverridingUserAgent(true); 843 entry->SetIsOverridingUserAgent(true);
843 } 844 }
844 entry->set_transferred_global_request_id(transferred_global_request_id); 845 entry->set_transferred_global_request_id(transferred_global_request_id);
845 // TODO(creis): Set user gesture and intent received timestamp on Android. 846 // TODO(creis): Set user gesture and intent received timestamp on Android.
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
1142 true /* is_renderer_initiated */, std::string(), 1143 true /* is_renderer_initiated */, std::string(),
1143 controller_->GetBrowserContext())); 1144 controller_->GetBrowserContext()));
1144 entry->set_site_instance(site_instance); 1145 entry->set_site_instance(site_instance);
1145 // TODO(creis): If there's a pending entry already, find a safe way to 1146 // TODO(creis): If there's a pending entry already, find a safe way to
1146 // update it instead of replacing it and copying over things like this. 1147 // update it instead of replacing it and copying over things like this.
1147 // That will allow us to skip the NavigationHandle update below as well. 1148 // That will allow us to skip the NavigationHandle update below as well.
1148 if (pending_entry) { 1149 if (pending_entry) {
1149 entry->set_transferred_global_request_id( 1150 entry->set_transferred_global_request_id(
1150 pending_entry->transferred_global_request_id()); 1151 pending_entry->transferred_global_request_id());
1151 entry->set_should_replace_entry(pending_entry->should_replace_entry()); 1152 entry->set_should_replace_entry(pending_entry->should_replace_entry());
1152 entry->SetRedirectChain(pending_entry->GetRedirectChain()); 1153 entry->SetMainFrameRedirectChain(
1154 pending_entry->GetMainFrameRedirectChain());
1153 } 1155 }
1154 1156
1155 // If there's a current NavigationHandle, update its pending NavEntry ID. 1157 // If there's a current NavigationHandle, update its pending NavEntry ID.
1156 // This is necessary for transfer navigations. The handle may be null in 1158 // This is necessary for transfer navigations. The handle may be null in
1157 // PlzNavigate. 1159 // PlzNavigate.
1158 if (navigation_handle) 1160 if (navigation_handle)
1159 navigation_handle->update_entry_id_for_transfer(entry->GetUniqueID()); 1161 navigation_handle->update_entry_id_for_transfer(entry->GetUniqueID());
1160 1162
1161 controller_->SetPendingEntry(std::move(entry)); 1163 controller_->SetPendingEntry(std::move(entry));
1162 if (delegate_) 1164 if (delegate_)
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1199 if (pending_entry != controller_->GetVisibleEntry() || 1201 if (pending_entry != controller_->GetVisibleEntry() ||
1200 !should_preserve_entry) { 1202 !should_preserve_entry) {
1201 controller_->DiscardPendingEntry(true); 1203 controller_->DiscardPendingEntry(true);
1202 1204
1203 // Also force the UI to refresh. 1205 // Also force the UI to refresh.
1204 controller_->delegate()->NotifyNavigationStateChanged(INVALIDATE_TYPE_URL); 1206 controller_->delegate()->NotifyNavigationStateChanged(INVALIDATE_TYPE_URL);
1205 } 1207 }
1206 } 1208 }
1207 1209
1208 } // namespace content 1210 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698