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

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

Issue 2693523003: Moved TabID implementation to SerializableUserData. (Closed)
Patch Set: fix compile Created 3 years, 10 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/serializable_user_data_manager_impl.mm
diff --git a/ios/web/navigation/serializable_user_data_manager_impl.mm b/ios/web/navigation/serializable_user_data_manager_impl.mm
index e3dd717716df7755fcb628e8ec66041f11b6f871..b35e6f7effb9644da760384518fd1e81eb690226 100644
--- a/ios/web/navigation/serializable_user_data_manager_impl.mm
+++ b/ios/web/navigation/serializable_user_data_manager_impl.mm
@@ -59,7 +59,8 @@
}
SerializableUserDataImpl::SerializableUserDataImpl()
- : data_([[NSDictionary alloc] init]) {}
+ : data_([[NSDictionary alloc] init]),
+ legacy_key_conversions_(@{@"tabId" : @"TabID"}) {}
SerializableUserDataImpl::~SerializableUserDataImpl() {}
@@ -71,9 +72,20 @@
}
void SerializableUserDataImpl::Decode(NSCoder* coder) {
- NSDictionary* data = base::mac::ObjCCastStrict<NSDictionary>(
- [coder decodeObjectForKey:kSerializedUserDataKey]);
- data_.reset([data mutableCopy]);
+ NSMutableDictionary* data =
+ [[coder decodeObjectForKey:kSerializedUserDataKey] mutableCopy];
+ [data addEntriesFromDictionary:GetDecodedLegacyValues(coder)];
+ data_.reset([data copy]);
+}
+
+NSDictionary* SerializableUserDataImpl::GetDecodedLegacyValues(NSCoder* coder) {
+ NSMutableDictionary* legacy_values = [[NSMutableDictionary alloc] init];
+ for (NSString* legacy_key in [legacy_key_conversions_ allKeys]) {
+ id<NSCoding> value = [coder decodeObjectForKey:legacy_key];
+ NSString* new_key = [legacy_key_conversions_ objectForKey:legacy_key];
+ legacy_values[new_key] = value;
+ }
+ return legacy_values;
}
// static
« no previous file with comments | « ios/web/navigation/serializable_user_data_manager_impl.h ('k') | ios/web/navigation/session_storage_builder.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698