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

Unified Diff: ios/web/navigation/crw_session_controller.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
« no previous file with comments | « ios/web/navigation/crw_session_controller.h ('k') | ios/web/navigation/navigation_manager_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/navigation/crw_session_controller.mm
diff --git a/ios/web/navigation/crw_session_controller.mm b/ios/web/navigation/crw_session_controller.mm
index bc03108a4936197276c2be68fbb8f7273fa23784..32fd7940d70516b7f42c348e41653ce3aad4a708 100644
--- a/ios/web/navigation/crw_session_controller.mm
+++ b/ios/web/navigation/crw_session_controller.mm
@@ -32,6 +32,19 @@
#error "This file requires ARC support."
#endif
+namespace {
+NSString* const kCertificatePolicyManagerKey = @"certificatePolicyManager";
+NSString* const kCurrentNavigationIndexKey = @"currentNavigationIndex";
+NSString* const kEntriesKey = @"entries";
+NSString* const kLastVisitedTimestampKey = @"lastVisitedTimestamp";
+NSString* const kOpenerIdKey = @"openerId";
+NSString* const kOpenedByDOMKey = @"openedByDOM";
+NSString* const kOpenerNavigationIndexKey = @"openerNavigationIndex";
+NSString* const kPreviousNavigationIndexKey = @"previousNavigationIndex";
+NSString* const kTabIdKey = @"tabId";
+NSString* const kWindowNameKey = @"windowName";
+} // namespace
+
@interface CRWSessionController () {
// Weak pointer back to the owning NavigationManager. This is to facilitate
// the incremental merging of the two classes.
@@ -96,14 +109,6 @@
@property(nonatomic, readwrite, strong) NSArray* entries;
@property(nonatomic, readwrite, strong)
CRWSessionCertificatePolicyManager* sessionCertificatePolicyManager;
-
-// Expose setters for serialization properties. These are exposed in a category
-// in NavigationManagerStorageBuilder, and will be removed as ownership of
-// their backing ivars moves to NavigationManagerImpl.
-@property(nonatomic, readwrite, copy) NSString* openerId;
-@property(nonatomic, readwrite, getter=isOpenedByDOM) BOOL openedByDOM;
-@property(nonatomic, readwrite, assign) NSInteger openerNavigationIndex;
-@property(nonatomic, readwrite, assign) NSInteger previousNavigationIndex;
- (NSString*)uniqueID;
// Removes all entries after currentNavigationIndex_.
@@ -191,6 +196,59 @@
[[CRWSessionCertificatePolicyManager alloc] init];
}
return self;
+}
+
+- (id)initWithCoder:(NSCoder*)aDecoder {
+ self = [super init];
+ if (self) {
+ NSString* uuid = [aDecoder decodeObjectForKey:kTabIdKey];
+ if (!uuid)
+ uuid = [self uniqueID];
+
+ self.windowName = [aDecoder decodeObjectForKey:kWindowNameKey];
+ _tabId = [uuid copy];
+ _openerId = [[aDecoder decodeObjectForKey:kOpenerIdKey] copy];
+ _openedByDOM = [aDecoder decodeBoolForKey:kOpenedByDOMKey];
+ _openerNavigationIndex =
+ [aDecoder decodeIntForKey:kOpenerNavigationIndexKey];
+ _currentNavigationIndex =
+ [aDecoder decodeIntForKey:kCurrentNavigationIndexKey];
+ _previousNavigationIndex =
+ [aDecoder decodeIntForKey:kPreviousNavigationIndexKey];
+ _pendingEntryIndex = -1;
+ _lastVisitedTimestamp =
+ [aDecoder decodeDoubleForKey:kLastVisitedTimestampKey];
+ NSMutableArray* temp =
+ [NSMutableArray arrayWithArray:
+ [aDecoder decodeObjectForKey:kEntriesKey]];
+ _entries = temp;
+ // Prior to M34, 0 was used as "no index" instead of -1; adjust for that.
+ if (![_entries count])
+ _currentNavigationIndex = -1;
+ _sessionCertificatePolicyManager =
+ [aDecoder decodeObjectForKey:kCertificatePolicyManagerKey];
+ if (!_sessionCertificatePolicyManager) {
+ _sessionCertificatePolicyManager =
+ [[CRWSessionCertificatePolicyManager alloc] init];
+ }
+ }
+ return self;
+}
+
+- (void)encodeWithCoder:(NSCoder*)aCoder {
+ [aCoder encodeObject:_tabId forKey:kTabIdKey];
+ [aCoder encodeObject:_openerId forKey:kOpenerIdKey];
+ [aCoder encodeBool:_openedByDOM forKey:kOpenedByDOMKey];
+ [aCoder encodeInt:_openerNavigationIndex forKey:kOpenerNavigationIndexKey];
+ [aCoder encodeObject:_windowName forKey:kWindowNameKey];
+ [aCoder encodeInt:_currentNavigationIndex forKey:kCurrentNavigationIndexKey];
+ [aCoder encodeInt:_previousNavigationIndex
+ forKey:kPreviousNavigationIndexKey];
+ [aCoder encodeDouble:_lastVisitedTimestamp forKey:kLastVisitedTimestampKey];
+ [aCoder encodeObject:_entries forKey:kEntriesKey];
+ [aCoder encodeObject:_sessionCertificatePolicyManager
+ forKey:kCertificatePolicyManagerKey];
+ // rendererInitiated is deliberately not preserved, as upstream.
}
- (id)copyWithZone:(NSZone*)zone {
« no previous file with comments | « ios/web/navigation/crw_session_controller.h ('k') | ios/web/navigation/navigation_manager_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698