OLD | NEW |
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 Loading... |
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_ |
OLD | NEW |