OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/sessions/core/serialized_navigation_entry.h" | 5 #include "components/sessions/core/serialized_navigation_entry.h" |
6 | 6 |
7 #include "base/pickle.h" | 7 #include "base/pickle.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "components/sessions/core/serialized_navigation_driver.h" | 9 #include "components/sessions/core/serialized_navigation_driver.h" |
10 #include "sync/protocol/session_specifics.pb.h" | 10 #include "sync/protocol/session_specifics.pb.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 } | 29 } |
30 | 30 |
31 SerializedNavigationEntry::~SerializedNavigationEntry() {} | 31 SerializedNavigationEntry::~SerializedNavigationEntry() {} |
32 | 32 |
33 SerializedNavigationEntry SerializedNavigationEntry::FromSyncData( | 33 SerializedNavigationEntry SerializedNavigationEntry::FromSyncData( |
34 int index, | 34 int index, |
35 const sync_pb::TabNavigation& sync_data) { | 35 const sync_pb::TabNavigation& sync_data) { |
36 SerializedNavigationEntry navigation; | 36 SerializedNavigationEntry navigation; |
37 navigation.index_ = index; | 37 navigation.index_ = index; |
38 navigation.unique_id_ = sync_data.unique_id(); | 38 navigation.unique_id_ = sync_data.unique_id(); |
39 navigation.encoded_page_state_ = sync_data.state(); | |
40 if (sync_data.has_correct_referrer_policy()) { | 39 if (sync_data.has_correct_referrer_policy()) { |
41 navigation.referrer_url_ = GURL(sync_data.referrer()); | 40 navigation.referrer_url_ = GURL(sync_data.referrer()); |
42 navigation.referrer_policy_ = sync_data.correct_referrer_policy(); | 41 navigation.referrer_policy_ = sync_data.correct_referrer_policy(); |
43 } else { | 42 } else { |
44 int mapped_referrer_policy; | 43 int mapped_referrer_policy; |
45 if (SerializedNavigationDriver::Get()->MapReferrerPolicyToNewValues( | 44 if (SerializedNavigationDriver::Get()->MapReferrerPolicyToNewValues( |
46 sync_data.obsolete_referrer_policy(), &mapped_referrer_policy)) { | 45 sync_data.obsolete_referrer_policy(), &mapped_referrer_policy)) { |
47 navigation.referrer_url_ = GURL(sync_data.referrer()); | 46 navigation.referrer_url_ = GURL(sync_data.referrer()); |
48 } else { | 47 } else { |
49 navigation.referrer_url_ = GURL(); | 48 navigation.referrer_url_ = GURL(); |
50 } | 49 } |
51 navigation.referrer_policy_ = mapped_referrer_policy; | 50 navigation.referrer_policy_ = mapped_referrer_policy; |
52 navigation.encoded_page_state_ = | |
53 SerializedNavigationDriver::Get()->StripReferrerFromPageState( | |
54 navigation.encoded_page_state_); | |
55 } | 51 } |
56 navigation.virtual_url_ = GURL(sync_data.virtual_url()); | 52 navigation.virtual_url_ = GURL(sync_data.virtual_url()); |
57 navigation.title_ = base::UTF8ToUTF16(sync_data.title()); | 53 navigation.title_ = base::UTF8ToUTF16(sync_data.title()); |
58 | 54 |
59 uint32 transition = 0; | 55 uint32 transition = 0; |
60 if (sync_data.has_page_transition()) { | 56 if (sync_data.has_page_transition()) { |
61 switch (sync_data.page_transition()) { | 57 switch (sync_data.page_transition()) { |
62 case sync_pb::SyncEnums_PageTransition_LINK: | 58 case sync_pb::SyncEnums_PageTransition_LINK: |
63 transition = ui::PAGE_TRANSITION_LINK; | 59 transition = ui::PAGE_TRANSITION_LINK; |
64 break; | 60 break; |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 redirect_chain_[last_entry].spec()); | 460 redirect_chain_[last_entry].spec()); |
465 } | 461 } |
466 } | 462 } |
467 | 463 |
468 sync_data.set_is_restored(is_restored_); | 464 sync_data.set_is_restored(is_restored_); |
469 | 465 |
470 return sync_data; | 466 return sync_data; |
471 } | 467 } |
472 | 468 |
473 } // namespace sessions | 469 } // namespace sessions |
OLD | NEW |