Chromium Code Reviews| Index: components/ntp_snippets/category.h |
| diff --git a/components/ntp_snippets/category.h b/components/ntp_snippets/category.h |
| index 0ae86c8b16f9e7d2fc5f00d62166dd9c883e34ec..8f8237ffc4831b7c1f4e049d2801b870d078a0d5 100644 |
| --- a/components/ntp_snippets/category.h |
| +++ b/components/ntp_snippets/category.h |
| @@ -9,8 +9,6 @@ |
| namespace ntp_snippets { |
| -class CategoryFactory; |
| - |
| // These are the categories that the client knows about. |
| // The values before LOCAL_CATEGORIES_COUNT are the categories that are provided |
| // locally on the device. Categories provided by the server (IDs strictly larger |
| @@ -55,6 +53,19 @@ enum class KnownCategories { |
| // CategoryFactory to obtain instances. |
| class Category { |
| public: |
| + // Creates a category from a KnownCategory value. The passed |known_category| |
| + // must not be one of the special values (LOCAL_CATEGORIES_COUNT or |
| + // REMOTE_CATEGORIES_OFFSET). |
| + static Category FromKnownCategory(KnownCategories known_category); |
| + |
| + // Creates a category from a category identifier delivered by the server. |
| + // |remote_category| must be positive. |
| + static Category FromRemoteCategory(int remote_category); |
| + |
| + // Creates a category from an ID as returned by |id()|. |id| must be a |
| + // non-negative value. |
| + static Category FromIDValue(int id); |
| + |
| // An arbitrary but consistent ordering. Can be used to look up categories in |
| // a std::map, but should not be used to order categories for other purposes. |
| struct CompareByID; |
|
Marc Treib
2016/12/14 10:24:31
nitty nit: This should probably stay on top (types
vitaliii
2016/12/15 15:30:12
Done.
|
| @@ -68,8 +79,6 @@ class Category { |
| bool IsKnownCategory(KnownCategories known_category) const; |
| private: |
| - friend class CategoryFactory; |
| - |
| explicit Category(int id); |
| int id_; |