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

Unified Diff: components/ntp_snippets/content_suggestions_service.cc

Issue 2207493002: Add CategoryInfo for meta information of content suggestions Categories (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 4 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/content_suggestions_service.cc
diff --git a/components/ntp_snippets/content_suggestions_service.cc b/components/ntp_snippets/content_suggestions_service.cc
index 1b9ecb839cb7d4cedb90f40dc88d6be2ce605fd9..3e52d1311bcece1757be9d202ca6d40c0d57c69a 100644
--- a/components/ntp_snippets/content_suggestions_service.cc
+++ b/components/ntp_snippets/content_suggestions_service.cc
@@ -48,6 +48,15 @@ CategoryStatus ContentSuggestionsService::GetCategoryStatus(
return iterator->second->GetCategoryStatus(category);
}
+CategoryInfo ContentSuggestionsService::GetCategoryInfo(
+ Category category) const {
+ auto iterator = providers_by_category_.find(category);
+ if (iterator == providers_by_category_.end())
+ return CategoryInfo(base::string16());
tschumann 2016/08/04 08:59:39 it might be better to explicitly signal the lookup
Marc Treib 2016/08/04 09:46:30 Explicitly signaling the failure might be good, bu
Philipp Keck 2016/08/04 11:48:18 base::Optional sounds good. We could so something
tschumann 2016/08/04 11:51:24 While that's possible, it would be nice to not rel
Philipp Keck 2016/08/08 14:50:18 Done.
+
+ return iterator->second->GetCategoryInfo(category);
+}
+
const std::vector<ContentSuggestion>&
ContentSuggestionsService::GetSuggestionsForCategory(Category category) const {
auto iterator = suggestions_by_category_.find(category);

Powered by Google App Engine
This is Rietveld 408576698