Index: components/ntp_snippets/category.cc |
diff --git a/components/ntp_snippets/category.cc b/components/ntp_snippets/category.cc |
index c9dff3125dfc9c1ecdd92ce433f1c055f43efbe5..90bcf58d5608c3a8a996b555dd199bf26e565713 100644 |
--- a/components/ntp_snippets/category.cc |
+++ b/components/ntp_snippets/category.cc |
@@ -12,6 +12,20 @@ bool Category::IsKnownCategory(KnownCategories known_category) const { |
return id_ == static_cast<int>(known_category); |
} |
+bool Category::IsAnyKnownCategory() const { |
+ static const int kKnownCategoryIds[] = { |
+ static_cast<int>(KnownCategories::RECENT_TABS), |
+ static_cast<int>(KnownCategories::DOWNLOADS), |
+ static_cast<int>(KnownCategories::BOOKMARKS), |
+ static_cast<int>(KnownCategories::PHYSICAL_WEB_PAGES), |
+ static_cast<int>(KnownCategories::ARTICLES)}; |
jkrcal
2016/09/13 16:08:05
I am just wondering:
Cannot you add to the enum c
Marc Treib
2016/09/13 16:28:50
SERVER_CATEGORIES_MAX would actually have to be KN
jkrcal
2016/09/13 17:22:27
How come? Is it because we can introduce some cate
tschumann
2016/09/14 08:41:35
Joining this discussion as a by-stander. Given tha
Marc Treib
2016/09/14 08:42:20
Say the server adds categories 2 and 3. Later, we
|
+ for (int known_category_id : kKnownCategoryIds) { |
+ if (id_ == known_category_id) |
+ return true; |
+ } |
+ return false; |
+} |
+ |
bool operator==(const Category& left, const Category& right) { |
return left.id() == right.id(); |
} |