| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #import "ios/web/navigation/crw_serialized_navigation_manager.h" | 5 #import "ios/web/navigation/crw_serialized_navigation_manager.h" |
| 6 | 6 |
| 7 #include "base/mac/objc_property_releaser.h" | 7 #include "base/mac/objc_property_releaser.h" |
| 8 #import "ios/web/navigation/crw_session_certificate_policy_manager.h" | 8 #import "ios/web/navigation/crw_session_certificate_policy_manager.h" |
| 9 | 9 |
| 10 namespace { | 10 namespace { |
| 11 // Serialization keys used in NSCoding functions. | 11 // Serialization keys used in NSCoding functions. |
| 12 NSString* const kCertificatePolicyManagerKey = @"certificatePolicyManager"; | 12 NSString* const kCertificatePolicyManagerKey = @"certificatePolicyManager"; |
| 13 NSString* const kCurrentNavigationIndexKey = @"currentNavigationIndex"; | 13 NSString* const kCurrentNavigationIndexKey = @"currentNavigationIndex"; |
| 14 NSString* const kEntriesKey = @"entries"; | 14 NSString* const kEntriesKey = @"entries"; |
| 15 NSString* const kLastVisitedTimestampKey = @"lastVisitedTimestamp"; | 15 NSString* const kLastVisitedTimestampKey = @"lastVisitedTimestamp"; |
| 16 NSString* const kOpenerIdKey = @"openerId"; | 16 NSString* const kOpenerIdKey = @"openerId"; |
| 17 NSString* const kOpenedByDOMKey = @"openedByDOM"; | 17 NSString* const kOpenedByDOMKey = @"openedByDOM"; |
| 18 NSString* const kOpenerNavigationIndexKey = @"openerNavigationIndex"; | 18 NSString* const kOpenerNavigationIndexKey = @"openerNavigationIndex"; |
| 19 NSString* const kPreviousNavigationIndexKey = @"previousNavigationIndex"; | 19 NSString* const kPreviousNavigationIndexKey = @"previousNavigationIndex"; |
| 20 NSString* const kTabIdKey = @"tabId"; | 20 NSString* const kTabIdKey = @"tabId"; |
| 21 NSString* const kWindowNameKey = @"windowName"; | 21 NSString* const kWindowNameKey = @"windowName"; |
| 22 NSString* const kXCallbackParametersKey = @"xCallbackParameters"; | 22 NSString* const kXCallbackParametersKey = @"xCallbackParameters"; |
| 23 NSString* const kSerializedUserDataKey = @"serializedUserData"; |
| 23 } | 24 } |
| 24 | 25 |
| 25 @interface CRWSerializedNavigationManager () { | 26 @interface CRWSerializedNavigationManager () { |
| 26 base::mac::ObjCPropertyReleaser | 27 base::mac::ObjCPropertyReleaser |
| 27 _propertyReleaser_CRWSerializedNavigationManager; | 28 _propertyReleaser_CRWSerializedNavigationManager; |
| 28 } | 29 } |
| 29 @end | 30 @end |
| 30 | 31 |
| 31 @implementation CRWSerializedNavigationManager | 32 @implementation CRWSerializedNavigationManager |
| 32 | 33 |
| 33 @synthesize tabId = _tabId; | 34 @synthesize tabId = _tabId; |
| 34 @synthesize openerId = _openerId; | 35 @synthesize openerId = _openerId; |
| 35 @synthesize openedByDOM = _openedByDOM; | 36 @synthesize openedByDOM = _openedByDOM; |
| 36 @synthesize openerNavigationIndex = _openerNavigationIdes; | 37 @synthesize openerNavigationIndex = _openerNavigationIdes; |
| 37 @synthesize windowName = _windowName; | 38 @synthesize windowName = _windowName; |
| 38 @synthesize currentNavigationIndex = _currentNavigationIndex; | 39 @synthesize currentNavigationIndex = _currentNavigationIndex; |
| 39 @synthesize previousNavigationIndex = _previousNavigationIndex; | 40 @synthesize previousNavigationIndex = _previousNavigationIndex; |
| 40 @synthesize lastVisitedTimestamp = _lastVisitedTimestamp; | 41 @synthesize lastVisitedTimestamp = _lastVisitedTimestamp; |
| 41 @synthesize entries = _entries; | 42 @synthesize entries = _entries; |
| 42 @synthesize sessionCertificatePolicyManager = _sessionCertificatePolicyManager; | 43 @synthesize sessionCertificatePolicyManager = _sessionCertificatePolicyManager; |
| 43 @synthesize xCallbackParameters = _xCallbackParameters; | 44 @synthesize xCallbackParameters = _xCallbackParameters; |
| 45 @synthesize serializedUserData = _serializedUserData; |
| 44 | 46 |
| 45 - (instancetype)init { | 47 - (instancetype)init { |
| 46 self = [super init]; | 48 self = [super init]; |
| 47 if (self) { | 49 if (self) { |
| 48 _propertyReleaser_CRWSerializedNavigationManager.Init( | 50 _propertyReleaser_CRWSerializedNavigationManager.Init( |
| 49 self, [CRWSerializedNavigationManager class]); | 51 self, [CRWSerializedNavigationManager class]); |
| 50 } | 52 } |
| 51 return self; | 53 return self; |
| 52 } | 54 } |
| 53 | 55 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 72 if (!self.entries.count) | 74 if (!self.entries.count) |
| 73 self.currentNavigationIndex = -1; | 75 self.currentNavigationIndex = -1; |
| 74 self.sessionCertificatePolicyManager = | 76 self.sessionCertificatePolicyManager = |
| 75 [aDecoder decodeObjectForKey:kCertificatePolicyManagerKey]; | 77 [aDecoder decodeObjectForKey:kCertificatePolicyManagerKey]; |
| 76 if (!self.sessionCertificatePolicyManager) { | 78 if (!self.sessionCertificatePolicyManager) { |
| 77 self.sessionCertificatePolicyManager = | 79 self.sessionCertificatePolicyManager = |
| 78 [[CRWSessionCertificatePolicyManager alloc] init]; | 80 [[CRWSessionCertificatePolicyManager alloc] init]; |
| 79 } | 81 } |
| 80 self.xCallbackParameters = | 82 self.xCallbackParameters = |
| 81 [[aDecoder decodeObjectForKey:kXCallbackParametersKey] retain]; | 83 [[aDecoder decodeObjectForKey:kXCallbackParametersKey] retain]; |
| 84 self.serializedUserData = |
| 85 [aDecoder decodeObjectForKey:kSerializedUserDataKey]; |
| 82 } | 86 } |
| 83 return self; | 87 return self; |
| 84 } | 88 } |
| 85 | 89 |
| 86 - (void)encodeWithCoder:(NSCoder*)aCoder { | 90 - (void)encodeWithCoder:(NSCoder*)aCoder { |
| 87 [aCoder encodeObject:self.tabId forKey:kTabIdKey]; | 91 [aCoder encodeObject:self.tabId forKey:kTabIdKey]; |
| 88 [aCoder encodeObject:self.openerId forKey:kOpenerIdKey]; | 92 [aCoder encodeObject:self.openerId forKey:kOpenerIdKey]; |
| 89 [aCoder encodeBool:self.openedByDOM forKey:kOpenedByDOMKey]; | 93 [aCoder encodeBool:self.openedByDOM forKey:kOpenedByDOMKey]; |
| 90 [aCoder encodeInt:self.openerNavigationIndex | 94 [aCoder encodeInt:self.openerNavigationIndex |
| 91 forKey:kOpenerNavigationIndexKey]; | 95 forKey:kOpenerNavigationIndexKey]; |
| 92 [aCoder encodeObject:self.windowName forKey:kWindowNameKey]; | 96 [aCoder encodeObject:self.windowName forKey:kWindowNameKey]; |
| 93 [aCoder encodeInt:self.currentNavigationIndex | 97 [aCoder encodeInt:self.currentNavigationIndex |
| 94 forKey:kCurrentNavigationIndexKey]; | 98 forKey:kCurrentNavigationIndexKey]; |
| 95 [aCoder encodeInt:self.previousNavigationIndex | 99 [aCoder encodeInt:self.previousNavigationIndex |
| 96 forKey:kPreviousNavigationIndexKey]; | 100 forKey:kPreviousNavigationIndexKey]; |
| 97 [aCoder encodeDouble:self.lastVisitedTimestamp | 101 [aCoder encodeDouble:self.lastVisitedTimestamp |
| 98 forKey:kLastVisitedTimestampKey]; | 102 forKey:kLastVisitedTimestampKey]; |
| 99 [aCoder encodeObject:self.entries forKey:kEntriesKey]; | 103 [aCoder encodeObject:self.entries forKey:kEntriesKey]; |
| 100 [aCoder encodeObject:self.sessionCertificatePolicyManager | 104 [aCoder encodeObject:self.sessionCertificatePolicyManager |
| 101 forKey:kCertificatePolicyManagerKey]; | 105 forKey:kCertificatePolicyManagerKey]; |
| 102 [aCoder encodeObject:self.xCallbackParameters forKey:kXCallbackParametersKey]; | 106 [aCoder encodeObject:self.xCallbackParameters forKey:kXCallbackParametersKey]; |
| 103 // rendererInitiated is deliberately not preserved, as upstream. | 107 // rendererInitiated is deliberately not preserved, as upstream. |
| 108 [aCoder encodeObject:self.serializedUserData forKey:kSerializedUserDataKey]; |
| 104 } | 109 } |
| 105 | 110 |
| 106 @end | 111 @end |
| OLD | NEW |