Index: components/ntp_snippets/category.h |
diff --git a/components/ntp_snippets/category.h b/components/ntp_snippets/category.h |
index 0ae86c8b16f9e7d2fc5f00d62166dd9c883e34ec..c13c115314f90f3bb011767259ed9daaf598ad6b 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 |
@@ -59,6 +57,19 @@ class Category { |
// a std::map, but should not be used to order categories for other purposes. |
struct CompareByID; |
+ // 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); |
+ |
// Returns a non-negative identifier that is unique for the category and can |
// be converted back to a Category instance using |
// |CategoryFactory::FromIDValue(id)|. |
@@ -68,8 +79,6 @@ class Category { |
bool IsKnownCategory(KnownCategories known_category) const; |
private: |
- friend class CategoryFactory; |
- |
explicit Category(int id); |
int id_; |