| 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/remote/ntp_snippets_service.h" | 5 #include "components/ntp_snippets/remote/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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 } | 306 } |
| 307 | 307 |
| 308 CategoryStatus NTPSnippetsService::GetCategoryStatus(Category category) { | 308 CategoryStatus NTPSnippetsService::GetCategoryStatus(Category category) { |
| 309 DCHECK(base::ContainsKey(categories_, category)); | 309 DCHECK(base::ContainsKey(categories_, category)); |
| 310 return categories_[category].status; | 310 return categories_[category].status; |
| 311 } | 311 } |
| 312 | 312 |
| 313 CategoryInfo NTPSnippetsService::GetCategoryInfo(Category category) { | 313 CategoryInfo NTPSnippetsService::GetCategoryInfo(Category category) { |
| 314 DCHECK(base::ContainsKey(categories_, category)); | 314 DCHECK(base::ContainsKey(categories_, category)); |
| 315 const CategoryContent& content = categories_[category]; | 315 const CategoryContent& content = categories_[category]; |
| 316 return CategoryInfo(content.localized_title, | 316 return CategoryInfo( |
| 317 ContentSuggestionsCardLayout::FULL_CARD, | 317 content.localized_title, ContentSuggestionsCardLayout::FULL_CARD, |
| 318 /*has_more_button=*/false, | 318 /*has_more_button=*/false, |
| 319 /*show_if_empty=*/true); | 319 /*show_if_empty=*/true, |
| 320 l10n_util::GetStringUTF16(IDS_NTP_ARTICLE_SUGGESTIONS_SECTION_EMPTY)); |
| 320 } | 321 } |
| 321 | 322 |
| 322 void NTPSnippetsService::DismissSuggestion( | 323 void NTPSnippetsService::DismissSuggestion( |
| 323 const ContentSuggestion::ID& suggestion_id) { | 324 const ContentSuggestion::ID& suggestion_id) { |
| 324 if (!ready()) | 325 if (!ready()) |
| 325 return; | 326 return; |
| 326 | 327 |
| 327 DCHECK(base::ContainsKey(categories_, suggestion_id.category())); | 328 DCHECK(base::ContainsKey(categories_, suggestion_id.category())); |
| 328 | 329 |
| 329 CategoryContent* content = &categories_[suggestion_id.category()]; | 330 CategoryContent* content = &categories_[suggestion_id.category()]; |
| (...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1109 } | 1110 } |
| 1110 | 1111 |
| 1111 NTPSnippetsService::CategoryContent::CategoryContent() = default; | 1112 NTPSnippetsService::CategoryContent::CategoryContent() = default; |
| 1112 NTPSnippetsService::CategoryContent::CategoryContent(CategoryContent&&) = | 1113 NTPSnippetsService::CategoryContent::CategoryContent(CategoryContent&&) = |
| 1113 default; | 1114 default; |
| 1114 NTPSnippetsService::CategoryContent::~CategoryContent() = default; | 1115 NTPSnippetsService::CategoryContent::~CategoryContent() = default; |
| 1115 NTPSnippetsService::CategoryContent& NTPSnippetsService::CategoryContent:: | 1116 NTPSnippetsService::CategoryContent& NTPSnippetsService::CategoryContent:: |
| 1116 operator=(CategoryContent&&) = default; | 1117 operator=(CategoryContent&&) = default; |
| 1117 | 1118 |
| 1118 } // namespace ntp_snippets | 1119 } // namespace ntp_snippets |
| OLD | NEW |