Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/frame_navigation_entry.h" | 5 #include "content/browser/frame_host/frame_navigation_entry.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "content/common/page_state_serialization.h" | |
| 10 #include "content/common/site_isolation_policy.h" | |
| 11 | |
| 9 namespace content { | 12 namespace content { |
| 10 | 13 |
| 11 FrameNavigationEntry::FrameNavigationEntry() | 14 FrameNavigationEntry::FrameNavigationEntry() |
| 12 : item_sequence_number_(-1), document_sequence_number_(-1), post_id_(-1) {} | 15 : item_sequence_number_(-1), document_sequence_number_(-1), post_id_(-1) {} |
| 13 | 16 |
| 14 FrameNavigationEntry::FrameNavigationEntry( | 17 FrameNavigationEntry::FrameNavigationEntry( |
| 15 const std::string& frame_unique_name, | 18 const std::string& frame_unique_name, |
| 16 int64_t item_sequence_number, | 19 int64_t item_sequence_number, |
| 17 int64_t document_sequence_number, | 20 int64_t document_sequence_number, |
| 18 scoped_refptr<SiteInstanceImpl> site_instance, | 21 scoped_refptr<SiteInstanceImpl> site_instance, |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 73 // location.replace is classified as NEW_PAGE rather than EXISTING_PAGE. | 76 // location.replace is classified as NEW_PAGE rather than EXISTING_PAGE. |
| 74 // Same for document sequence number. See https://crbug.com/596707. | 77 // Same for document sequence number. See https://crbug.com/596707. |
| 75 item_sequence_number_ = item_sequence_number; | 78 item_sequence_number_ = item_sequence_number; |
| 76 } | 79 } |
| 77 | 80 |
| 78 void FrameNavigationEntry::set_document_sequence_number( | 81 void FrameNavigationEntry::set_document_sequence_number( |
| 79 int64_t document_sequence_number) { | 82 int64_t document_sequence_number) { |
| 80 document_sequence_number_ = document_sequence_number; | 83 document_sequence_number_ = document_sequence_number; |
| 81 } | 84 } |
| 82 | 85 |
| 86 scoped_refptr<ResourceRequestBody> FrameNavigationEntry::GetPostData() const { | |
| 87 DCHECK(SiteIsolationPolicy::UseSubframeNavigationEntries()); | |
| 88 scoped_refptr<ResourceRequestBody> body; | |
| 89 if (method_ != "POST") | |
| 90 return body; | |
|
carlosk
2016/05/20 08:59:47
nit: it seems clearer to return nullptr here and b
clamy
2016/05/20 11:00:12
Done.
| |
| 91 | |
| 92 // Generate the body from the PageState. | |
| 93 ExplodedPageState exploded_state; | |
| 94 if (!DecodePageState(page_state_.ToEncodedData(), &exploded_state)) | |
| 95 return body; | |
| 96 | |
| 97 body = new ResourceRequestBody(); | |
| 98 if (!GeneratePostData(exploded_state.top.http_body, body.get())) | |
| 99 return nullptr; | |
| 100 | |
| 101 return body; | |
| 102 } | |
| 103 | |
| 83 } // namespace content | 104 } // namespace content |
| OLD | NEW |