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

Unified Diff: content/browser/frame_host/navigation_entry_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_entry_impl.cc
diff --git a/content/browser/frame_host/navigation_entry_impl.cc b/content/browser/frame_host/navigation_entry_impl.cc
index 87405be98d69e2db96a66b58d0b3d79602077b4c..1cb426ce36e2c83328af9bb070bc9806d3a52622 100644
--- a/content/browser/frame_host/navigation_entry_impl.cc
+++ b/content/browser/frame_host/navigation_entry_impl.cc
@@ -19,6 +19,7 @@
#include "content/common/navigation_params.h"
#include "content/common/page_state_serialization.h"
#include "content/common/site_isolation_policy.h"
+#include "content/public/common/browser_side_navigation_policy.h"
#include "content/public/common/content_constants.h"
#include "content/public/common/url_constants.h"
#include "ui/gfx/text_elider.h"
@@ -38,11 +39,14 @@ int GetUniqueIDInConstructor() {
void RecursivelyGenerateFrameEntries(const ExplodedFrameState& state,
NavigationEntryImpl::TreeNode* node) {
+ scoped_refptr<ResourceRequestBody> post_data = new ResourceRequestBody;
+ if (!GeneratePostData(state.http_body, post_data.get()))
+ post_data = nullptr;
node->frame_entry = new FrameNavigationEntry(
-1, UTF16ToUTF8(state.target.string()), state.item_sequence_number,
state.document_sequence_number, nullptr, GURL(state.url_string.string()),
- Referrer(GURL(state.referrer.string()), state.referrer_policy), "GET",
- -1);
+ Referrer(GURL(state.referrer.string()), state.referrer_policy), "GET", -1,
+ post_data);
// Set a single-frame PageState on the entry.
ExplodedPageState page_state;
@@ -175,7 +179,8 @@ NavigationEntryImpl::NavigationEntryImpl(
url,
referrer,
"GET",
- -1))),
+ -1,
+ nullptr))),
unique_id_(GetUniqueIDInConstructor()),
bindings_(kInvalidBindings),
page_type_(PAGE_TYPE_NORMAL),
@@ -573,6 +578,7 @@ std::unique_ptr<NavigationEntryImpl> NavigationEntryImpl::CloneAndReplace(
}
CommonNavigationParams NavigationEntryImpl::ConstructCommonNavigationParams(
+ const FrameNavigationEntry& frame_entry,
const GURL& dest_url,
const Referrer& dest_referrer,
FrameMsg_Navigate_Type::Value navigation_type,
@@ -587,11 +593,18 @@ CommonNavigationParams NavigationEntryImpl::ConstructCommonNavigationParams(
ui_timestamp = intent_received_timestamp();
#endif
+ std::string method;
+
+ if (IsBrowserSideNavigationEnabled())
+ method = frame_entry.method();
+ else
+ method = GetHasPostData() ? "POST" : "GET";
+
return CommonNavigationParams(
dest_url, dest_referrer, GetTransitionType(), navigation_type,
!IsViewSourceMode(), should_replace_entry(), ui_timestamp, report_type,
GetBaseURLForDataURL(), GetHistoryURLForDataURL(), lofi_state,
- navigation_start, GetHasPostData() ? "POST" : "GET");
+ navigation_start, method);
}
StartNavigationParams NavigationEntryImpl::ConstructStartNavigationParams()
@@ -694,7 +707,8 @@ void NavigationEntryImpl::AddOrUpdateFrameEntry(
const Referrer& referrer,
const PageState& page_state,
const std::string& method,
- int64_t post_id) {
+ int64_t post_id,
+ scoped_refptr<ResourceRequestBody> post_data) {
// We should already have a TreeNode for the parent node by the time this node
// commits. Find it first.
DCHECK(frame_tree_node->parent());
@@ -713,7 +727,7 @@ void NavigationEntryImpl::AddOrUpdateFrameEntry(
// Update the existing FrameNavigationEntry (e.g., for replaceState).
child->frame_entry->UpdateEntry(
frame_unique_name, item_sequence_number, document_sequence_number,
- site_instance, url, referrer, page_state, method, post_id);
+ site_instance, url, referrer, page_state, method, post_id, post_data);
return;
}
}
@@ -723,7 +737,8 @@ void NavigationEntryImpl::AddOrUpdateFrameEntry(
// or unique name.
FrameNavigationEntry* frame_entry = new FrameNavigationEntry(
frame_tree_node_id, frame_unique_name, item_sequence_number,
- document_sequence_number, site_instance, url, referrer, method, post_id);
+ document_sequence_number, site_instance, url, referrer, method, post_id,
+ post_data);
frame_entry->set_page_state(page_state);
parent_node->children.push_back(
new NavigationEntryImpl::TreeNode(frame_entry));

Powered by Google App Engine
This is Rietveld 408576698