OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "android_webview/native/state_serializer.h" | 5 #include "android_webview/native/state_serializer.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
10 #include "base/pickle.h" | 10 #include "base/pickle.h" |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
139 | 139 |
140 const content::Referrer& referrer = entry.GetReferrer(); | 140 const content::Referrer& referrer = entry.GetReferrer(); |
141 if (!pickle->WriteString(referrer.url.spec())) | 141 if (!pickle->WriteString(referrer.url.spec())) |
142 return false; | 142 return false; |
143 if (!pickle->WriteInt(static_cast<int>(referrer.policy))) | 143 if (!pickle->WriteInt(static_cast<int>(referrer.policy))) |
144 return false; | 144 return false; |
145 | 145 |
146 if (!pickle->WriteString16(entry.GetTitle())) | 146 if (!pickle->WriteString16(entry.GetTitle())) |
147 return false; | 147 return false; |
148 | 148 |
149 if (!pickle->WriteString16(entry.GetSearchTerms())) | |
150 return false; | |
151 | |
149 if (!pickle->WriteString(entry.GetContentState())) | 152 if (!pickle->WriteString(entry.GetContentState())) |
150 return false; | 153 return false; |
151 | 154 |
152 if (!pickle->WriteBool(static_cast<int>(entry.GetHasPostData()))) | 155 if (!pickle->WriteBool(static_cast<int>(entry.GetHasPostData()))) |
153 return false; | 156 return false; |
154 | 157 |
155 if (!pickle->WriteString(entry.GetOriginalRequestURL().spec())) | 158 if (!pickle->WriteString(entry.GetOriginalRequestURL().spec())) |
156 return false; | 159 return false; |
157 | 160 |
158 if (!pickle->WriteString(entry.GetBaseURLForDataURL().spec())) | 161 if (!pickle->WriteString(entry.GetBaseURLForDataURL().spec())) |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
201 } | 204 } |
202 | 205 |
203 { | 206 { |
204 string16 title; | 207 string16 title; |
205 if (!iterator->ReadString16(&title)) | 208 if (!iterator->ReadString16(&title)) |
206 return false; | 209 return false; |
207 entry->SetTitle(title); | 210 entry->SetTitle(title); |
208 } | 211 } |
209 | 212 |
210 { | 213 { |
214 string16 search_terms; | |
akalin
2012/12/06 23:14:46
will this ever try to load 'old' pickled entries?
Mathieu
2012/12/11 00:30:17
Done. I've put it at the end, but it won't fail if
| |
215 if (!iterator->ReadString16(&search_terms)) | |
216 return false; | |
217 entry->SetSearchTerms(search_terms); | |
218 } | |
219 | |
220 { | |
211 string content_state; | 221 string content_state; |
212 if (!iterator->ReadString(&content_state)) | 222 if (!iterator->ReadString(&content_state)) |
213 return false; | 223 return false; |
214 entry->SetContentState(content_state); | 224 entry->SetContentState(content_state); |
215 } | 225 } |
216 | 226 |
217 { | 227 { |
218 bool has_post_data; | 228 bool has_post_data; |
219 if (!iterator->ReadBool(&has_post_data)) | 229 if (!iterator->ReadBool(&has_post_data)) |
220 return false; | 230 return false; |
(...skipping 27 matching lines...) Expand all Loading... | |
248 return false; | 258 return false; |
249 entry->SetTimestamp(base::Time::FromInternalValue(timestamp)); | 259 entry->SetTimestamp(base::Time::FromInternalValue(timestamp)); |
250 } | 260 } |
251 | 261 |
252 return true; | 262 return true; |
253 } | 263 } |
254 | 264 |
255 } // namespace internal | 265 } // namespace internal |
256 | 266 |
257 } // namespace android_webview | 267 } // namespace android_webview |
OLD | NEW |