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

Side by Side Diff: android_webview/native/state_serializer.cc

Issue 2225343002: Navigation: move RestoreType and ReloadType into a separate file (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: [rebase] Created 4 years, 3 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
« no previous file with comments | « android_webview/browser/icon_helper.cc ('k') | chrome/browser/android/tab_state.cc » ('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 (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"
11 #include "content/public/browser/child_process_security_policy.h" 11 #include "content/public/browser/child_process_security_policy.h"
12 #include "content/public/browser/navigation_controller.h" 12 #include "content/public/browser/navigation_controller.h"
13 #include "content/public/browser/navigation_entry.h" 13 #include "content/public/browser/navigation_entry.h"
14 #include "content/public/browser/render_process_host.h" 14 #include "content/public/browser/render_process_host.h"
15 #include "content/public/browser/restore_type.h"
15 #include "content/public/browser/web_contents.h" 16 #include "content/public/browser/web_contents.h"
16 #include "content/public/common/page_state.h" 17 #include "content/public/common/page_state.h"
17 18
18 // Reasons for not re-using TabNavigation under chrome/ as of 20121116: 19 // Reasons for not re-using TabNavigation under chrome/ as of 20121116:
19 // * Android WebView has different requirements for fields to store since 20 // * Android WebView has different requirements for fields to store since
20 // we are the only ones using values like BaseURLForDataURL. 21 // we are the only ones using values like BaseURLForDataURL.
21 // * TabNavigation does unnecessary copying of data, which in Android 22 // * TabNavigation does unnecessary copying of data, which in Android
22 // WebView case, is undesired since save/restore is called in Android 23 // WebView case, is undesired since save/restore is called in Android
23 // very frequently. 24 // very frequently.
24 // * TabNavigation is tightly integrated with the rest of chrome session 25 // * TabNavigation is tightly integrated with the rest of chrome session
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 entries.push_back(content::NavigationEntry::Create()); 102 entries.push_back(content::NavigationEntry::Create());
102 if (!internal::RestoreNavigationEntryFromPickle(state_version, iterator, 103 if (!internal::RestoreNavigationEntryFromPickle(state_version, iterator,
103 entries[i].get())) 104 entries[i].get()))
104 return false; 105 return false;
105 106
106 entries[i]->SetPageID(i); 107 entries[i]->SetPageID(i);
107 } 108 }
108 109
109 // |web_contents| takes ownership of these entries after this call. 110 // |web_contents| takes ownership of these entries after this call.
110 content::NavigationController& controller = web_contents->GetController(); 111 content::NavigationController& controller = web_contents->GetController();
111 controller.Restore( 112 controller.Restore(selected_entry,
112 selected_entry, 113 content::RestoreType::LAST_SESSION_EXITED_CLEANLY,
113 content::NavigationController::RESTORE_LAST_SESSION_EXITED_CLEANLY, 114 &entries);
114 &entries);
115 DCHECK_EQ(0u, entries.size()); 115 DCHECK_EQ(0u, entries.size());
116 116
117 if (controller.GetLastCommittedEntry()) { 117 if (controller.GetLastCommittedEntry()) {
118 // Set up the file access rights for the selected navigation entry. 118 // Set up the file access rights for the selected navigation entry.
119 // TODO(joth): This is duplicated from chrome/.../session_restore.cc and 119 // TODO(joth): This is duplicated from chrome/.../session_restore.cc and
120 // should be shared e.g. in NavigationController. http://crbug.com/68222 120 // should be shared e.g. in NavigationController. http://crbug.com/68222
121 const int id = web_contents->GetRenderProcessHost()->GetID(); 121 const int id = web_contents->GetRenderProcessHost()->GetID();
122 const content::PageState& page_state = 122 const content::PageState& page_state =
123 controller.GetLastCommittedEntry()->GetPageState(); 123 controller.GetLastCommittedEntry()->GetPageState();
124 const std::vector<base::FilePath>& file_paths = 124 const std::vector<base::FilePath>& file_paths =
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « android_webview/browser/icon_helper.cc ('k') | chrome/browser/android/tab_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698