| Index: components/ntp_snippets/category.cc
|
| diff --git a/components/ntp_snippets/category.cc b/components/ntp_snippets/category.cc
|
| index abc86ab9f2c71827710d8f2d477ec9206c170991..4409ac1b376b7491129f46ece2c591e1ae30edd5 100644
|
| --- a/components/ntp_snippets/category.cc
|
| +++ b/components/ntp_snippets/category.cc
|
| @@ -8,6 +8,26 @@
|
|
|
| namespace ntp_snippets {
|
|
|
| +// static
|
| +Category Category::FromKnownCategory(KnownCategories known_category) {
|
| + return FromIDValue(static_cast<int>(known_category));
|
| +}
|
| +
|
| +// static
|
| +Category Category::FromRemoteCategory(int remote_category) {
|
| + DCHECK_GT(remote_category, 0);
|
| + return Category(static_cast<int>(KnownCategories::REMOTE_CATEGORIES_OFFSET) +
|
| + remote_category);
|
| +}
|
| +
|
| +// static
|
| +Category Category::FromIDValue(int id) {
|
| + DCHECK_GE(id, 0);
|
| + DCHECK(id < static_cast<int>(KnownCategories::LOCAL_CATEGORIES_COUNT) ||
|
| + id > static_cast<int>(KnownCategories::REMOTE_CATEGORIES_OFFSET));
|
| + return Category(id);
|
| +}
|
| +
|
| Category::Category(int id) : id_(id) {}
|
|
|
| bool Category::IsKnownCategory(KnownCategories known_category) const {
|
|
|