| 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 http_body->appendBlob(WebString::fromUTF8(element.blob_uuid)); | 77 http_body->appendBlob(WebString::fromUTF8(element.blob_uuid)); |
| 78 break; | 78 break; |
| 79 } | 79 } |
| 80 } | 80 } |
| 81 | 81 |
| 82 bool RecursivelyGenerateFrameState(const WebHistoryItem& item, | 82 bool RecursivelyGenerateFrameState(const WebHistoryItem& item, |
| 83 ExplodedFrameState* state) { | 83 ExplodedFrameState* state) { |
| 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->referrer_policy = item.referrerPolicy(); |
| 87 state->target = item.target(); | 88 state->target = item.target(); |
| 88 if (!item.stateObject().isNull()) | 89 if (!item.stateObject().isNull()) |
| 89 state->state_object = item.stateObject().toString(); | 90 state->state_object = item.stateObject().toString(); |
| 90 state->scroll_offset = item.scrollOffset(); | 91 state->scroll_offset = item.scrollOffset(); |
| 91 state->item_sequence_number = item.itemSequenceNumber(); | 92 state->item_sequence_number = item.itemSequenceNumber(); |
| 92 state->document_sequence_number = | 93 state->document_sequence_number = |
| 93 item.documentSequenceNumber(); | 94 item.documentSequenceNumber(); |
| 94 state->target_frame_id = item.targetFrameID(); | 95 state->target_frame_id = item.targetFrameID(); |
| 95 state->page_scale_factor = item.pageScaleFactor(); | 96 state->page_scale_factor = item.pageScaleFactor(); |
| 96 ToNullableString16Vector(item.documentState(), &state->document_state); | 97 ToNullableString16Vector(item.documentState(), &state->document_state); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 115 return false; | 116 return false; |
| 116 } | 117 } |
| 117 | 118 |
| 118 return true; | 119 return true; |
| 119 } | 120 } |
| 120 | 121 |
| 121 bool RecursivelyGenerateHistoryItem(const ExplodedFrameState& state, | 122 bool RecursivelyGenerateHistoryItem(const ExplodedFrameState& state, |
| 122 WebHistoryItem* item) { | 123 WebHistoryItem* item) { |
| 123 item->setURLString(state.url_string); | 124 item->setURLString(state.url_string); |
| 124 item->setOriginalURLString(state.original_url_string); | 125 item->setOriginalURLString(state.original_url_string); |
| 125 item->setReferrer(state.referrer); | 126 item->setReferrer(state.referrer, state.referrer_policy); |
| 126 item->setTarget(state.target); | 127 item->setTarget(state.target); |
| 127 if (!state.state_object.is_null()) { | 128 if (!state.state_object.is_null()) { |
| 128 item->setStateObject( | 129 item->setStateObject( |
| 129 WebSerializedScriptValue::fromString(state.state_object)); | 130 WebSerializedScriptValue::fromString(state.state_object)); |
| 130 } | 131 } |
| 131 item->setDocumentState(state.document_state); | 132 item->setDocumentState(state.document_state); |
| 132 item->setScrollOffset(state.scroll_offset); | 133 item->setScrollOffset(state.scroll_offset); |
| 133 item->setPageScaleFactor(state.page_scale_factor); | 134 item->setPageScaleFactor(state.page_scale_factor); |
| 134 | 135 |
| 135 // These values are generated at WebHistoryItem construction time, and we | 136 // These values are generated at WebHistoryItem construction time, and we |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 | 188 |
| 188 WebHistoryItem item; | 189 WebHistoryItem item; |
| 189 item.initialize(); | 190 item.initialize(); |
| 190 if (!RecursivelyGenerateHistoryItem(state.top, &item)) | 191 if (!RecursivelyGenerateHistoryItem(state.top, &item)) |
| 191 return WebHistoryItem(); | 192 return WebHistoryItem(); |
| 192 | 193 |
| 193 return item; | 194 return item; |
| 194 } | 195 } |
| 195 | 196 |
| 196 } // namespace content | 197 } // namespace content |
| OLD | NEW |