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..a9b74827ae9758dec74ef20f5b843f445199cff9 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 |
| @@ -67,9 +65,20 @@ class Category { |
| // Returns whether this category matches the given |known_category|. |
| bool IsKnownCategory(KnownCategories known_category) const; |
| - private: |
| - friend class CategoryFactory; |
| + // 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 |Category::id()|. |
|
Marc Treib
2016/12/13 12:22:42
nit: "Category::" isn't required
vitaliii
2016/12/14 08:59:38
Done.
|
| + // |id| must be a non-negative value. |
| + static Category FromIDValue(int id); |
|
Marc Treib
2016/12/13 12:22:42
nit: Move all the static "create" methods to the t
vitaliii
2016/12/14 08:59:38
Done.
|
| + |
| + private: |
| explicit Category(int id); |
| int id_; |