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

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: Marc's comments 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
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..7ccdc8c228bdd6e1685873baf61ddfde768809ec 100644
--- a/chrome/browser/android/ntp/ntp_snippets_bridge.cc
+++ b/chrome/browser/android/ntp/ntp_snippets_bridge.cc
@@ -147,6 +147,34 @@ 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 14:00:00 The "at most 5" part isn't applicable anymore.
Philipp Keck 2016/07/26 15:47:20 Done.
+ // TODO(pke): This is only for debugging new sections and will be replaced
+ // with proper multi-section UI support.
+ for (ContentSuggestionsCategory category :
+ content_suggestions_service_->GetCategories()) {
+ if (category == ContentSuggestionsCategory::ARTICLES) {
+ continue;
+ }
+ if (content_suggestions_service_->GetCategoryStatus(category) !=
+ ContentSuggestionsCategoryStatus::AVAILABLE) {
+ continue;
+ }
+
+ 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());
+ }
+ }
+
+ // All article suggestions.
for (const ntp_snippets::ContentSuggestion& suggestion :
content_suggestions_service_->GetSuggestionsForCategory(
ContentSuggestionsCategory::ARTICLES)) {

Powered by Google App Engine
This is Rietveld 408576698