| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/strings/nullable_string16.h" | 9 #include "base/strings/nullable_string16.h" |
| 10 #include "content/child/web_url_request_util.h" | 10 #include "content/child/web_url_request_util.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 state->state_object = | 47 state->state_object = |
| 48 WebString::toNullableString16(item.stateObject().toString()); | 48 WebString::toNullableString16(item.stateObject().toString()); |
| 49 } | 49 } |
| 50 state->scroll_restoration_type = item.scrollRestorationType(); | 50 state->scroll_restoration_type = item.scrollRestorationType(); |
| 51 state->visual_viewport_scroll_offset = item.visualViewportScrollOffset(); | 51 state->visual_viewport_scroll_offset = item.visualViewportScrollOffset(); |
| 52 state->scroll_offset = item.getScrollOffset(); | 52 state->scroll_offset = item.getScrollOffset(); |
| 53 state->item_sequence_number = item.itemSequenceNumber(); | 53 state->item_sequence_number = item.itemSequenceNumber(); |
| 54 state->document_sequence_number = | 54 state->document_sequence_number = |
| 55 item.documentSequenceNumber(); | 55 item.documentSequenceNumber(); |
| 56 state->page_scale_factor = item.pageScaleFactor(); | 56 state->page_scale_factor = item.pageScaleFactor(); |
| 57 state->did_save_scroll_or_scale_state = item.didSaveScrollOrScaleState(); |
| 57 ToNullableString16Vector(item.getDocumentState(), &state->document_state); | 58 ToNullableString16Vector(item.getDocumentState(), &state->document_state); |
| 58 | 59 |
| 59 state->http_body.http_content_type = | 60 state->http_body.http_content_type = |
| 60 WebString::toNullableString16(item.httpContentType()); | 61 WebString::toNullableString16(item.httpContentType()); |
| 61 const WebHTTPBody& http_body = item.httpBody(); | 62 const WebHTTPBody& http_body = item.httpBody(); |
| 62 if (!http_body.isNull()) { | 63 if (!http_body.isNull()) { |
| 63 state->http_body.request_body = GetRequestBodyForWebHTTPBody(http_body); | 64 state->http_body.request_body = GetRequestBodyForWebHTTPBody(http_body); |
| 64 state->http_body.contains_passwords = http_body.containsPasswordData(); | 65 state->http_body.contains_passwords = http_body.containsPasswordData(); |
| 65 } | 66 } |
| 66 } | 67 } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 95 WebVector<WebString> document_state(state.document_state.size()); | 96 WebVector<WebString> document_state(state.document_state.size()); |
| 96 std::transform(state.document_state.begin(), state.document_state.end(), | 97 std::transform(state.document_state.begin(), state.document_state.end(), |
| 97 document_state.begin(), [](const base::NullableString16& s) { | 98 document_state.begin(), [](const base::NullableString16& s) { |
| 98 return WebString::fromUTF16(s); | 99 return WebString::fromUTF16(s); |
| 99 }); | 100 }); |
| 100 item.setDocumentState(document_state); | 101 item.setDocumentState(document_state); |
| 101 item.setScrollRestorationType(state.scroll_restoration_type); | 102 item.setScrollRestorationType(state.scroll_restoration_type); |
| 102 item.setVisualViewportScrollOffset(state.visual_viewport_scroll_offset); | 103 item.setVisualViewportScrollOffset(state.visual_viewport_scroll_offset); |
| 103 item.setScrollOffset(state.scroll_offset); | 104 item.setScrollOffset(state.scroll_offset); |
| 104 item.setPageScaleFactor(state.page_scale_factor); | 105 item.setPageScaleFactor(state.page_scale_factor); |
| 106 item.setDidSaveScrollOrScaleState(state.did_save_scroll_or_scale_state); |
| 105 | 107 |
| 106 // These values are generated at WebHistoryItem construction time, and we | 108 // These values are generated at WebHistoryItem construction time, and we |
| 107 // only want to override those new values with old values if the old values | 109 // only want to override those new values with old values if the old values |
| 108 // are defined. A value of 0 means undefined in this context. | 110 // are defined. A value of 0 means undefined in this context. |
| 109 if (state.item_sequence_number) | 111 if (state.item_sequence_number) |
| 110 item.setItemSequenceNumber(state.item_sequence_number); | 112 item.setItemSequenceNumber(state.item_sequence_number); |
| 111 if (state.document_sequence_number) | 113 if (state.document_sequence_number) |
| 112 item.setDocumentSequenceNumber(state.document_sequence_number); | 114 item.setDocumentSequenceNumber(state.document_sequence_number); |
| 113 | 115 |
| 114 item.setHTTPContentType( | 116 item.setHTTPContentType( |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 if (!DecodePageState(page_state.ToEncodedData(), &state)) | 154 if (!DecodePageState(page_state.ToEncodedData(), &state)) |
| 153 return std::unique_ptr<HistoryEntry>(); | 155 return std::unique_ptr<HistoryEntry>(); |
| 154 | 156 |
| 155 std::unique_ptr<HistoryEntry> entry(new HistoryEntry()); | 157 std::unique_ptr<HistoryEntry> entry(new HistoryEntry()); |
| 156 RecursivelyGenerateHistoryItem(state.top, entry->root_history_node()); | 158 RecursivelyGenerateHistoryItem(state.top, entry->root_history_node()); |
| 157 | 159 |
| 158 return entry; | 160 return entry; |
| 159 } | 161 } |
| 160 | 162 |
| 161 } // namespace content | 163 } // namespace content |
| OLD | NEW |