| 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/ios/ios_serialized_navigation_builder.h" | 5 #include "components/sessions/ios/ios_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 "ios/web/public/favicon_status.h" | 8 #include "ios/web/public/favicon_status.h" |
| 9 #include "ios/web/public/navigation_item.h" | 9 #include "ios/web/public/navigation_item.h" |
| 10 #include "ios/web/public/referrer.h" | 10 #include "ios/web/public/referrer.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 navigation.title_ = item.GetTitle(); | 24 navigation.title_ = item.GetTitle(); |
| 25 navigation.transition_type_ = item.GetTransitionType(); | 25 navigation.transition_type_ = item.GetTransitionType(); |
| 26 navigation.timestamp_ = item.GetTimestamp(); | 26 navigation.timestamp_ = item.GetTimestamp(); |
| 27 if (item.GetFavicon().valid) | 27 if (item.GetFavicon().valid) |
| 28 navigation.favicon_url_ = item.GetFavicon().url; | 28 navigation.favicon_url_ = item.GetFavicon().url; |
| 29 | 29 |
| 30 return navigation; | 30 return navigation; |
| 31 } | 31 } |
| 32 | 32 |
| 33 // static | 33 // static |
| 34 scoped_ptr<web::NavigationItem> | 34 std::unique_ptr<web::NavigationItem> |
| 35 IOSSerializedNavigationBuilder::ToNavigationItem( | 35 IOSSerializedNavigationBuilder::ToNavigationItem( |
| 36 const SerializedNavigationEntry* navigation) { | 36 const SerializedNavigationEntry* navigation) { |
| 37 scoped_ptr<web::NavigationItem> item(web::NavigationItem::Create()); | 37 std::unique_ptr<web::NavigationItem> item(web::NavigationItem::Create()); |
| 38 | 38 |
| 39 item->SetURL(navigation->virtual_url_); | 39 item->SetURL(navigation->virtual_url_); |
| 40 item->SetReferrer(web::Referrer( | 40 item->SetReferrer(web::Referrer( |
| 41 navigation->referrer_url_, | 41 navigation->referrer_url_, |
| 42 static_cast<web::ReferrerPolicy>(navigation->referrer_policy_))); | 42 static_cast<web::ReferrerPolicy>(navigation->referrer_policy_))); |
| 43 item->SetTitle(navigation->title_); | 43 item->SetTitle(navigation->title_); |
| 44 item->SetTransitionType(ui::PAGE_TRANSITION_RELOAD); | 44 item->SetTransitionType(ui::PAGE_TRANSITION_RELOAD); |
| 45 item->SetTimestamp(navigation->timestamp_); | 45 item->SetTimestamp(navigation->timestamp_); |
| 46 | 46 |
| 47 if (navigation->favicon_url_.is_valid()) { | 47 if (navigation->favicon_url_.is_valid()) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 58 ScopedVector<web::NavigationItem> items; | 58 ScopedVector<web::NavigationItem> items; |
| 59 for (std::vector<SerializedNavigationEntry>::const_iterator it = | 59 for (std::vector<SerializedNavigationEntry>::const_iterator it = |
| 60 navigations.begin(); | 60 navigations.begin(); |
| 61 it != navigations.end(); ++it) { | 61 it != navigations.end(); ++it) { |
| 62 items.push_back(ToNavigationItem(&(*it)).release()); | 62 items.push_back(ToNavigationItem(&(*it)).release()); |
| 63 } | 63 } |
| 64 return items; | 64 return items; |
| 65 } | 65 } |
| 66 | 66 |
| 67 } // namespace sessions | 67 } // namespace sessions |
| OLD | NEW |