OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/ntp_snippets_service.h" | 5 #include "components/ntp_snippets/ntp_snippets_service.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <iterator> | 8 #include <iterator> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 } | 280 } |
281 | 281 |
282 CategoryStatus NTPSnippetsService::GetCategoryStatus(Category category) { | 282 CategoryStatus NTPSnippetsService::GetCategoryStatus(Category category) { |
283 DCHECK(category.IsKnownCategory(KnownCategories::ARTICLES)); | 283 DCHECK(category.IsKnownCategory(KnownCategories::ARTICLES)); |
284 return category_status_; | 284 return category_status_; |
285 } | 285 } |
286 | 286 |
287 CategoryInfo NTPSnippetsService::GetCategoryInfo(Category category) { | 287 CategoryInfo NTPSnippetsService::GetCategoryInfo(Category category) { |
288 return CategoryInfo( | 288 return CategoryInfo( |
289 l10n_util::GetStringUTF16(IDS_NTP_ARTICLE_SUGGESTIONS_SECTION_HEADER), | 289 l10n_util::GetStringUTF16(IDS_NTP_ARTICLE_SUGGESTIONS_SECTION_HEADER), |
290 ContentSuggestionsCardLayout::FULL_CARD, /* has_more_button */ false); | 290 ContentSuggestionsCardLayout::FULL_CARD, |
| 291 /* has_more_button */ false, |
| 292 /* show_if_empty */ true); |
291 } | 293 } |
292 | 294 |
293 void NTPSnippetsService::DismissSuggestion(const std::string& suggestion_id) { | 295 void NTPSnippetsService::DismissSuggestion(const std::string& suggestion_id) { |
294 if (!ready()) | 296 if (!ready()) |
295 return; | 297 return; |
296 | 298 |
297 std::string snippet_id = GetWithinCategoryIDFromUniqueID(suggestion_id); | 299 std::string snippet_id = GetWithinCategoryIDFromUniqueID(suggestion_id); |
298 | 300 |
299 auto it = | 301 auto it = |
300 std::find_if(snippets_.begin(), snippets_.end(), | 302 std::find_if(snippets_.begin(), snippets_.end(), |
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
839 void NTPSnippetsService::UpdateCategoryStatus(CategoryStatus status) { | 841 void NTPSnippetsService::UpdateCategoryStatus(CategoryStatus status) { |
840 if (status == category_status_) | 842 if (status == category_status_) |
841 return; | 843 return; |
842 | 844 |
843 category_status_ = status; | 845 category_status_ = status; |
844 observer()->OnCategoryStatusChanged(this, provided_category_, | 846 observer()->OnCategoryStatusChanged(this, provided_category_, |
845 category_status_); | 847 category_status_); |
846 } | 848 } |
847 | 849 |
848 } // namespace ntp_snippets | 850 } // namespace ntp_snippets |
OLD | NEW |