Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(337)

Side by Side Diff: content/renderer/history_serialization.cc

Issue 412303002: Use WebHistoryItem.frameSequenceNumber() to find frames for history navigations (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/renderer/history_entry.cc ('k') | content/test/data/page_state/serialized_v20.dat » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 state->referrer = item.referrer(); 87 state->referrer = item.referrer();
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->pinch_viewport_scroll_offset = item.pinchViewportScrollOffset(); 92 state->pinch_viewport_scroll_offset = item.pinchViewportScrollOffset();
93 state->scroll_offset = item.scrollOffset(); 93 state->scroll_offset = item.scrollOffset();
94 state->item_sequence_number = item.itemSequenceNumber(); 94 state->item_sequence_number = item.itemSequenceNumber();
95 state->document_sequence_number = 95 state->document_sequence_number =
96 item.documentSequenceNumber(); 96 item.documentSequenceNumber();
97 state->frame_sequence_number =
98 item.frameSequenceNumber();
97 state->page_scale_factor = item.pageScaleFactor(); 99 state->page_scale_factor = item.pageScaleFactor();
98 ToNullableString16Vector(item.documentState(), &state->document_state); 100 ToNullableString16Vector(item.documentState(), &state->document_state);
99 101
100 state->http_body.http_content_type = item.httpContentType(); 102 state->http_body.http_content_type = item.httpContentType();
101 const WebHTTPBody& http_body = item.httpBody(); 103 const WebHTTPBody& http_body = item.httpBody();
102 state->http_body.is_null = http_body.isNull(); 104 state->http_body.is_null = http_body.isNull();
103 if (!state->http_body.is_null) { 105 if (!state->http_body.is_null) {
104 state->http_body.identifier = http_body.identifier(); 106 state->http_body.identifier = http_body.identifier();
105 state->http_body.elements.resize(http_body.elementCount()); 107 state->http_body.elements.resize(http_body.elementCount());
106 for (size_t i = 0; i < http_body.elementCount(); ++i) { 108 for (size_t i = 0; i < http_body.elementCount(); ++i) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 item.setScrollOffset(state.scroll_offset); 140 item.setScrollOffset(state.scroll_offset);
139 item.setPageScaleFactor(state.page_scale_factor); 141 item.setPageScaleFactor(state.page_scale_factor);
140 142
141 // These values are generated at WebHistoryItem construction time, and we 143 // These values are generated at WebHistoryItem construction time, and we
142 // only want to override those new values with old values if the old values 144 // only want to override those new values with old values if the old values
143 // are defined. A value of 0 means undefined in this context. 145 // are defined. A value of 0 means undefined in this context.
144 if (state.item_sequence_number) 146 if (state.item_sequence_number)
145 item.setItemSequenceNumber(state.item_sequence_number); 147 item.setItemSequenceNumber(state.item_sequence_number);
146 if (state.document_sequence_number) 148 if (state.document_sequence_number)
147 item.setDocumentSequenceNumber(state.document_sequence_number); 149 item.setDocumentSequenceNumber(state.document_sequence_number);
150 if (state.frame_sequence_number)
151 item.setFrameSequenceNumber(state.frame_sequence_number);
148 152
149 item.setHTTPContentType(state.http_body.http_content_type); 153 item.setHTTPContentType(state.http_body.http_content_type);
150 if (!state.http_body.is_null) { 154 if (!state.http_body.is_null) {
151 WebHTTPBody http_body; 155 WebHTTPBody http_body;
152 http_body.initialize(); 156 http_body.initialize();
153 http_body.setIdentifier(state.http_body.identifier); 157 http_body.setIdentifier(state.http_body.identifier);
154 for (size_t i = 0; i < state.http_body.elements.size(); ++i) 158 for (size_t i = 0; i < state.http_body.elements.size(); ++i)
155 AppendHTTPBodyElement(state.http_body.elements[i], &http_body); 159 AppendHTTPBodyElement(state.http_body.elements[i], &http_body);
156 item.setHTTPBody(http_body); 160 item.setHTTPBody(http_body);
157 } 161 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 if (!DecodePageState(page_state.ToEncodedData(), &state)) 199 if (!DecodePageState(page_state.ToEncodedData(), &state))
196 return scoped_ptr<HistoryEntry>(); 200 return scoped_ptr<HistoryEntry>();
197 201
198 scoped_ptr<HistoryEntry> entry(new HistoryEntry()); 202 scoped_ptr<HistoryEntry> entry(new HistoryEntry());
199 RecursivelyGenerateHistoryItem(state.top, entry->root_history_node()); 203 RecursivelyGenerateHistoryItem(state.top, entry->root_history_node());
200 204
201 return entry.Pass(); 205 return entry.Pass();
202 } 206 }
203 207
204 } // namespace content 208 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/history_entry.cc ('k') | content/test/data/page_state/serialized_v20.dat » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698