OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/public/renderer/history_item_serialization.h" | 5 #include "content/public/renderer/history_item_serialization.h" |
6 | 6 |
7 #include "content/common/page_state_serialization.h" | 7 #include "content/common/page_state_serialization.h" |
8 #include "content/public/common/page_state.h" | 8 #include "content/public/common/page_state.h" |
9 #include "third_party/WebKit/public/platform/WebHTTPBody.h" | 9 #include "third_party/WebKit/public/platform/WebHTTPBody.h" |
10 #include "third_party/WebKit/public/platform/WebPoint.h" | 10 #include "third_party/WebKit/public/platform/WebPoint.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 state->url_string = item.urlString(); | 84 state->url_string = item.urlString(); |
85 state->original_url_string = item.originalURLString(); | 85 state->original_url_string = item.originalURLString(); |
86 state->referrer = item.referrer(); | 86 state->referrer = item.referrer(); |
87 state->target = item.target(); | 87 state->target = item.target(); |
88 if (!item.stateObject().isNull()) | 88 if (!item.stateObject().isNull()) |
89 state->state_object = item.stateObject().toString(); | 89 state->state_object = item.stateObject().toString(); |
90 state->scroll_offset = item.scrollOffset(); | 90 state->scroll_offset = item.scrollOffset(); |
91 state->item_sequence_number = item.itemSequenceNumber(); | 91 state->item_sequence_number = item.itemSequenceNumber(); |
92 state->document_sequence_number = | 92 state->document_sequence_number = |
93 item.documentSequenceNumber(); | 93 item.documentSequenceNumber(); |
| 94 state->target_frame_id = item.targetFrameID(); |
94 state->page_scale_factor = item.pageScaleFactor(); | 95 state->page_scale_factor = item.pageScaleFactor(); |
95 ToNullableString16Vector(item.documentState(), &state->document_state); | 96 ToNullableString16Vector(item.documentState(), &state->document_state); |
96 | 97 |
97 state->http_body.http_content_type = item.httpContentType(); | 98 state->http_body.http_content_type = item.httpContentType(); |
98 const WebHTTPBody& http_body = item.httpBody(); | 99 const WebHTTPBody& http_body = item.httpBody(); |
99 if (!(state->http_body.is_null = http_body.isNull())) { | 100 if (!(state->http_body.is_null = http_body.isNull())) { |
100 state->http_body.identifier = http_body.identifier(); | 101 state->http_body.identifier = http_body.identifier(); |
101 state->http_body.elements.resize(http_body.elementCount()); | 102 state->http_body.elements.resize(http_body.elementCount()); |
102 for (size_t i = 0; i < http_body.elementCount(); ++i) { | 103 for (size_t i = 0; i < http_body.elementCount(); ++i) { |
103 WebHTTPBody::Element element; | 104 WebHTTPBody::Element element; |
(...skipping 28 matching lines...) Expand all Loading... |
132 item->setPageScaleFactor(state.page_scale_factor); | 133 item->setPageScaleFactor(state.page_scale_factor); |
133 | 134 |
134 // These values are generated at WebHistoryItem construction time, and we | 135 // These values are generated at WebHistoryItem construction time, and we |
135 // only want to override those new values with old values if the old values | 136 // only want to override those new values with old values if the old values |
136 // are defined. A value of 0 means undefined in this context. | 137 // are defined. A value of 0 means undefined in this context. |
137 if (state.item_sequence_number) | 138 if (state.item_sequence_number) |
138 item->setItemSequenceNumber(state.item_sequence_number); | 139 item->setItemSequenceNumber(state.item_sequence_number); |
139 if (state.document_sequence_number) | 140 if (state.document_sequence_number) |
140 item->setDocumentSequenceNumber(state.document_sequence_number); | 141 item->setDocumentSequenceNumber(state.document_sequence_number); |
141 | 142 |
| 143 item->setTargetFrameID(state.target_frame_id); |
| 144 |
142 item->setHTTPContentType(state.http_body.http_content_type); | 145 item->setHTTPContentType(state.http_body.http_content_type); |
143 if (!state.http_body.is_null) { | 146 if (!state.http_body.is_null) { |
144 WebHTTPBody http_body; | 147 WebHTTPBody http_body; |
145 http_body.initialize(); | 148 http_body.initialize(); |
146 http_body.setIdentifier(state.http_body.identifier); | 149 http_body.setIdentifier(state.http_body.identifier); |
147 for (size_t i = 0; i < state.http_body.elements.size(); ++i) | 150 for (size_t i = 0; i < state.http_body.elements.size(); ++i) |
148 AppendHTTPBodyElement(state.http_body.elements[i], &http_body); | 151 AppendHTTPBodyElement(state.http_body.elements[i], &http_body); |
149 item->setHTTPBody(http_body); | 152 item->setHTTPBody(http_body); |
150 } | 153 } |
151 | 154 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 | 187 |
185 WebHistoryItem item; | 188 WebHistoryItem item; |
186 item.initialize(); | 189 item.initialize(); |
187 if (!RecursivelyGenerateHistoryItem(state.top, &item)) | 190 if (!RecursivelyGenerateHistoryItem(state.top, &item)) |
188 return WebHistoryItem(); | 191 return WebHistoryItem(); |
189 | 192 |
190 return item; | 193 return item; |
191 } | 194 } |
192 | 195 |
193 } // namespace content | 196 } // namespace content |
OLD | NEW |