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

Unified Diff: chrome/browser/android/ntp/ntp_snippets_bridge.cc

Issue 2184683002: Show content suggestions from all categories on the NTP (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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/offline_pages/offline_page_suggestions_provider.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/ntp/ntp_snippets_bridge.cc
diff --git a/chrome/browser/android/ntp/ntp_snippets_bridge.cc b/chrome/browser/android/ntp/ntp_snippets_bridge.cc
index f6a6b5aad01e071a646229d1779f31953cc7388a..e3b89b0ad6eefb85c026c93713cce6e8bf00f91b 100644
--- a/chrome/browser/android/ntp/ntp_snippets_bridge.cc
+++ b/chrome/browser/android/ntp/ntp_snippets_bridge.cc
@@ -147,6 +147,35 @@ void NTPSnippetsBridge::OnNewSuggestions() {
std::vector<int64_t> timestamps;
std::vector<std::string> publishers;
std::vector<float> scores;
+
+ // Show all other sections before ARTICLES, at most 5 suggestions per section.
Marc Treib 2016/07/26 12:54:08 Can you please add a TODO that this is a temporary
Philipp Keck 2016/07/26 13:55:58 Done.
+ for (ContentSuggestionsCategory category :
+ content_suggestions_service_->GetCategories()) {
+ if (category == ContentSuggestionsCategory::ARTICLES) {
+ continue;
+ }
+ if (content_suggestions_service_->GetCategoryStatus(category) !=
+ ContentSuggestionsCategoryStatus::AVAILABLE) {
+ continue;
+ }
+
+ int counter = 0;
Marc Treib 2016/07/26 12:54:08 Why the "at most 5" logic? Since this will only ha
Philipp Keck 2016/07/26 13:55:58 Ok I moved it there. Testing how an empty NTP beha
+ for (const ntp_snippets::ContentSuggestion& suggestion :
+ content_suggestions_service_->GetSuggestionsForCategory(category)) {
+ ids.push_back(suggestion.id());
+ titles.push_back(suggestion.title());
+ urls.push_back(suggestion.url().spec());
+ amp_urls.push_back(suggestion.amp_url().spec());
+ snippets.push_back(suggestion.snippet_text());
+ timestamps.push_back(suggestion.publish_date().ToJavaTime());
+ publishers.push_back(suggestion.publisher_name());
+ scores.push_back(suggestion.score());
+ if (5 == ++counter)
+ break;
+ }
+ }
+
+ // All article suggestions.
for (const ntp_snippets::ContentSuggestion& suggestion :
content_suggestions_service_->GetSuggestionsForCategory(
ContentSuggestionsCategory::ARTICLES)) {
« no previous file with comments | « no previous file | components/ntp_snippets/offline_pages/offline_page_suggestions_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698