Index: content/browser/frame_host/frame_navigation_entry.cc |
diff --git a/content/browser/frame_host/frame_navigation_entry.cc b/content/browser/frame_host/frame_navigation_entry.cc |
index 90293581b502af741c82d0e2aa98f27621b7caf9..fa993e5bb05df944b9d53da20aaac9ace03a48c5 100644 |
--- a/content/browser/frame_host/frame_navigation_entry.cc |
+++ b/content/browser/frame_host/frame_navigation_entry.cc |
@@ -6,8 +6,32 @@ |
#include <utility> |
+#include "base/strings/utf_string_conversions.h" |
+#include "content/common/page_state_serialization.h" |
+ |
namespace content { |
+namespace { |
+ |
+bool RecursivelyFillBody(const ExplodedFrameState& state, |
+ const std::string& frame_name, |
+ ResourceRequestBody* body) { |
+ if (base::UTF16ToUTF8(state.target.string()) == frame_name) { |
+ if (!GeneratePostData(state.http_body, body)) |
+ return false; |
+ return true; |
+ } |
+ |
+ for (const ExplodedFrameState& child_state : state.children) { |
+ if (RecursivelyFillBody(child_state, frame_name, body)) |
+ return true; |
+ } |
+ |
+ return false; |
+} |
+ |
+} // namespace |
+ |
FrameNavigationEntry::FrameNavigationEntry() |
: item_sequence_number_(-1), document_sequence_number_(-1), post_id_(-1) {} |
@@ -73,4 +97,21 @@ void FrameNavigationEntry::set_document_sequence_number( |
document_sequence_number_ = document_sequence_number; |
} |
+scoped_refptr<ResourceRequestBody> FrameNavigationEntry::GetPostData() const { |
+ scoped_refptr<ResourceRequestBody> body; |
+ if (method_ != "POST") |
+ return body; |
+ |
+ // Generate the body from the PageState. |
+ ExplodedPageState exploded_state; |
+ if (!DecodePageState(page_state_.ToEncodedData(), &exploded_state)) |
+ return body; |
+ |
+ body = new ResourceRequestBody(); |
+ if (!RecursivelyFillBody(exploded_state.top, frame_unique_name_, body.get())) |
Charlie Reis
2016/05/11 00:00:23
Why is this recursive? The PageState on a FrameNa
clamy
2016/05/11 08:54:41
Ah I didn't know there was only one frame in the P
|
+ return nullptr; |
+ |
+ return body; |
+} |
+ |
} // namespace content |