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

Unified Diff: content/browser/frame_host/navigation_controller_impl.cc

Issue 1907443006: PlzNavigate: store POST data in the FrameNavigationEntry (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 side-by-side diff with in-line comments
Download patch
Index: content/browser/frame_host/navigation_controller_impl.cc
diff --git a/content/browser/frame_host/navigation_controller_impl.cc b/content/browser/frame_host/navigation_controller_impl.cc
index 9b3fd5e5e71d07b53a7e392405c6d1a49d36b913..a687f7f295057aba5ff8656ed3f92e9bf0a47943 100644
--- a/content/browser/frame_host/navigation_controller_impl.cc
+++ b/content/browser/frame_host/navigation_controller_impl.cc
@@ -737,7 +737,8 @@ void NavigationControllerImpl::LoadURLWithParams(const LoadURLParams& params) {
entry = GetLastCommittedEntry()->Clone();
entry->SetPageID(-1);
entry->AddOrUpdateFrameEntry(node, "", -1, -1, nullptr, params.url,
- params.referrer, PageState(), "GET", -1);
+ params.referrer, PageState(), "GET", -1,
+ nullptr);
}
}
}
@@ -805,7 +806,8 @@ bool NavigationControllerImpl::PendingEntryMatchesHandle(
bool NavigationControllerImpl::RendererDidNavigate(
RenderFrameHostImpl* rfh,
const FrameHostMsg_DidCommitProvisionalLoad_Params& params,
- LoadCommittedDetails* details) {
+ LoadCommittedDetails* details,
+ scoped_refptr<ResourceRequestBody> post_data) {
is_initial_navigation_ = false;
// Save the previous state before we clobber it.
@@ -838,20 +840,22 @@ bool NavigationControllerImpl::RendererDidNavigate(
switch (details->type) {
case NAVIGATION_TYPE_NEW_PAGE:
- RendererDidNavigateToNewPage(rfh, params, details->did_replace_entry);
+ RendererDidNavigateToNewPage(rfh, params, details->did_replace_entry,
+ post_data);
break;
case NAVIGATION_TYPE_EXISTING_PAGE:
details->did_replace_entry = details->is_in_page;
- RendererDidNavigateToExistingPage(rfh, params);
+ RendererDidNavigateToExistingPage(rfh, params, post_data);
break;
case NAVIGATION_TYPE_SAME_PAGE:
- RendererDidNavigateToSamePage(rfh, params);
+ RendererDidNavigateToSamePage(rfh, params, post_data);
break;
case NAVIGATION_TYPE_NEW_SUBFRAME:
- RendererDidNavigateNewSubframe(rfh, params, details->did_replace_entry);
+ RendererDidNavigateNewSubframe(rfh, params, details->did_replace_entry,
+ post_data);
break;
case NAVIGATION_TYPE_AUTO_SUBFRAME:
- if (!RendererDidNavigateAutoSubframe(rfh, params))
+ if (!RendererDidNavigateAutoSubframe(rfh, params, post_data))
return false;
break;
case NAVIGATION_TYPE_NAV_IGNORE:
@@ -1067,7 +1071,8 @@ NavigationType NavigationControllerImpl::ClassifyNavigation(
void NavigationControllerImpl::RendererDidNavigateToNewPage(
RenderFrameHostImpl* rfh,
const FrameHostMsg_DidCommitProvisionalLoad_Params& params,
- bool replace_entry) {
+ bool replace_entry,
+ scoped_refptr<ResourceRequestBody> post_data) {
std::unique_ptr<NavigationEntryImpl> new_entry;
bool update_virtual_url;
// Only make a copy of the pending entry if it is appropriate for the new page
@@ -1131,6 +1136,7 @@ void NavigationControllerImpl::RendererDidNavigateToNewPage(
frame_entry->set_document_sequence_number(params.document_sequence_number);
frame_entry->set_method(params.method);
frame_entry->set_post_id(params.post_id);
+ frame_entry->set_post_data(post_data);
// history.pushState() is classified as a navigation to a new page, but
// sets was_within_same_page to true. In this case, we already have the
@@ -1155,7 +1161,8 @@ void NavigationControllerImpl::RendererDidNavigateToNewPage(
void NavigationControllerImpl::RendererDidNavigateToExistingPage(
RenderFrameHostImpl* rfh,
- const FrameHostMsg_DidCommitProvisionalLoad_Params& params) {
+ const FrameHostMsg_DidCommitProvisionalLoad_Params& params,
+ scoped_refptr<ResourceRequestBody> post_data) {
// We should only get here for main frame navigations.
DCHECK(!rfh->GetParent());
@@ -1189,6 +1196,7 @@ void NavigationControllerImpl::RendererDidNavigateToExistingPage(
entry->GetFrameEntry(rfh->frame_tree_node());
frame_entry->set_method(params.method);
frame_entry->set_post_id(params.post_id);
+ frame_entry->set_post_data(post_data);
// The redirected to page should not inherit the favicon from the previous
// page.
@@ -1220,7 +1228,8 @@ void NavigationControllerImpl::RendererDidNavigateToExistingPage(
void NavigationControllerImpl::RendererDidNavigateToSamePage(
RenderFrameHostImpl* rfh,
- const FrameHostMsg_DidCommitProvisionalLoad_Params& params) {
+ const FrameHostMsg_DidCommitProvisionalLoad_Params& params,
+ scoped_refptr<ResourceRequestBody> post_data) {
// This classification says that we have a pending entry that's the same as
// the last committed entry. This entry is guaranteed to exist by
// ClassifyNavigation. All we need to do is update the existing entry.
@@ -1248,6 +1257,7 @@ void NavigationControllerImpl::RendererDidNavigateToSamePage(
existing_entry->GetFrameEntry(rfh->frame_tree_node());
frame_entry->set_method(params.method);
frame_entry->set_post_id(params.post_id);
+ frame_entry->set_post_data(post_data);
DiscardNonCommittedEntries();
}
@@ -1255,7 +1265,8 @@ void NavigationControllerImpl::RendererDidNavigateToSamePage(
void NavigationControllerImpl::RendererDidNavigateNewSubframe(
RenderFrameHostImpl* rfh,
const FrameHostMsg_DidCommitProvisionalLoad_Params& params,
- bool replace_entry) {
+ bool replace_entry,
+ scoped_refptr<ResourceRequestBody> post_data) {
DCHECK(ui::PageTransitionCoreTypeIs(params.transition,
ui::PAGE_TRANSITION_MANUAL_SUBFRAME));
@@ -1273,7 +1284,7 @@ void NavigationControllerImpl::RendererDidNavigateNewSubframe(
rfh->frame_tree_node()->frame_tree_node_id(), params.frame_unique_name,
params.item_sequence_number, params.document_sequence_number,
rfh->GetSiteInstance(), params.url, params.referrer, params.method,
- params.post_id);
+ params.post_id, post_data);
new_entry = GetLastCommittedEntry()->CloneAndReplace(rfh->frame_tree_node(),
frame_entry);
@@ -1291,7 +1302,8 @@ void NavigationControllerImpl::RendererDidNavigateNewSubframe(
bool NavigationControllerImpl::RendererDidNavigateAutoSubframe(
RenderFrameHostImpl* rfh,
- const FrameHostMsg_DidCommitProvisionalLoad_Params& params) {
+ const FrameHostMsg_DidCommitProvisionalLoad_Params& params,
+ scoped_refptr<ResourceRequestBody> post_data) {
DCHECK(ui::PageTransitionCoreTypeIs(params.transition,
ui::PAGE_TRANSITION_AUTO_SUBFRAME));
@@ -1335,7 +1347,7 @@ bool NavigationControllerImpl::RendererDidNavigateAutoSubframe(
rfh->frame_tree_node(), params.frame_unique_name,
params.item_sequence_number, params.document_sequence_number,
rfh->GetSiteInstance(), params.url, params.referrer, params.page_state,
- params.method, params.post_id);
+ params.method, params.post_id, post_data);
// Cross-process subframe navigations may leave a pending entry around.
// Clear it if it's actually for the subframe.

Powered by Google App Engine
This is Rietveld 408576698