| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/ntp_snippets/content_suggestion.h" | 5 #include "components/ntp_snippets/content_suggestion.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 namespace ntp_snippets { | 9 namespace ntp_snippets { |
| 10 | 10 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 | 36 |
| 37 ContentSuggestion& ContentSuggestion::operator=(ContentSuggestion&&) = default; | 37 ContentSuggestion& ContentSuggestion::operator=(ContentSuggestion&&) = default; |
| 38 | 38 |
| 39 ContentSuggestion::~ContentSuggestion() = default; | 39 ContentSuggestion::~ContentSuggestion() = default; |
| 40 | 40 |
| 41 std::ostream& operator<<(std::ostream& os, const ContentSuggestion::ID& id) { | 41 std::ostream& operator<<(std::ostream& os, const ContentSuggestion::ID& id) { |
| 42 os << id.category() << "|" << id.id_within_category(); | 42 os << id.category() << "|" << id.id_within_category(); |
| 43 return os; | 43 return os; |
| 44 } | 44 } |
| 45 | 45 |
| 46 // static |
| 47 GURL ContentSuggestion::GetFaviconDomain(const GURL& favicon_url) { |
| 48 return favicon_url.GetWithEmptyPath(); |
| 49 } |
| 50 |
| 46 void ContentSuggestion::set_download_suggestion_extra( | 51 void ContentSuggestion::set_download_suggestion_extra( |
| 47 std::unique_ptr<DownloadSuggestionExtra> download_suggestion_extra) { | 52 std::unique_ptr<DownloadSuggestionExtra> download_suggestion_extra) { |
| 48 DCHECK(id_.category().IsKnownCategory(KnownCategories::DOWNLOADS)); | 53 DCHECK(id_.category().IsKnownCategory(KnownCategories::DOWNLOADS)); |
| 49 download_suggestion_extra_ = std::move(download_suggestion_extra); | 54 download_suggestion_extra_ = std::move(download_suggestion_extra); |
| 50 } | 55 } |
| 51 | 56 |
| 52 void ContentSuggestion::set_recent_tab_suggestion_extra( | 57 void ContentSuggestion::set_recent_tab_suggestion_extra( |
| 53 std::unique_ptr<RecentTabSuggestionExtra> recent_tab_suggestion_extra) { | 58 std::unique_ptr<RecentTabSuggestionExtra> recent_tab_suggestion_extra) { |
| 54 DCHECK(id_.category().IsKnownCategory(KnownCategories::RECENT_TABS)); | 59 DCHECK(id_.category().IsKnownCategory(KnownCategories::RECENT_TABS)); |
| 55 recent_tab_suggestion_extra_ = std::move(recent_tab_suggestion_extra); | 60 recent_tab_suggestion_extra_ = std::move(recent_tab_suggestion_extra); |
| 56 } | 61 } |
| 57 | 62 |
| 58 void ContentSuggestion::set_reading_list_suggestion_extra( | 63 void ContentSuggestion::set_reading_list_suggestion_extra( |
| 59 std::unique_ptr<ReadingListSuggestionExtra> reading_list_suggestion_extra) { | 64 std::unique_ptr<ReadingListSuggestionExtra> reading_list_suggestion_extra) { |
| 60 DCHECK(id_.category().IsKnownCategory(KnownCategories::READING_LIST)); | 65 DCHECK(id_.category().IsKnownCategory(KnownCategories::READING_LIST)); |
| 61 reading_list_suggestion_extra_ = std::move(reading_list_suggestion_extra); | 66 reading_list_suggestion_extra_ = std::move(reading_list_suggestion_extra); |
| 62 } | 67 } |
| 63 | 68 |
| 64 void ContentSuggestion::set_notification_extra( | 69 void ContentSuggestion::set_notification_extra( |
| 65 std::unique_ptr<NotificationExtra> notification_extra) { | 70 std::unique_ptr<NotificationExtra> notification_extra) { |
| 66 notification_extra_ = std::move(notification_extra); | 71 notification_extra_ = std::move(notification_extra); |
| 67 } | 72 } |
| 68 | 73 |
| 69 } // namespace ntp_snippets | 74 } // namespace ntp_snippets |
| OLD | NEW |