| 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/sessions/foreign_sessions_suggestions_provider
.h" | 5 #include "components/ntp_snippets/sessions/foreign_sessions_suggestions_provider
.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <tuple> | 9 #include <tuple> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 DCHECK_EQ(category, provided_category_); | 192 DCHECK_EQ(category, provided_category_); |
| 193 return category_status_; | 193 return category_status_; |
| 194 } | 194 } |
| 195 | 195 |
| 196 CategoryInfo ForeignSessionsSuggestionsProvider::GetCategoryInfo( | 196 CategoryInfo ForeignSessionsSuggestionsProvider::GetCategoryInfo( |
| 197 Category category) { | 197 Category category) { |
| 198 DCHECK_EQ(category, provided_category_); | 198 DCHECK_EQ(category, provided_category_); |
| 199 return CategoryInfo(l10n_util::GetStringUTF16( | 199 return CategoryInfo(l10n_util::GetStringUTF16( |
| 200 IDS_NTP_FOREIGN_SESSIONS_SUGGESTIONS_SECTION_HEADER), | 200 IDS_NTP_FOREIGN_SESSIONS_SUGGESTIONS_SECTION_HEADER), |
| 201 ContentSuggestionsCardLayout::MINIMAL_CARD, | 201 ContentSuggestionsCardLayout::MINIMAL_CARD, |
| 202 /*has_more_action=*/false, | 202 /*has_fetch_action=*/false, |
| 203 /*has_reload_action=*/false, | |
| 204 /*has_view_all_action=*/true, | 203 /*has_view_all_action=*/true, |
| 205 /*show_if_empty=*/false, | 204 /*show_if_empty=*/false, |
| 206 l10n_util::GetStringUTF16( | 205 l10n_util::GetStringUTF16( |
| 207 IDS_NTP_FOREIGN_SESSIONS_SUGGESTIONS_SECTION_EMPTY)); | 206 IDS_NTP_FOREIGN_SESSIONS_SUGGESTIONS_SECTION_EMPTY)); |
| 208 } | 207 } |
| 209 | 208 |
| 210 void ForeignSessionsSuggestionsProvider::DismissSuggestion( | 209 void ForeignSessionsSuggestionsProvider::DismissSuggestion( |
| 211 const ContentSuggestion::ID& suggestion_id) { | 210 const ContentSuggestion::ID& suggestion_id) { |
| 212 // Assume this suggestion is still valid, and blindly add it to dismissals. | 211 // Assume this suggestion is still valid, and blindly add it to dismissals. |
| 213 // Pruning will happen the next time we are asked to suggest. | 212 // Pruning will happen the next time we are asked to suggest. |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 data.navigation->virtual_url().spec(), | 399 data.navigation->virtual_url().spec(), |
| 401 data.navigation->virtual_url()); | 400 data.navigation->virtual_url()); |
| 402 suggestion.set_title(data.navigation->title()); | 401 suggestion.set_title(data.navigation->title()); |
| 403 suggestion.set_publish_date(data.tab->timestamp); | 402 suggestion.set_publish_date(data.tab->timestamp); |
| 404 suggestion.set_publisher_name( | 403 suggestion.set_publisher_name( |
| 405 base::UTF8ToUTF16(data.navigation->virtual_url().host())); | 404 base::UTF8ToUTF16(data.navigation->virtual_url().host())); |
| 406 return suggestion; | 405 return suggestion; |
| 407 } | 406 } |
| 408 | 407 |
| 409 } // namespace ntp_snippets | 408 } // namespace ntp_snippets |
| OLD | NEW |