| 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/json_request.h" | 5 #include "components/ntp_snippets/remote/json_request.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 | 134 |
| 135 CategoryInfo BuildArticleCategoryInfo( | 135 CategoryInfo BuildArticleCategoryInfo( |
| 136 const base::Optional<base::string16>& title) { | 136 const base::Optional<base::string16>& title) { |
| 137 return CategoryInfo( | 137 return CategoryInfo( |
| 138 title.has_value() ? title.value() | 138 title.has_value() ? title.value() |
| 139 : l10n_util::GetStringUTF16( | 139 : l10n_util::GetStringUTF16( |
| 140 IDS_NTP_ARTICLE_SUGGESTIONS_SECTION_HEADER), | 140 IDS_NTP_ARTICLE_SUGGESTIONS_SECTION_HEADER), |
| 141 ContentSuggestionsCardLayout::FULL_CARD, | 141 ContentSuggestionsCardLayout::FULL_CARD, |
| 142 // TODO(dgn): merge has_more_action and has_reload_action when we remove | 142 // TODO(dgn): merge has_more_action and has_reload_action when we remove |
| 143 // the kFetchMoreFeature flag. See https://crbug.com/667752 | 143 // the kFetchMoreFeature flag. See https://crbug.com/667752 |
| 144 /*has_more_action=*/base::FeatureList::IsEnabled(kFetchMoreFeature), | 144 /*has_more_action=*/true, |
| 145 /*has_reload_action=*/true, | 145 /*has_reload_action=*/true, |
| 146 /*has_view_all_action=*/false, | 146 /*has_view_all_action=*/false, |
| 147 /*show_if_empty=*/true, | 147 /*show_if_empty=*/true, |
| 148 l10n_util::GetStringUTF16(IDS_NTP_ARTICLE_SUGGESTIONS_SECTION_EMPTY)); | 148 l10n_util::GetStringUTF16(IDS_NTP_ARTICLE_SUGGESTIONS_SECTION_EMPTY)); |
| 149 } | 149 } |
| 150 | 150 |
| 151 CategoryInfo BuildRemoteCategoryInfo(const base::string16& title, | 151 CategoryInfo BuildRemoteCategoryInfo(const base::string16& title, |
| 152 bool allow_fetching_more_results) { | 152 bool allow_fetching_more_results) { |
| 153 return CategoryInfo( | 153 return CategoryInfo( |
| 154 title, ContentSuggestionsCardLayout::FULL_CARD, | 154 title, ContentSuggestionsCardLayout::FULL_CARD, |
| 155 // TODO(dgn): merge has_more_action and has_reload_action when we remove | 155 // TODO(dgn): merge has_more_action and has_reload_action when we remove |
| 156 // the kFetchMoreFeature flag. See https://crbug.com/667752 | 156 // the kFetchMoreFeature flag. See https://crbug.com/667752 |
| 157 /*has_more_action=*/allow_fetching_more_results && | 157 /*has_more_action=*/allow_fetching_more_results, |
| 158 base::FeatureList::IsEnabled(kFetchMoreFeature), | |
| 159 /*has_reload_action=*/allow_fetching_more_results, | 158 /*has_reload_action=*/allow_fetching_more_results, |
| 160 /*has_view_all_action=*/false, | 159 /*has_view_all_action=*/false, |
| 161 /*show_if_empty=*/false, | 160 /*show_if_empty=*/false, |
| 162 // TODO(tschumann): The message for no-articles is likely wrong | 161 // TODO(tschumann): The message for no-articles is likely wrong |
| 163 // and needs to be added to the stubby protocol if we want to | 162 // and needs to be added to the stubby protocol if we want to |
| 164 // support it. | 163 // support it. |
| 165 l10n_util::GetStringUTF16(IDS_NTP_ARTICLE_SUGGESTIONS_SECTION_EMPTY)); | 164 l10n_util::GetStringUTF16(IDS_NTP_ARTICLE_SUGGESTIONS_SECTION_EMPTY)); |
| 166 } | 165 } |
| 167 | 166 |
| 168 JsonRequest::JsonRequest( | 167 JsonRequest::JsonRequest( |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 "NewTabPage.Languages.UILanguageRatioInTwoTopLanguages", | 502 "NewTabPage.Languages.UILanguageRatioInTwoTopLanguages", |
| 504 ratio_ui_in_both_languages * 100); | 503 ratio_ui_in_both_languages * 100); |
| 505 break; | 504 break; |
| 506 } | 505 } |
| 507 } | 506 } |
| 508 } | 507 } |
| 509 | 508 |
| 510 } // namespace internal | 509 } // namespace internal |
| 511 | 510 |
| 512 } // namespace ntp_snippets | 511 } // namespace ntp_snippets |
| OLD | NEW |