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

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

Issue 2655253002: Revert of Moved NavigationManagerImpl serialization out of CRWSessionController. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 8c8f6467110cdb04bbadd50158ae5090a0478cce..de7719be65684299990d49c6ebf5ef911635363c 100644
--- a/ios/chrome/browser/tabs/tab_model.mm
+++ b/ios/chrome/browser/tabs/tab_model.mm
@@ -66,17 +66,13 @@
namespace {
// Updates CRWSessionCertificatePolicyManager's certificate policy cache.
-void UpdateCertificatePolicyCacheFromWebState(web::WebState* web_state) {
+void UpdateCertificatePolicyCacheFromWebState(web::WebStateImpl* webState) {
DCHECK([NSThread isMainThread]);
- DCHECK(web_state);
+ DCHECK(webState);
scoped_refptr<web::CertificatePolicyCache> policy_cache =
- web::BrowserState::GetCertificatePolicyCache(
- web_state->GetBrowserState());
- // 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();
+ web::BrowserState::GetCertificatePolicyCache(webState->GetBrowserState());
+ CRWSessionController* controller =
+ webState->GetNavigationManagerImpl().GetSessionController();
[[controller sessionCertificatePolicyManager]
updateCertificatePolicyCache:policy_cache];
}
@@ -258,10 +254,8 @@
_tabs.reset([[NSMutableArray alloc] init]);
NSNotificationCenter* defaultCenter = [NSNotificationCenter defaultCenter];
if (window) {
- web::WebState::CreateParams params(_browserState);
- for (CRWNavigationManagerStorage* session in window.sessions) {
- std::unique_ptr<web::WebState> webState =
- web::WebState::Create(params, session);
+ while (window.unclaimedSessions) {
+ std::unique_ptr<web::WebStateImpl> webState = [window nextSession];
DCHECK_EQ(webState->GetBrowserState(), _browserState);
// Restore the CertificatePolicyCache.
UpdateCertificatePolicyCacheFromWebState(webState.get());
@@ -321,15 +315,12 @@
- (BOOL)restoreSessionWindow:(SessionWindowIOS*)window {
DCHECK(_browserState);
DCHECK(window);
- NSArray* sessions = window.sessions;
- if (!sessions.count)
+ if (!window.unclaimedSessions)
return NO;
size_t oldCount = [_tabs count];
size_t index = oldCount;
- web::WebState::CreateParams params(_browserState);
- for (CRWNavigationManagerStorage* session in sessions) {
- std::unique_ptr<web::WebState> webState =
- web::WebState::Create(params, session);
+ while (window.unclaimedSessions) {
+ std::unique_ptr<web::WebStateImpl> webState = [window nextSession];
DCHECK_EQ(webState->GetBrowserState(), _browserState);
Tab* tab = [self insertTabWithWebState:std::move(webState) atIndex:index++];
tab.webController.usePlaceholderOverlay = YES;
@@ -857,10 +848,11 @@
// TODO(crbug.com/661986): This could get expensive especially since this
// window may never be saved (if another call comes in before the delay).
SessionWindowIOS* window = [[[SessionWindowIOS alloc] init] autorelease];
- for (Tab* tab in self) {
- web::WebState* webState = tab.webState;
- DCHECK(webState);
- [window addSerializedSession:webState->BuildSerializedNavigationManager()];
+ for (Tab* tab in _tabs.get()) {
+ DCHECK(tab.webStateImpl);
+ std::unique_ptr<web::WebStateImpl> webStateCopy(
+ tab.webStateImpl->CopyForSessionWindow());
+ [window addSession:std::move(webStateCopy)];
}
window.selectedIndex = [self indexOfTab:_currentTab];
return window;
« no previous file with comments | « ios/chrome/browser/sessions/session_window_unittest.mm ('k') | ios/chrome/browser/tabs/tab_model_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698