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

Unified Diff: components/ntp_snippets/category_factory.cc

Issue 2377663002: [NTP Snippets] Introduce ContentSuggestion::ID (Closed)
Patch Set: rebase 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
« no previous file with comments | « components/ntp_snippets/category_factory.h ('k') | components/ntp_snippets/content_suggestion.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/ntp_snippets/category_factory.cc
diff --git a/components/ntp_snippets/category_factory.cc b/components/ntp_snippets/category_factory.cc
index 9962f0771eb05fda3eb43074cfb66ccbf5b85e2e..4da984e016232a02443f6d041209e40c429b63c2 100644
--- a/components/ntp_snippets/category_factory.cc
+++ b/components/ntp_snippets/category_factory.cc
@@ -12,13 +12,6 @@
namespace ntp_snippets {
-namespace {
-
-const char kCombinedIDFormat[] = "%d|%s";
-const char kSeparator = '|';
-
-} // namespace
-
CategoryFactory::CategoryFactory() {
// Add all local categories in a fixed order.
AddKnownCategory(KnownCategories::DOWNLOADS);
@@ -66,32 +59,6 @@ bool CategoryFactory::CompareCategories(const Category& left,
ordered_categories_.end(), right);
}
-std::string CategoryFactory::MakeUniqueID(
- Category category,
- const std::string& within_category_id) const {
- return base::StringPrintf(kCombinedIDFormat, category.id(),
- within_category_id.c_str());
-}
-
-Category CategoryFactory::GetCategoryFromUniqueID(
- const std::string& unique_id) {
- size_t colon_index = unique_id.find(kSeparator);
- DCHECK_NE(std::string::npos, colon_index) << "Not a valid unique_id: "
- << unique_id;
- int category = -1;
- bool ret = base::StringToInt(unique_id.substr(0, colon_index), &category);
- DCHECK(ret) << "Non-numeric category part in unique_id: " << unique_id;
- return FromIDValue(category);
-}
-
-std::string CategoryFactory::GetWithinCategoryIDFromUniqueID(
- const std::string& unique_id) const {
- size_t colon_index = unique_id.find(kSeparator);
- DCHECK_NE(std::string::npos, colon_index) << "Not a valid unique_id: "
- << unique_id;
- return unique_id.substr(colon_index + 1);
-}
-
////////////////////////////////////////////////////////////////////////////////
// Private methods
« no previous file with comments | « components/ntp_snippets/category_factory.h ('k') | components/ntp_snippets/content_suggestion.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698