| 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/remote/remote_suggestions_fetcher.h" | 5 #include "components/ntp_snippets/remote/remote_suggestions_fetcher.h" |
| 6 | 6 |
| 7 #include <cstdlib> | 7 #include <cstdlib> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 | 206 |
| 207 CategoryInfo BuildArticleCategoryInfo( | 207 CategoryInfo BuildArticleCategoryInfo( |
| 208 const base::Optional<base::string16>& title) { | 208 const base::Optional<base::string16>& title) { |
| 209 return CategoryInfo( | 209 return CategoryInfo( |
| 210 title.has_value() ? title.value() | 210 title.has_value() ? title.value() |
| 211 : l10n_util::GetStringUTF16( | 211 : l10n_util::GetStringUTF16( |
| 212 IDS_NTP_ARTICLE_SUGGESTIONS_SECTION_HEADER), | 212 IDS_NTP_ARTICLE_SUGGESTIONS_SECTION_HEADER), |
| 213 ContentSuggestionsCardLayout::FULL_CARD, | 213 ContentSuggestionsCardLayout::FULL_CARD, |
| 214 // TODO(dgn): merge has_more_action and has_reload_action when we remove | 214 // TODO(dgn): merge has_more_action and has_reload_action when we remove |
| 215 // the kFetchMoreFeature flag. See https://crbug.com/667752 | 215 // the kFetchMoreFeature flag. See https://crbug.com/667752 |
| 216 /*has_more_action=*/base::FeatureList::IsEnabled(kFetchMoreFeature), | 216 /*has_more_action=*/true, |
| 217 /*has_reload_action=*/true, | 217 /*has_reload_action=*/true, |
| 218 /*has_view_all_action=*/false, | 218 /*has_view_all_action=*/false, |
| 219 /*show_if_empty=*/true, | 219 /*show_if_empty=*/true, |
| 220 l10n_util::GetStringUTF16(IDS_NTP_ARTICLE_SUGGESTIONS_SECTION_EMPTY)); | 220 l10n_util::GetStringUTF16(IDS_NTP_ARTICLE_SUGGESTIONS_SECTION_EMPTY)); |
| 221 } | 221 } |
| 222 | 222 |
| 223 CategoryInfo BuildRemoteCategoryInfo(const base::string16& title, | 223 CategoryInfo BuildRemoteCategoryInfo(const base::string16& title, |
| 224 bool allow_fetching_more_results) { | 224 bool allow_fetching_more_results) { |
| 225 return CategoryInfo( | 225 return CategoryInfo( |
| 226 title, ContentSuggestionsCardLayout::FULL_CARD, | 226 title, ContentSuggestionsCardLayout::FULL_CARD, |
| 227 // TODO(dgn): merge has_more_action and has_reload_action when we remove | 227 // TODO(dgn): merge has_more_action and has_reload_action when we remove |
| 228 // the kFetchMoreFeature flag. See https://crbug.com/667752 | 228 // the kFetchMoreFeature flag. See https://crbug.com/667752 |
| 229 /*has_more_action=*/allow_fetching_more_results && | 229 /*has_more_action=*/allow_fetching_more_results, |
| 230 base::FeatureList::IsEnabled(kFetchMoreFeature), | |
| 231 /*has_reload_action=*/allow_fetching_more_results, | 230 /*has_reload_action=*/allow_fetching_more_results, |
| 232 /*has_view_all_action=*/false, | 231 /*has_view_all_action=*/false, |
| 233 /*show_if_empty=*/false, | 232 /*show_if_empty=*/false, |
| 234 // TODO(tschumann): The message for no-articles is likely wrong | 233 // TODO(tschumann): The message for no-articles is likely wrong |
| 235 // and needs to be added to the stubby protocol if we want to | 234 // and needs to be added to the stubby protocol if we want to |
| 236 // support it. | 235 // support it. |
| 237 l10n_util::GetStringUTF16(IDS_NTP_ARTICLE_SUGGESTIONS_SECTION_EMPTY)); | 236 l10n_util::GetStringUTF16(IDS_NTP_ARTICLE_SUGGESTIONS_SECTION_EMPTY)); |
| 238 } | 237 } |
| 239 | 238 |
| 240 RemoteSuggestionsFetcher::FetchedCategory::FetchedCategory(Category c, | 239 RemoteSuggestionsFetcher::FetchedCategory::FetchedCategory(Category c, |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 break; | 621 break; |
| 623 case Personalization::kNonPersonal: | 622 case Personalization::kNonPersonal: |
| 624 return "Only non-personalized"; | 623 return "Only non-personalized"; |
| 625 break; | 624 break; |
| 626 } | 625 } |
| 627 NOTREACHED(); | 626 NOTREACHED(); |
| 628 return std::string(); | 627 return std::string(); |
| 629 } | 628 } |
| 630 | 629 |
| 631 } // namespace ntp_snippets | 630 } // namespace ntp_snippets |
| OLD | NEW |