Chromium Code Reviews| Index: ios/web/navigation/crw_serialized_navigation_manager.mm |
| diff --git a/ios/web/navigation/crw_serialized_navigation_manager.mm b/ios/web/navigation/crw_serialized_navigation_manager.mm |
| index ea90d7fdae65cb7fb81b275cfcb8362cd688f530..3f8560b644a5cd4d332ed8429018a1c9129395c4 100644 |
| --- a/ios/web/navigation/crw_serialized_navigation_manager.mm |
| +++ b/ios/web/navigation/crw_serialized_navigation_manager.mm |
| @@ -5,6 +5,7 @@ |
| #import "ios/web/navigation/crw_serialized_navigation_manager.h" |
| #include "base/mac/objc_property_releaser.h" |
| +#include "base/mac/scoped_nsobject.h" |
| #import "ios/web/navigation/crw_session_certificate_policy_manager.h" |
| namespace { |
| @@ -20,9 +21,15 @@ NSString* const kPreviousNavigationIndexKey = @"previousNavigationIndex"; |
| NSString* const kTabIDKey = @"tabId"; |
| NSString* const kWindowNameKey = @"windowName"; |
| NSString* const kXCallbackParametersKey = @"xCallbackParameters"; |
| +NSString* const kSerializedUserDataKey = @"serializedUserData"; |
| } |
| @interface CRWSerializedNavigationManager () { |
| + // |serializedUserData| is backed with an NSMutableDictionary so that |
| + // NavigationManager's legacy properties can be decoded and added directly to |
| + // the dictionary. |
| + base::scoped_nsobject<NSMutableDictionary> _serializedUserData; |
| + |
| base::mac::ObjCPropertyReleaser |
| _propertyReleaser_CRWSerializedNavigationManager; |
| } |
| @@ -79,6 +86,8 @@ NSString* const kXCallbackParametersKey = @"xCallbackParameters"; |
| } |
| _XCallbackParameters = |
| [[decoder decodeObjectForKey:kXCallbackParametersKey] retain]; |
| + _serializedUserData.reset([[NSMutableDictionary alloc] initWithDictionary: |
| + [decoder decodeObjectForKey:kSerializedUserDataKey]]); |
| } |
| return self; |
| } |
| @@ -100,6 +109,16 @@ NSString* const kXCallbackParametersKey = @"xCallbackParameters"; |
| forKey:kCertificatePolicyManagerKey]; |
| [coder encodeObject:self.XCallbackParameters forKey:kXCallbackParametersKey]; |
| // rendererInitiated is deliberately not preserved, as upstream. |
| + [coder encodeObject:self.serializedUserData forKey:kSerializedUserDataKey]; |
| +} |
| + |
| +- (void)setSerializedUserData:(NSDictionary*)serializedUserData { |
| + _serializedUserData.reset( |
| + [[NSMutableDictionary alloc] initWithDictionary:serializedUserData]); |
| +} |
| + |
| +- (NSDictionary*)serializedUserData { |
| + return _serializedUserData; |
|
Eugene But (OOO till 7-30)
2015/09/24 21:39:25
NIT: Maybe return an autoreleased copy here (same
|
| } |
| @end |