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

Unified Diff: ios/chrome/browser/tabs/tab_model.mm

Issue 1360993002: Moved NavigationManagerImpl serialization out of CRWSessionController. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: test fix Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: ios/chrome/browser/tabs/tab_model.mm
diff --git a/ios/chrome/browser/tabs/tab_model.mm b/ios/chrome/browser/tabs/tab_model.mm
index efc46dbd381a8a777b9229df063bd25289a785ca..e1247e4960ed500f581bac3af2f48b546304d311 100644
--- a/ios/chrome/browser/tabs/tab_model.mm
+++ b/ios/chrome/browser/tabs/tab_model.mm
@@ -66,14 +66,17 @@
namespace {
// Updates CRWSessionCertificatePolicyManager's certificate policy cache.
-void UpdateCertificatePolicyCacheFromWebState(web::WebStateImpl* web_state) {
+void UpdateCertificatePolicyCacheFromWebState(web::WebState* web_state) {
DCHECK([NSThread isMainThread]);
DCHECK(web_state);
scoped_refptr<web::CertificatePolicyCache> policy_cache =
web::BrowserState::GetCertificatePolicyCache(
web_state->GetBrowserState());
- CRWSessionController* controller =
- web_state->GetNavigationManagerImpl().GetSessionController();
+ // TODO(crbug.com/454984): Remove CRWSessionController usage once certificate
+ // policy manager is moved to NavigationManager.
+ CRWSessionController* controller = static_cast<web::WebStateImpl*>(web_state)
+ ->GetNavigationManagerImpl()
+ .GetSessionController();
[[controller sessionCertificatePolicyManager]
updateCertificatePolicyCache:policy_cache];
}
@@ -264,8 +267,9 @@ - (instancetype)initWithSessionWindow:(SessionWindowIOS*)window
NSNotificationCenter* defaultCenter = [NSNotificationCenter defaultCenter];
if (window) {
- while (window.unclaimedSessions) {
- std::unique_ptr<web::WebStateImpl> webState = [window nextSession];
+ for (CRWNavigationManagerSerialization* session in window.sessions) {
+ web::WebState::CreateParams params(_browserState, session);
+ std::unique_ptr<web::WebState> webState = web::WebState::Create(params);
DCHECK_EQ(webState->GetBrowserState(), _browserState);
// Restore the CertificatePolicyCache.
UpdateCertificatePolicyCacheFromWebState(webState.get());
@@ -328,12 +332,14 @@ - (instancetype)init {
- (BOOL)restoreSessionWindow:(SessionWindowIOS*)window {
DCHECK(_browserState);
DCHECK(window);
- if (!window.unclaimedSessions)
+ NSArray* sessions = window.sessions;
+ if (!sessions.count)
return NO;
size_t oldCount = self.count;
size_t index = oldCount;
- while (window.unclaimedSessions) {
- std::unique_ptr<web::WebStateImpl> webState = [window nextSession];
+ for (CRWNavigationManagerSerialization* session in sessions) {
+ web::WebState::CreateParams params(_browserState, session);
+ std::unique_ptr<web::WebState> webState = web::WebState::Create(params);
DCHECK_EQ(webState->GetBrowserState(), _browserState);
Tab* tab = [self insertTabWithWebState:std::move(webState) atIndex:index++];
tab.webController.usePlaceholderOverlay = YES;
@@ -855,10 +861,9 @@ - (SessionWindowIOS*)windowForSavingSession {
// window may never be saved (if another call comes in before the delay).
SessionWindowIOS* window = [[[SessionWindowIOS alloc] init] autorelease];
for (Tab* tab in self) {
- DCHECK(tab.webStateImpl);
- std::unique_ptr<web::WebStateImpl> webStateCopy(
- tab.webStateImpl->CopyForSessionWindow());
- [window addSession:std::move(webStateCopy)];
+ web::WebState* webState = tab.webState;
+ DCHECK(webState);
+ [window addSerializedSession:webState->BuildSerializedNavigationManager()];
}
window.selectedIndex = [self indexOfTab:_currentTab];
return window;

Powered by Google App Engine
This is Rietveld 408576698