| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/renderer/history_serialization.h" | 5 #include "content/renderer/history_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 "content/renderer/history_entry.h" | 9 #include "content/renderer/history_entry.h" |
| 10 #include "third_party/WebKit/public/platform/WebFloatPoint.h" | 10 #include "third_party/WebKit/public/platform/WebFloatPoint.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 state->referrer_policy = item.referrerPolicy(); | 88 state->referrer_policy = item.referrerPolicy(); |
| 89 state->target = item.target(); | 89 state->target = item.target(); |
| 90 if (!item.stateObject().isNull()) | 90 if (!item.stateObject().isNull()) |
| 91 state->state_object = item.stateObject().toString(); | 91 state->state_object = item.stateObject().toString(); |
| 92 state->scroll_restoration_type = item.scrollRestorationType(); | 92 state->scroll_restoration_type = item.scrollRestorationType(); |
| 93 state->pinch_viewport_scroll_offset = item.pinchViewportScrollOffset(); | 93 state->pinch_viewport_scroll_offset = item.pinchViewportScrollOffset(); |
| 94 state->scroll_offset = item.scrollOffset(); | 94 state->scroll_offset = item.scrollOffset(); |
| 95 state->item_sequence_number = item.itemSequenceNumber(); | 95 state->item_sequence_number = item.itemSequenceNumber(); |
| 96 state->document_sequence_number = | 96 state->document_sequence_number = |
| 97 item.documentSequenceNumber(); | 97 item.documentSequenceNumber(); |
| 98 state->frame_sequence_number = | |
| 99 item.frameSequenceNumber(); | |
| 100 state->page_scale_factor = item.pageScaleFactor(); | 98 state->page_scale_factor = item.pageScaleFactor(); |
| 101 ToNullableString16Vector(item.documentState(), &state->document_state); | 99 ToNullableString16Vector(item.documentState(), &state->document_state); |
| 102 | 100 |
| 103 state->http_body.http_content_type = item.httpContentType(); | 101 state->http_body.http_content_type = item.httpContentType(); |
| 104 const WebHTTPBody& http_body = item.httpBody(); | 102 const WebHTTPBody& http_body = item.httpBody(); |
| 105 state->http_body.is_null = http_body.isNull(); | 103 state->http_body.is_null = http_body.isNull(); |
| 106 if (!state->http_body.is_null) { | 104 if (!state->http_body.is_null) { |
| 107 state->http_body.identifier = http_body.identifier(); | 105 state->http_body.identifier = http_body.identifier(); |
| 108 state->http_body.elements.resize(http_body.elementCount()); | 106 state->http_body.elements.resize(http_body.elementCount()); |
| 109 for (size_t i = 0; i < http_body.elementCount(); ++i) { | 107 for (size_t i = 0; i < http_body.elementCount(); ++i) { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 item.setScrollOffset(state.scroll_offset); | 146 item.setScrollOffset(state.scroll_offset); |
| 149 item.setPageScaleFactor(state.page_scale_factor); | 147 item.setPageScaleFactor(state.page_scale_factor); |
| 150 | 148 |
| 151 // These values are generated at WebHistoryItem construction time, and we | 149 // These values are generated at WebHistoryItem construction time, and we |
| 152 // only want to override those new values with old values if the old values | 150 // only want to override those new values with old values if the old values |
| 153 // are defined. A value of 0 means undefined in this context. | 151 // are defined. A value of 0 means undefined in this context. |
| 154 if (state.item_sequence_number) | 152 if (state.item_sequence_number) |
| 155 item.setItemSequenceNumber(state.item_sequence_number); | 153 item.setItemSequenceNumber(state.item_sequence_number); |
| 156 if (state.document_sequence_number) | 154 if (state.document_sequence_number) |
| 157 item.setDocumentSequenceNumber(state.document_sequence_number); | 155 item.setDocumentSequenceNumber(state.document_sequence_number); |
| 158 if (state.frame_sequence_number) | |
| 159 item.setFrameSequenceNumber(state.frame_sequence_number); | |
| 160 | 156 |
| 161 item.setHTTPContentType(state.http_body.http_content_type); | 157 item.setHTTPContentType(state.http_body.http_content_type); |
| 162 if (!state.http_body.is_null) { | 158 if (!state.http_body.is_null) { |
| 163 WebHTTPBody http_body; | 159 WebHTTPBody http_body; |
| 164 http_body.initialize(); | 160 http_body.initialize(); |
| 165 http_body.setIdentifier(state.http_body.identifier); | 161 http_body.setIdentifier(state.http_body.identifier); |
| 166 for (size_t i = 0; i < state.http_body.elements.size(); ++i) | 162 for (size_t i = 0; i < state.http_body.elements.size(); ++i) |
| 167 AppendHTTPBodyElement(state.http_body.elements[i], &http_body); | 163 AppendHTTPBodyElement(state.http_body.elements[i], &http_body); |
| 168 item.setHTTPBody(http_body); | 164 item.setHTTPBody(http_body); |
| 169 } | 165 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 if (!DecodePageState(page_state.ToEncodedData(), &state)) | 201 if (!DecodePageState(page_state.ToEncodedData(), &state)) |
| 206 return scoped_ptr<HistoryEntry>(); | 202 return scoped_ptr<HistoryEntry>(); |
| 207 | 203 |
| 208 scoped_ptr<HistoryEntry> entry(new HistoryEntry()); | 204 scoped_ptr<HistoryEntry> entry(new HistoryEntry()); |
| 209 RecursivelyGenerateHistoryItem(state.top, entry->root_history_node()); | 205 RecursivelyGenerateHistoryItem(state.top, entry->root_history_node()); |
| 210 | 206 |
| 211 return entry.Pass(); | 207 return entry.Pass(); |
| 212 } | 208 } |
| 213 | 209 |
| 214 } // namespace content | 210 } // namespace content |
| OLD | NEW |