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

Side by Side Diff: components/ntp_snippets/content_suggestions_provider.h

Issue 2155243003: Use pipe as ID separator and add inverse functions for MakeUniqueID (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@css-unittest
Patch Set: Fix category not initialized warning Created 4 years, 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | components/ntp_snippets/content_suggestions_provider.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_PROVIDER_H_ 5 #ifndef COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_PROVIDER_H_
6 #define COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_PROVIDER_H_ 6 #define COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_PROVIDER_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 const std::vector<ContentSuggestionsCategory>& provided_categories); 103 const std::vector<ContentSuggestionsCategory>& provided_categories);
104 virtual ~ContentSuggestionsProvider(); 104 virtual ~ContentSuggestionsProvider();
105 105
106 // Creates a unique ID. The given |within_category_id| must be unique among 106 // Creates a unique ID. The given |within_category_id| must be unique among
107 // all suggestion IDs from this provider for the given |category|. This method 107 // all suggestion IDs from this provider for the given |category|. This method
108 // combines it with the |category| to form an ID that is unique 108 // combines it with the |category| to form an ID that is unique
109 // application-wide, because this provider is the only one that provides 109 // application-wide, because this provider is the only one that provides
110 // suggestions for that category. 110 // suggestions for that category.
111 static std::string MakeUniqueID(ContentSuggestionsCategory category, 111 static std::string MakeUniqueID(ContentSuggestionsCategory category,
112 const std::string& within_category_id); 112 const std::string& within_category_id);
113 // Reverse functions for MakeUniqueID()
114 static ContentSuggestionsCategory GetCategoryFromUniqueID(
115 const std::string& unique_id);
116 static std::string GetWithinCategoryIDFromUniqueID(
117 const std::string& unique_id);
113 118
114 private: 119 private:
115 const std::vector<ContentSuggestionsCategory> provided_categories_; 120 const std::vector<ContentSuggestionsCategory> provided_categories_;
116 }; 121 };
117 122
118 } // namespace ntp_snippets 123 } // namespace ntp_snippets
119 124
120 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_PROVIDER_H_ 125 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_PROVIDER_H_
OLDNEW
« no previous file with comments | « no previous file | components/ntp_snippets/content_suggestions_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698