| 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 } | 106 } |
| 107 | 107 |
| 108 // |web_contents| takes ownership of these entries after this call. | 108 // |web_contents| takes ownership of these entries after this call. |
| 109 content::NavigationController& controller = web_contents->GetController(); | 109 content::NavigationController& controller = web_contents->GetController(); |
| 110 controller.Restore( | 110 controller.Restore( |
| 111 selected_entry, | 111 selected_entry, |
| 112 content::NavigationController::RESTORE_LAST_SESSION_EXITED_CLEANLY, | 112 content::NavigationController::RESTORE_LAST_SESSION_EXITED_CLEANLY, |
| 113 &restored_entries); | 113 &restored_entries); |
| 114 DCHECK_EQ(0u, restored_entries.size()); | 114 DCHECK_EQ(0u, restored_entries.size()); |
| 115 | 115 |
| 116 if (controller.GetActiveEntry()) { | 116 if (controller.GetLastCommittedEntry()) { |
| 117 // Set up the file access rights for the selected navigation entry. | 117 // Set up the file access rights for the selected navigation entry. |
| 118 // TODO(joth): This is duplicated from chrome/.../session_restore.cc and | 118 // TODO(joth): This is duplicated from chrome/.../session_restore.cc and |
| 119 // should be shared e.g. in NavigationController. http://crbug.com/68222 | 119 // should be shared e.g. in NavigationController. http://crbug.com/68222 |
| 120 const int id = web_contents->GetRenderProcessHost()->GetID(); | 120 const int id = web_contents->GetRenderProcessHost()->GetID(); |
| 121 const content::PageState& page_state = | 121 const content::PageState& page_state = |
| 122 controller.GetActiveEntry()->GetPageState(); | 122 controller.GetLastCommittedEntry()->GetPageState(); |
| 123 const std::vector<base::FilePath>& file_paths = | 123 const std::vector<base::FilePath>& file_paths = |
| 124 page_state.GetReferencedFiles(); | 124 page_state.GetReferencedFiles(); |
| 125 for (std::vector<base::FilePath>::const_iterator file = file_paths.begin(); | 125 for (std::vector<base::FilePath>::const_iterator file = file_paths.begin(); |
| 126 file != file_paths.end(); ++file) { | 126 file != file_paths.end(); ++file) { |
| 127 content::ChildProcessSecurityPolicy::GetInstance()->GrantReadFile(id, | 127 content::ChildProcessSecurityPolicy::GetInstance()->GrantReadFile(id, |
| 128 *file); | 128 *file); |
| 129 } | 129 } |
| 130 } | 130 } |
| 131 | 131 |
| 132 controller.LoadIfNecessary(); | 132 controller.LoadIfNecessary(); |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 return false; | 281 return false; |
| 282 entry->SetHttpStatusCode(http_status_code); | 282 entry->SetHttpStatusCode(http_status_code); |
| 283 } | 283 } |
| 284 | 284 |
| 285 return true; | 285 return true; |
| 286 } | 286 } |
| 287 | 287 |
| 288 } // namespace internal | 288 } // namespace internal |
| 289 | 289 |
| 290 } // namespace android_webview | 290 } // namespace android_webview |
| OLD | NEW |