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

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

Issue 2393353005: [NTP Snippets] Overwrite the title of the ARTICLES if provided by the server (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
« no previous file with comments | « no previous file | components/ntp_snippets/remote/ntp_snippets_service_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 601b47dc9f03dc7793c60cfd7ad05afd54543654..78aea3a04b60edba453d0f2562906971ae05a88e 100644
--- a/components/ntp_snippets/remote/ntp_snippets_service.cc
+++ b/components/ntp_snippets/remote/ntp_snippets_service.cc
@@ -520,10 +520,14 @@ void NTPSnippetsService::OnFetchFinished(
*fetched_categories) {
Category category = fetched_category.category;
+ // The ChromeReader backend doesn't provide category titles, so don't
+ // overwrite the existing title for ARTICLES if the new one is empty.
+ // TODO(treib): Remove this check after we fully switch to the content
+ // suggestions backend.
// TODO(sfiera): Avoid hard-coding articles category checks in so many
// places.
- if (category != articles_category_) {
- // Only update titles from server-side provided categories.
+ if (category != articles_category_ ||
+ !fetched_category.localized_title.empty()) {
categories_[category].localized_title =
fetched_category.localized_title;
}
« no previous file with comments | « no previous file | components/ntp_snippets/remote/ntp_snippets_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698