Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(801)

Unified Diff: components/ntp_snippets/remote/ntp_snippets_service.cc

Issue 2422633002: [NTP Snippets] Properly restore the status of restored sections (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/ntp_snippets/remote/ntp_snippets_service.cc
diff --git a/components/ntp_snippets/remote/ntp_snippets_service.cc b/components/ntp_snippets/remote/ntp_snippets_service.cc
index 8314a0783615a34d54849c57d924c9a879f0e0d0..63b79593e1d0730564daea882de936a42c83adc5 100644
--- a/components/ntp_snippets/remote/ntp_snippets_service.cc
+++ b/components/ntp_snippets/remote/ntp_snippets_service.cc
@@ -314,8 +314,8 @@ CategoryInfo NTPSnippetsService::GetCategoryInfo(Category category) {
const CategoryContent& content = categories_[category];
return CategoryInfo(content.localized_title,
ContentSuggestionsCardLayout::FULL_CARD,
- /* has_more_button */ false,
- /* show_if_empty */ true);
+ /*has_more_button=*/false,
+ /*show_if_empty=*/true);
}
void NTPSnippetsService::DismissSuggestion(
@@ -836,11 +836,13 @@ void NTPSnippetsService::EnterStateReady() {
fetch_when_ready_ = false;
}
- // FetchSnippets should set the status to |AVAILABLE_LOADING| if relevant,
- // otherwise we transition to |AVAILABLE| here.
- if (categories_[articles_category_].status !=
- CategoryStatus::AVAILABLE_LOADING) {
- UpdateCategoryStatus(articles_category_, CategoryStatus::AVAILABLE);
+ for (const auto& item : categories_) {
Marc Treib 2016/10/14 13:47:14 This was the actual problem - I missed updating on
+ Category category = item.first;
+ const CategoryContent& content = item.second;
+ // FetchSnippets has set the status to |AVAILABLE_LOADING| if relevant,
+ // otherwise we transition to |AVAILABLE| here.
+ if (content.status != CategoryStatus::AVAILABLE_LOADING)
+ UpdateCategoryStatus(category, CategoryStatus::AVAILABLE);
}
}
« no previous file with comments | « components/ntp_snippets/remote/ntp_snippets_service.h ('k') | components/ntp_snippets/remote/ntp_snippets_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698