Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(406)

Unified Diff: components/ntp_snippets/category_factory.h

Issue 2355393002: New snippets now replace old snippets and do not merge (Closed)
Patch Set: Marc's comments Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/ntp_snippets/category_factory.h
diff --git a/components/ntp_snippets/category_factory.h b/components/ntp_snippets/category_factory.h
index dcaec00d7320d7e5e4fc6e2223cdd497001dda04..7d1c6f7342561c9e116bc5872315df91fa7dd3f4 100644
--- a/components/ntp_snippets/category_factory.h
+++ b/components/ntp_snippets/category_factory.h
@@ -6,6 +6,7 @@
#define COMPONENTS_NTP_SNIPPETS_CATEGORY_FACTORY_H_
#include <map>
+#include <string>
#include <vector>
#include "base/macros.h"
@@ -43,6 +44,23 @@ class CategoryFactory {
// |FromRemoteCategory|.
bool CompareCategories(const Category& left, const Category& right) const;
+ // TODO(treib): Remove the following 3 functions from here once we move to a
+ // more structured identification than the unique_id string and thus once we
+ // minimize usage of these functions. See crbug.com/649048.
Marc Treib 2016/09/22 11:27:06 s/minimize usage of/eliminate/ :)
jkrcal 2016/09/22 12:50:05 Done.
+
+ // Creates a unique ID. The given |within_category_id| must be unique among
+ // all suggestion IDs from this provider for the given |category|. This method
+ // combines it with the |category| to form an ID that is unique
+ // application-wide, because this provider is the only one that provides
+ // suggestions for that category.
+ std::string MakeUniqueID(Category category,
+ const std::string& within_category_id) const;
+
+ // Reverse functions for MakeUniqueID()
+ Category GetCategoryFromUniqueID(const std::string& unique_id);
+ std::string GetWithinCategoryIDFromUniqueID(
+ const std::string& unique_id) const;
+
private:
bool CategoryExists(int id);
void AddKnownCategory(KnownCategories known_category);
« no previous file with comments | « no previous file | components/ntp_snippets/category_factory.cc » ('j') | components/ntp_snippets/ntp_snippets_service.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698