Chromium Code Reviews| Index: components/ntp_snippets/content_suggestions_metrics.cc |
| diff --git a/components/ntp_snippets/content_suggestions_metrics.cc b/components/ntp_snippets/content_suggestions_metrics.cc |
| index 5d4fbe169ad5a462da482bcc432b02bbbaa3b785..031a54ee0285a8901adfe35c796751b430f5653a 100644 |
| --- a/components/ntp_snippets/content_suggestions_metrics.cc |
| +++ b/components/ntp_snippets/content_suggestions_metrics.cc |
| @@ -44,17 +44,27 @@ const char kHistogramMoreButtonClicked[] = |
| const char kPerCategoryHistogramFormat[] = "%s.%s"; |
| std::string GetCategorySuffix(Category category) { |
| - // TODO(treib): Find a way to produce a compile error if a known category |
| - // isn't listed here. |
| - if (category.IsKnownCategory(KnownCategories::RECENT_TABS)) |
| - return "RecentTabs"; |
| - if (category.IsKnownCategory(KnownCategories::DOWNLOADS)) |
| - return "Downloads"; |
| - if (category.IsKnownCategory(KnownCategories::BOOKMARKS)) |
| - return "Bookmarks"; |
| - if (category.IsKnownCategory(KnownCategories::ARTICLES)) |
| - return "Articles"; |
| - // All other categories go into a single "Experimental" bucket. |
| + if (category.IsAnyKnownCategory()) { |
| + KnownCategories known_category = |
| + static_cast<KnownCategories>(category.id()); |
| + switch (known_category) { |
|
jkrcal
2016/09/13 16:08:05
Way better, thanks!
|
| + case KnownCategories::RECENT_TABS: |
| + return "RecentTabs"; |
| + case KnownCategories::DOWNLOADS: |
| + return "Downloads"; |
| + case KnownCategories::BOOKMARKS: |
| + return "Bookmarks"; |
| + case KnownCategories::PHYSICAL_WEB_PAGES: |
| + return "PhysicalWeb"; |
| + case KnownCategories::ARTICLES: |
| + return "Articles"; |
| + case KnownCategories::LOCAL_CATEGORIES_COUNT: |
| + case KnownCategories::REMOTE_CATEGORIES_OFFSET: |
| + NOTREACHED(); |
| + break; |
| + } |
| + } |
| + // All other (unknown) categories go into a single "Experimental" bucket. |
| return "Experimental"; |
| } |