| 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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 } | 277 } |
| 278 | 278 |
| 279 CategoryStatus NTPSnippetsService::GetCategoryStatus(Category category) { | 279 CategoryStatus NTPSnippetsService::GetCategoryStatus(Category category) { |
| 280 DCHECK(category.IsKnownCategory(KnownCategories::ARTICLES)); | 280 DCHECK(category.IsKnownCategory(KnownCategories::ARTICLES)); |
| 281 return category_status_; | 281 return category_status_; |
| 282 } | 282 } |
| 283 | 283 |
| 284 CategoryInfo NTPSnippetsService::GetCategoryInfo(Category category) { | 284 CategoryInfo NTPSnippetsService::GetCategoryInfo(Category category) { |
| 285 return CategoryInfo( | 285 return CategoryInfo( |
| 286 l10n_util::GetStringUTF16(IDS_NTP_ARTICLE_SUGGESTIONS_SECTION_HEADER), | 286 l10n_util::GetStringUTF16(IDS_NTP_ARTICLE_SUGGESTIONS_SECTION_HEADER), |
| 287 ContentSuggestionsCardLayout::FULL_CARD); | 287 ContentSuggestionsCardLayout::FULL_CARD, false); |
| 288 } |
| 289 |
| 290 void NTPSnippetsService::FetchMoreSuggestions(Category category) { |
| 291 // TODO(pke): Move implementation of FetchSnippets down here once the separate |
| 292 // FetchSnippets is not needed by snippets internals anymore, which will |
| 293 // happen once we don't need host restricts anymore. |
| 294 FetchSnippets(true); |
| 288 } | 295 } |
| 289 | 296 |
| 290 void NTPSnippetsService::DismissSuggestion(const std::string& suggestion_id) { | 297 void NTPSnippetsService::DismissSuggestion(const std::string& suggestion_id) { |
| 291 if (!ready()) | 298 if (!ready()) |
| 292 return; | 299 return; |
| 293 | 300 |
| 294 std::string snippet_id = GetWithinCategoryIDFromUniqueID(suggestion_id); | 301 std::string snippet_id = GetWithinCategoryIDFromUniqueID(suggestion_id); |
| 295 | 302 |
| 296 auto it = | 303 auto it = |
| 297 std::find_if(snippets_.begin(), snippets_.end(), | 304 std::find_if(snippets_.begin(), snippets_.end(), |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 813 void NTPSnippetsService::UpdateCategoryStatus(CategoryStatus status) { | 820 void NTPSnippetsService::UpdateCategoryStatus(CategoryStatus status) { |
| 814 if (status == category_status_) | 821 if (status == category_status_) |
| 815 return; | 822 return; |
| 816 | 823 |
| 817 category_status_ = status; | 824 category_status_ = status; |
| 818 observer()->OnCategoryStatusChanged(this, provided_category_, | 825 observer()->OnCategoryStatusChanged(this, provided_category_, |
| 819 category_status_); | 826 category_status_); |
| 820 } | 827 } |
| 821 | 828 |
| 822 } // namespace ntp_snippets | 829 } // namespace ntp_snippets |
| OLD | NEW |