| Index: components/sessions/serialized_navigation_entry.cc
|
| diff --git a/components/sessions/serialized_navigation_entry.cc b/components/sessions/serialized_navigation_entry.cc
|
| index 45f3cf03106807230c66c291e517dd45f957d1a6..5b5a8c49fd22ec39801ecdde1d5787d0162a08cb 100644
|
| --- a/components/sessions/serialized_navigation_entry.cc
|
| +++ b/components/sessions/serialized_navigation_entry.cc
|
| @@ -57,6 +57,7 @@ SerializedNavigationEntry SerializedNavigationEntry::FromNavigationEntry(
|
| if (entry.GetFavicon().valid)
|
| navigation.favicon_url_ = entry.GetFavicon().url;
|
| navigation.http_status_code_ = entry.GetHttpStatusCode();
|
| + navigation.redirect_chain_ = entry.GetRedirectChain();
|
|
|
| return navigation;
|
| }
|
| @@ -363,6 +364,7 @@ scoped_ptr<NavigationEntry> SerializedNavigationEntry::ToNavigationEntry(
|
| entry->SetTimestamp(timestamp_);
|
| entry->SetExtraData(kSearchTermsKey, search_terms_);
|
| entry->SetHttpStatusCode(http_status_code_);
|
| + entry->SetRedirectChain(redirect_chain_);
|
|
|
| // These fields should have default values.
|
| DCHECK_EQ(STATE_INVALID, blocked_state_);
|
| @@ -477,6 +479,22 @@ sync_pb::TabNavigation SerializedNavigationEntry::ToSyncData() const {
|
| sync_data.add_content_pack_categories(*it);
|
| }
|
|
|
| + // Copy all redirect chain entries except the last URL (which should match
|
| + // the virtual_url).
|
| + if (redirect_chain_.size() > 1) { // Single entry chains have no redirection.
|
| + size_t last_entry = redirect_chain_.size() - 1;
|
| + for (size_t i = 0; i < last_entry; i++) {
|
| + sync_pb::NavigationRedirect* navigation_redirect =
|
| + sync_data.add_navigation_redirect();
|
| + navigation_redirect->set_url(redirect_chain_[i].spec());
|
| + }
|
| + // If the last URL didn't match the virtual_url, record it separately.
|
| + if (sync_data.virtual_url() != redirect_chain_[last_entry].spec()) {
|
| + sync_data.set_last_navigation_redirect_url(
|
| + redirect_chain_[last_entry].spec());
|
| + }
|
| + }
|
| +
|
| sync_data.set_is_restored(is_restored_);
|
|
|
| return sync_data;
|
|
|