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

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

Issue 2038233002: Using ResourceRequestBody as the type of HTTP body outside of //content. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@make-resource-request-body-public
Patch Set: Rebasing... Created 4 years, 6 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 d2eca0f4ffb15cd2664d62ec91e5c4ecc34f4bcb..d6e07afff5547badabbd5234140a9d6637dfd221 100644
--- a/content/browser/frame_host/navigation_entry_impl.cc
+++ b/content/browser/frame_host/navigation_entry_impl.cc
@@ -419,14 +419,13 @@ int64_t NavigationEntryImpl::GetPostID() const {
return frame_tree_->frame_entry->post_id();
}
-void NavigationEntryImpl::SetBrowserInitiatedPostData(
- const base::RefCountedMemory* data) {
- browser_initiated_post_data_ = data;
+void NavigationEntryImpl::SetPostData(
+ const scoped_refptr<ResourceRequestBody>& data) {
+ post_data_ = static_cast<ResourceRequestBodyImpl*>(data.get());
}
-const base::RefCountedMemory*
-NavigationEntryImpl::GetBrowserInitiatedPostData() const {
- return browser_initiated_post_data_.get();
+scoped_refptr<ResourceRequestBody> NavigationEntryImpl::GetPostData() const {
+ return post_data_.get();
}
@@ -550,7 +549,7 @@ std::unique_ptr<NavigationEntryImpl> NavigationEntryImpl::CloneAndReplace(
copy->is_overriding_user_agent_ = is_overriding_user_agent_;
copy->timestamp_ = timestamp_;
copy->http_status_code_ = http_status_code_;
- // ResetForCommit: browser_initiated_post_data_
+ // ResetForCommit: post_data_
copy->screenshot_ = screenshot_;
copy->extra_headers_ = extra_headers_;
copy->base_url_for_data_url_ = base_url_for_data_url_;
@@ -570,19 +569,6 @@ std::unique_ptr<NavigationEntryImpl> NavigationEntryImpl::CloneAndReplace(
return copy;
}
-scoped_refptr<ResourceRequestBodyImpl>
-NavigationEntryImpl::ConstructBodyFromBrowserInitiatedPostData() const {
- scoped_refptr<ResourceRequestBodyImpl> browser_initiated_post_body;
- if (GetHasPostData()) {
- if (const base::RefCountedMemory* memory = GetBrowserInitiatedPostData()) {
- browser_initiated_post_body = new ResourceRequestBodyImpl();
- browser_initiated_post_body->AppendBytes(memory->front_as<char>(),
- memory->size());
- }
- }
- return browser_initiated_post_body;
-}
-
CommonNavigationParams NavigationEntryImpl::ConstructCommonNavigationParams(
const FrameNavigationEntry& frame_entry,
const scoped_refptr<ResourceRequestBodyImpl>& post_body,
@@ -613,8 +599,7 @@ CommonNavigationParams NavigationEntryImpl::ConstructCommonNavigationParams(
dest_url, dest_referrer, GetTransitionType(), navigation_type,
!IsViewSourceMode(), should_replace_entry(), ui_timestamp, report_type,
GetBaseURLForDataURL(), GetHistoryURLForDataURL(), lofi_state,
- navigation_start, method,
- post_body ? post_body : ConstructBodyFromBrowserInitiatedPostData());
+ navigation_start, method, post_body ? post_body : post_data_);
}
StartNavigationParams NavigationEntryImpl::ConstructStartNavigationParams()
@@ -683,7 +668,7 @@ void NavigationEntryImpl::ResetForCommit(FrameNavigationEntry* frame_entry) {
// cleared here.
// TODO(creis): This state should be moved to NavigationRequest once
// PlzNavigate is enabled.
- SetBrowserInitiatedPostData(nullptr);
+ SetPostData(nullptr);
set_is_renderer_initiated(false);
set_transferred_global_request_id(GlobalRequestID());
set_should_replace_entry(false);

Powered by Google App Engine
This is Rietveld 408576698