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/pickle.h" | 9 #include "base/pickle.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 if (!iterator->ReadInt(&selected_entry)) | 88 if (!iterator->ReadInt(&selected_entry)) |
89 return false; | 89 return false; |
90 | 90 |
91 if (entry_count < 0) | 91 if (entry_count < 0) |
92 return false; | 92 return false; |
93 if (selected_entry < -1) | 93 if (selected_entry < -1) |
94 return false; | 94 return false; |
95 if (selected_entry >= entry_count) | 95 if (selected_entry >= entry_count) |
96 return false; | 96 return false; |
97 | 97 |
98 std::vector<scoped_ptr<content::NavigationEntry>> entries; | 98 std::vector<std::unique_ptr<content::NavigationEntry>> entries; |
99 entries.reserve(entry_count); | 99 entries.reserve(entry_count); |
100 for (int i = 0; i < entry_count; ++i) { | 100 for (int i = 0; i < entry_count; ++i) { |
101 entries.push_back(content::NavigationEntry::Create()); | 101 entries.push_back(content::NavigationEntry::Create()); |
102 if (!internal::RestoreNavigationEntryFromPickle(state_version, iterator, | 102 if (!internal::RestoreNavigationEntryFromPickle(state_version, iterator, |
103 entries[i].get())) | 103 entries[i].get())) |
104 return false; | 104 return false; |
105 | 105 |
106 entries[i]->SetPageID(i); | 106 entries[i]->SetPageID(i); |
107 } | 107 } |
108 | 108 |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 return false; | 335 return false; |
336 entry->SetHttpStatusCode(http_status_code); | 336 entry->SetHttpStatusCode(http_status_code); |
337 } | 337 } |
338 | 338 |
339 return true; | 339 return true; |
340 } | 340 } |
341 | 341 |
342 } // namespace internal | 342 } // namespace internal |
343 | 343 |
344 } // namespace android_webview | 344 } // namespace android_webview |
OLD | NEW |