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

Unified Diff: ios/web/navigation/crw_session_controller.mm

Issue 1360993002: Moved NavigationManagerImpl serialization out of CRWSessionController. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Eugene's comments Created 5 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 side-by-side diff with in-line comments
Download patch
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 f5c1c3c39729450bae55985a5c4a830797cf44d2..c280cd4b518572b6ab8676bfa90fd1ed402aca9e 100644
--- a/ios/web/navigation/crw_session_controller.mm
+++ b/ios/web/navigation/crw_session_controller.mm
@@ -29,20 +29,6 @@
using base::UserMetricsAction;
-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";
-NSString* const kXCallbackParametersKey = @"xCallbackParameters";
-} // anonymous namespace
-
@interface CRWSessionController () {
// Weak pointer back to the owning NavigationManager. This is to facilitate
// the incremental merging of the two classes.
@@ -113,6 +99,14 @@ NSString* const kXCallbackParametersKey = @"xCallbackParameters";
@property(nonatomic, readwrite, retain)
CRWSessionCertificatePolicyManager* sessionCertificatePolicyManager;
+// Expose setters for serialization properties. These are exposed in a category
+// in SerializedNavigationManagerBuilder, 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_.
- (void)clearForwardEntries;
@@ -205,64 +199,6 @@ NSString* const kXCallbackParametersKey = @"xCallbackParameters";
return self;
}
-- (id)initWithCoder:(NSCoder*)aDecoder {
- self = [super init];
- if (self) {
- _propertyReleaser_CRWSessionController.Init(self,
- [CRWSessionController class]);
- NSString* uuid = [aDecoder decodeObjectForKey:kTabIdKey];
- if (!uuid)
- uuid = [self uniqueID];
-
- self.windowName = [aDecoder decodeObjectForKey:kWindowNameKey];
- _tabId = [uuid retain];
- _openerId = [[aDecoder decodeObjectForKey:kOpenerIdKey] copy];
- _openedByDOM = [aDecoder decodeBoolForKey:kOpenedByDOMKey];
- _openerNavigationIndex =
- [aDecoder decodeIntForKey:kOpenerNavigationIndexKey];
- _currentNavigationIndex =
- [aDecoder decodeIntForKey:kCurrentNavigationIndexKey];
- _previousNavigationIndex =
- [aDecoder decodeIntForKey:kPreviousNavigationIndexKey];
- _lastVisitedTimestamp =
- [aDecoder decodeDoubleForKey:kLastVisitedTimestampKey];
- NSMutableArray* temp =
- [NSMutableArray arrayWithArray:
- [aDecoder decodeObjectForKey:kEntriesKey]];
- _entries = [temp retain];
- // Prior to M34, 0 was used as "no index" instead of -1; adjust for that.
- if (![_entries count])
- _currentNavigationIndex = -1;
- _sessionCertificatePolicyManager =
- [[aDecoder decodeObjectForKey:kCertificatePolicyManagerKey] retain];
- if (!_sessionCertificatePolicyManager) {
- _sessionCertificatePolicyManager =
- [[CRWSessionCertificatePolicyManager alloc] init];
- }
-
- _xCallbackParameters =
- [[aDecoder decodeObjectForKey:kXCallbackParametersKey] retain];
- }
- 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];
- [aCoder encodeObject:_xCallbackParameters forKey:kXCallbackParametersKey];
- // rendererInitiated is deliberately not preserved, as upstream.
-}
-
- (id)copyWithZone:(NSZone*)zone {
CRWSessionController* copy = [[[self class] alloc] init];
copy->_propertyReleaser_CRWSessionController.Init(

Powered by Google App Engine
This is Rietveld 408576698