Index: components/sessions/core/serialized_navigation_entry.cc |
diff --git a/components/sessions/core/serialized_navigation_entry.cc b/components/sessions/core/serialized_navigation_entry.cc |
index 4f4124c598a5e7c50be2ed812a71946ec0aa6b33..02139965c445f9757dadd9b1bae718f0597034b3 100644 |
--- a/components/sessions/core/serialized_navigation_entry.cc |
+++ b/components/sessions/core/serialized_navigation_entry.cc |
@@ -182,6 +182,17 @@ void WriteString16ToPickle(base::Pickle* pickle, |
} |
} |
+void WriteStringMapToPickle(base::Pickle* pickle, |
+ int* bytes_written, |
+ int max_bytes, |
+ const std::map<std::string, std::string>& map) { |
+ pickle->WriteInt(map.size()); |
+ for (const auto entry : map) { |
+ WriteStringToPickle(pickle, bytes_written, max_bytes, entry.first); |
+ WriteStringToPickle(pickle, bytes_written, max_bytes, entry.second); |
+ } |
+} |
+ |
// A mask used for arbitrary boolean values needed to represent a |
// NavigationEntry. Currently only contains HAS_POST_DATA. |
// |
@@ -213,6 +224,7 @@ enum TypeMask { |
// search_terms_ |
// http_status_code_ |
// referrer_policy_ |
+// extended_info_map_ |
void SerializedNavigationEntry::WriteToPickle(int max_size, |
base::Pickle* pickle) const { |
@@ -257,6 +269,8 @@ void SerializedNavigationEntry::WriteToPickle(int max_size, |
pickle->WriteInt(http_status_code_); |
pickle->WriteInt(referrer_policy_); |
+ |
+ WriteStringMapToPickle(pickle, &bytes_written, max_size, extended_info_map_); |
} |
bool SerializedNavigationEntry::ReadFromPickle(base::PickleIterator* iterator) { |
@@ -335,6 +349,19 @@ bool SerializedNavigationEntry::ReadFromPickle(base::PickleIterator* iterator) { |
SerializedNavigationDriver::Get()->StripReferrerFromPageState( |
encoded_page_state_); |
} |
+ |
+ int extended_info_map_size = 0; |
+ if (iterator->ReadInt(&extended_info_map_size) && |
+ extended_info_map_size >= 0) { |
+ for (int i = 0; i < extended_info_map_size; ++i) { |
+ std::string key; |
+ std::string value; |
+ if (iterator->ReadString(&key) && iterator->ReadString(&value)) |
+ extended_info_map_[key] = value; |
+ } |
+ } else { |
+ extended_info_map_.clear(); |
+ } |
} |
SerializedNavigationDriver::Get()->Sanitize(this); |