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

Unified Diff: chrome/browser/ui/webui/snippets_internals_message_handler.cc

Issue 2187233002: Add ContentSuggestionsCategoryFactory; Store categories as ints (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
Index: chrome/browser/ui/webui/snippets_internals_message_handler.cc
diff --git a/chrome/browser/ui/webui/snippets_internals_message_handler.cc b/chrome/browser/ui/webui/snippets_internals_message_handler.cc
index c4079db89af185f10db7a1549b345b0366dc845e..fd306b6838d14d5182c2d24439f79f371cb87f43 100644
--- a/chrome/browser/ui/webui/snippets_internals_message_handler.cc
+++ b/chrome/browser/ui/webui/snippets_internals_message_handler.cc
@@ -29,6 +29,7 @@
using ntp_snippets::ContentSuggestion;
using ntp_snippets::ContentSuggestionsCategory;
using ntp_snippets::ContentSuggestionsCategoryStatus;
+using ntp_snippets::KnownSuggestionsCategories;
namespace {
@@ -75,13 +76,12 @@ std::unique_ptr<base::DictionaryValue> PrepareSuggestion(
}
std::string MapCategoryName(ContentSuggestionsCategory category) {
Marc Treib 2016/07/28 11:41:45 Should this be called GetCategoryName? Not sure wh
Philipp Keck 2016/07/28 13:50:53 Done. GetCategoryTitle.
Marc Treib 2016/07/28 14:31:16 It's not actually the title though, it's just a de
- switch (category) {
- case ContentSuggestionsCategory::ARTICLES:
- return "Articles";
- case ContentSuggestionsCategory::OFFLINE_PAGES:
- return "Offline pages (continue browsing)";
- case ContentSuggestionsCategory::COUNT:
- NOTREACHED() << "Category::COUNT must not be used as a value";
+ // TODO(pke): Replace this with the category's title.
Marc Treib 2016/07/28 11:41:45 I guess this should be a comment on the function?
Philipp Keck 2016/07/28 13:50:53 Done.
+ if (category == KnownSuggestionsCategories::ARTICLES) {
+ return "Articles";
+ }
+ if (category == KnownSuggestionsCategories::OFFLINE_PAGES) {
+ return "Offline pages (continue browsing)";
}
return std::string();
}

Powered by Google App Engine
This is Rietveld 408576698