OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/content/content_serialized_navigation_builder.h" | 5 #include "components/sessions/content/content_serialized_navigation_builder.h" |
6 | 6 |
7 #include "components/sessions/serialized_navigation_entry.h" | 7 #include "components/sessions/serialized_navigation_entry.h" |
8 #include "content/public/browser/browser_context.h" | 8 #include "content/public/browser/browser_context.h" |
9 #include "content/public/browser/favicon_status.h" | 9 #include "content/public/browser/favicon_status.h" |
10 #include "content/public/browser/navigation_controller.h" | 10 #include "content/public/browser/navigation_controller.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 scoped_ptr<content::NavigationEntry> | 50 scoped_ptr<content::NavigationEntry> |
51 ContentSerializedNavigationBuilder::ToNavigationEntry( | 51 ContentSerializedNavigationBuilder::ToNavigationEntry( |
52 const SerializedNavigationEntry* navigation, | 52 const SerializedNavigationEntry* navigation, |
53 int page_id, | 53 int page_id, |
54 content::BrowserContext* browser_context) { | 54 content::BrowserContext* browser_context) { |
55 blink::WebReferrerPolicy policy = | 55 blink::WebReferrerPolicy policy = |
56 static_cast<blink::WebReferrerPolicy>(navigation->referrer_policy_); | 56 static_cast<blink::WebReferrerPolicy>(navigation->referrer_policy_); |
57 scoped_ptr<content::NavigationEntry> entry( | 57 scoped_ptr<content::NavigationEntry> entry( |
58 content::NavigationController::CreateNavigationEntry( | 58 content::NavigationController::CreateNavigationEntry( |
59 navigation->virtual_url_, | 59 navigation->virtual_url_, |
60 content::Referrer(navigation->referrer_url_, policy), | 60 content::Referrer::SanitizeForRequest( |
| 61 navigation->virtual_url_, |
| 62 content::Referrer(navigation->referrer_url_, policy)), |
61 // Use a transition type of reload so that we don't incorrectly | 63 // Use a transition type of reload so that we don't incorrectly |
62 // increase the typed count. | 64 // increase the typed count. |
63 ui::PAGE_TRANSITION_RELOAD, | 65 ui::PAGE_TRANSITION_RELOAD, false, |
64 false, | |
65 // The extra headers are not sync'ed across sessions. | 66 // The extra headers are not sync'ed across sessions. |
66 std::string(), | 67 std::string(), browser_context)); |
67 browser_context)); | |
68 | 68 |
69 entry->SetTitle(navigation->title_); | 69 entry->SetTitle(navigation->title_); |
70 entry->SetPageState(content::PageState::CreateFromEncodedData( | 70 entry->SetPageState(content::PageState::CreateFromEncodedData( |
71 navigation->encoded_page_state_)); | 71 navigation->encoded_page_state_)); |
72 entry->SetPageID(page_id); | 72 entry->SetPageID(page_id); |
73 entry->SetHasPostData(navigation->has_post_data_); | 73 entry->SetHasPostData(navigation->has_post_data_); |
74 entry->SetPostID(navigation->post_id_); | 74 entry->SetPostID(navigation->post_id_); |
75 entry->SetOriginalRequestURL(navigation->original_request_url_); | 75 entry->SetOriginalRequestURL(navigation->original_request_url_); |
76 entry->SetIsOverridingUserAgent(navigation->is_overriding_user_agent_); | 76 entry->SetIsOverridingUserAgent(navigation->is_overriding_user_agent_); |
77 entry->SetTimestamp(navigation->timestamp_); | 77 entry->SetTimestamp(navigation->timestamp_); |
(...skipping 19 matching lines...) Expand all Loading... |
97 for (std::vector<SerializedNavigationEntry>::const_iterator | 97 for (std::vector<SerializedNavigationEntry>::const_iterator |
98 it = navigations.begin(); it != navigations.end(); ++it) { | 98 it = navigations.begin(); it != navigations.end(); ++it) { |
99 entries.push_back( | 99 entries.push_back( |
100 ToNavigationEntry(&(*it), page_id, browser_context).release()); | 100 ToNavigationEntry(&(*it), page_id, browser_context).release()); |
101 ++page_id; | 101 ++page_id; |
102 } | 102 } |
103 return entries.Pass(); | 103 return entries.Pass(); |
104 } | 104 } |
105 | 105 |
106 } // namespace sessions | 106 } // namespace sessions |
OLD | NEW |