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

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

Issue 2732063003: Add unittests checking that old saved session can be restored. (Closed)
Patch Set: Rebase and document -performSaveToDirectoryInBackground:. Created 3 years, 9 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/chrome/test/data/sessions/session_m58.plist ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 09657b847abe2a73addc91e46bd3f4772103f11c..9a0dde5b2166611364a5fb362919c541fed657cc 100644
--- a/ios/web/navigation/serializable_user_data_manager_impl.mm
+++ b/ios/web/navigation/serializable_user_data_manager_impl.mm
@@ -50,6 +50,23 @@ class SerializableUserDataManagerWrapper : public base::SupportsUserData::Data {
// The SerializableUserDataManagerWrapper owned by this object.
SerializableUserDataManagerImpl manager_;
};
+
+// Returns a dictionary mapping old CRWSessionStorage serialised properties to
+// the corresponding key in the serialised user data. When adding a mapping to
+// this dictionary, create a new crbug to track its removal and mark it with a
+// release at least one year after the introduction of the mapping.
+NSDictionary* GetLegacyKeyConversion() {
+ NSMutableDictionary* legacy_key_conversion = [NSMutableDictionary dictionary];
+ // TODO(crbug.com/661633): those mappings where introduced between M57 and
+ // M58, so remove them after M67 has shipped to stable.
+ [legacy_key_conversion addEntriesFromDictionary:@{
+ @"tabId" : @"TabID",
+ @"openerId" : @"OpenerID",
+ @"openerNavigationIndex" : @"OpenerNavigationIndex",
+ @"lastVisitedTimestamp" : @"LastVisitedTimestamp",
+ }];
+ return [legacy_key_conversion copy];
+}
} // namespace
// static
@@ -58,12 +75,7 @@ std::unique_ptr<SerializableUserData> SerializableUserData::Create() {
}
SerializableUserDataImpl::SerializableUserDataImpl()
- : data_(@{}), legacy_key_conversions_(@{
- @"tabId" : @"TabID",
- @"openerId" : @"OpenerID",
- @"openerNavigationIndex" : @"OpenerNavigationIndex",
- @"lastVisitedTimestamp" : @"LastVisitedTimestamp",
- }) {}
+ : data_(@{}), legacy_key_conversions_(GetLegacyKeyConversion()) {}
SerializableUserDataImpl::~SerializableUserDataImpl() {}
« no previous file with comments | « ios/chrome/test/data/sessions/session_m58.plist ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698