| 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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 | 204 |
| 205 } // namespace | 205 } // namespace |
| 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 /*has_fetch_action=*/true, |
| 215 // the kFetchMoreFeature flag. See https://crbug.com/667752 | |
| 216 /*has_more_action=*/true, | |
| 217 /*has_reload_action=*/true, | |
| 218 /*has_view_all_action=*/false, | 215 /*has_view_all_action=*/false, |
| 219 /*show_if_empty=*/true, | 216 /*show_if_empty=*/true, |
| 220 l10n_util::GetStringUTF16(IDS_NTP_ARTICLE_SUGGESTIONS_SECTION_EMPTY)); | 217 l10n_util::GetStringUTF16(IDS_NTP_ARTICLE_SUGGESTIONS_SECTION_EMPTY)); |
| 221 } | 218 } |
| 222 | 219 |
| 223 CategoryInfo BuildRemoteCategoryInfo(const base::string16& title, | 220 CategoryInfo BuildRemoteCategoryInfo(const base::string16& title, |
| 224 bool allow_fetching_more_results) { | 221 bool allow_fetching_more_results) { |
| 225 return CategoryInfo( | 222 return CategoryInfo( |
| 226 title, ContentSuggestionsCardLayout::FULL_CARD, | 223 title, ContentSuggestionsCardLayout::FULL_CARD, |
| 227 // TODO(dgn): merge has_more_action and has_reload_action when we remove | 224 /*has_fetch_action=*/allow_fetching_more_results, |
| 228 // the kFetchMoreFeature flag. See https://crbug.com/667752 | |
| 229 /*has_more_action=*/allow_fetching_more_results, | |
| 230 /*has_reload_action=*/allow_fetching_more_results, | |
| 231 /*has_view_all_action=*/false, | 225 /*has_view_all_action=*/false, |
| 232 /*show_if_empty=*/false, | 226 /*show_if_empty=*/false, |
| 233 // TODO(tschumann): The message for no-articles is likely wrong | 227 // TODO(tschumann): The message for no-articles is likely wrong |
| 234 // and needs to be added to the stubby protocol if we want to | 228 // and needs to be added to the stubby protocol if we want to |
| 235 // support it. | 229 // support it. |
| 236 l10n_util::GetStringUTF16(IDS_NTP_ARTICLE_SUGGESTIONS_SECTION_EMPTY)); | 230 l10n_util::GetStringUTF16(IDS_NTP_ARTICLE_SUGGESTIONS_SECTION_EMPTY)); |
| 237 } | 231 } |
| 238 | 232 |
| 239 RemoteSuggestionsFetcher::FetchedCategory::FetchedCategory(Category c, | 233 RemoteSuggestionsFetcher::FetchedCategory::FetchedCategory(Category c, |
| 240 CategoryInfo&& info) | 234 CategoryInfo&& info) |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 621 break; | 615 break; |
| 622 case Personalization::kNonPersonal: | 616 case Personalization::kNonPersonal: |
| 623 return "Only non-personalized"; | 617 return "Only non-personalized"; |
| 624 break; | 618 break; |
| 625 } | 619 } |
| 626 NOTREACHED(); | 620 NOTREACHED(); |
| 627 return std::string(); | 621 return std::string(); |
| 628 } | 622 } |
| 629 | 623 |
| 630 } // namespace ntp_snippets | 624 } // namespace ntp_snippets |
| OLD | NEW |