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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
109 // |web_contents| takes ownership of these entries after this call. | 109 // |web_contents| takes ownership of these entries after this call. |
110 content::NavigationController& controller = web_contents->GetController(); | 110 content::NavigationController& controller = web_contents->GetController(); |
111 controller.Restore( | 111 controller.Restore(selected_entry, |
112 selected_entry, | 112 content::RestoreType::LAST_SESSION_EXITED_CLEANLY, |
113 content::NavigationController::RESTORE_LAST_SESSION_EXITED_CLEANLY, | 113 &entries); |
114 &entries); | |
115 DCHECK_EQ(0u, entries.size()); | 114 DCHECK_EQ(0u, entries.size()); |
116 | 115 |
117 if (controller.GetLastCommittedEntry()) { | 116 if (controller.GetLastCommittedEntry()) { |
118 // Set up the file access rights for the selected navigation entry. | 117 // Set up the file access rights for the selected navigation entry. |
119 // TODO(joth): This is duplicated from chrome/.../session_restore.cc and | 118 // TODO(joth): This is duplicated from chrome/.../session_restore.cc and |
120 // should be shared e.g. in NavigationController. http://crbug.com/68222 | 119 // should be shared e.g. in NavigationController. http://crbug.com/68222 |
121 const int id = web_contents->GetRenderProcessHost()->GetID(); | 120 const int id = web_contents->GetRenderProcessHost()->GetID(); |
122 const content::PageState& page_state = | 121 const content::PageState& page_state = |
123 controller.GetLastCommittedEntry()->GetPageState(); | 122 controller.GetLastCommittedEntry()->GetPageState(); |
124 const std::vector<base::FilePath>& file_paths = | 123 const std::vector<base::FilePath>& file_paths = |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 return false; | 334 return false; |
336 entry->SetHttpStatusCode(http_status_code); | 335 entry->SetHttpStatusCode(http_status_code); |
337 } | 336 } |
338 | 337 |
339 return true; | 338 return true; |
340 } | 339 } |
341 | 340 |
342 } // namespace internal | 341 } // namespace internal |
343 | 342 |
344 } // namespace android_webview | 343 } // namespace android_webview |
OLD | NEW |