| 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/core/serialized_navigation_entry.h" | 7 #include "components/sessions/core/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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 entry->SetTimestamp(navigation->timestamp_); | 74 entry->SetTimestamp(navigation->timestamp_); |
| 75 entry->SetExtraData(kSearchTermsKey, navigation->search_terms_); | 75 entry->SetExtraData(kSearchTermsKey, navigation->search_terms_); |
| 76 entry->SetHttpStatusCode(navigation->http_status_code_); | 76 entry->SetHttpStatusCode(navigation->http_status_code_); |
| 77 entry->SetRedirectChain(navigation->redirect_chain_); | 77 entry->SetRedirectChain(navigation->redirect_chain_); |
| 78 | 78 |
| 79 // These fields should have default values. | 79 // These fields should have default values. |
| 80 DCHECK_EQ(SerializedNavigationEntry::STATE_INVALID, | 80 DCHECK_EQ(SerializedNavigationEntry::STATE_INVALID, |
| 81 navigation->blocked_state_); | 81 navigation->blocked_state_); |
| 82 DCHECK_EQ(0u, navigation->content_pack_categories_.size()); | 82 DCHECK_EQ(0u, navigation->content_pack_categories_.size()); |
| 83 | 83 |
| 84 return entry.Pass(); | 84 return entry; |
| 85 } | 85 } |
| 86 | 86 |
| 87 // static | 87 // static |
| 88 std::vector<scoped_ptr<content::NavigationEntry>> | 88 std::vector<scoped_ptr<content::NavigationEntry>> |
| 89 ContentSerializedNavigationBuilder::ToNavigationEntries( | 89 ContentSerializedNavigationBuilder::ToNavigationEntries( |
| 90 const std::vector<SerializedNavigationEntry>& navigations, | 90 const std::vector<SerializedNavigationEntry>& navigations, |
| 91 content::BrowserContext* browser_context) { | 91 content::BrowserContext* browser_context) { |
| 92 int page_id = 0; | 92 int page_id = 0; |
| 93 std::vector<scoped_ptr<content::NavigationEntry>> entries; | 93 std::vector<scoped_ptr<content::NavigationEntry>> entries; |
| 94 entries.reserve(navigations.size()); | 94 entries.reserve(navigations.size()); |
| 95 for (const auto& navigation : navigations) { | 95 for (const auto& navigation : navigations) { |
| 96 entries.push_back(ToNavigationEntry(&navigation, page_id, browser_context)); | 96 entries.push_back(ToNavigationEntry(&navigation, page_id, browser_context)); |
| 97 ++page_id; | 97 ++page_id; |
| 98 } | 98 } |
| 99 return entries; | 99 return entries; |
| 100 } | 100 } |
| 101 | 101 |
| 102 } // namespace sessions | 102 } // namespace sessions |
| OLD | NEW |