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_SERVICE_H_ | 5 #ifndef COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_SERVICE_H_ |
6 #define COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_SERVICE_H_ | 6 #define COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_SERVICE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 | 179 |
180 // Removes a suggestion from the local stores |id_category_map_| and | 180 // Removes a suggestion from the local stores |id_category_map_| and |
181 // |suggestions_by_category_|, if it exists. Returns true if a suggestion was | 181 // |suggestions_by_category_|, if it exists. Returns true if a suggestion was |
182 // removed. | 182 // removed. |
183 bool RemoveSuggestionByID(Category category, | 183 bool RemoveSuggestionByID(Category category, |
184 const std::string& suggestion_id); | 184 const std::string& suggestion_id); |
185 | 185 |
186 // Fires the OnCategoryStatusChanged event for the given |category|. | 186 // Fires the OnCategoryStatusChanged event for the given |category|. |
187 void NotifyCategoryStatusChanged(Category category); | 187 void NotifyCategoryStatusChanged(Category category); |
188 | 188 |
| 189 void SortCategories(); |
| 190 |
189 // Whether the content suggestions feature is enabled. | 191 // Whether the content suggestions feature is enabled. |
190 State state_; | 192 State state_; |
191 | 193 |
192 // Provides new and existing categories and an order for them. | 194 // Provides new and existing categories and an order for them. |
193 CategoryFactory category_factory_; | 195 CategoryFactory category_factory_; |
194 | 196 |
195 // All registered providers, owned by the service. | 197 // All registered providers, owned by the service. |
196 std::vector<std::unique_ptr<ContentSuggestionsProvider>> providers_; | 198 std::vector<std::unique_ptr<ContentSuggestionsProvider>> providers_; |
197 | 199 |
198 // All registered categories and their providers. A provider may be contained | 200 // All registered categories and their providers. A provider may be contained |
(...skipping 28 matching lines...) Expand all Loading... |
227 // background fetching and debugging calls to it. If the NTPSnippetsService is | 229 // background fetching and debugging calls to it. If the NTPSnippetsService is |
228 // loaded, it is also present in |providers_|, otherwise this is a nullptr. | 230 // loaded, it is also present in |providers_|, otherwise this is a nullptr. |
229 NTPSnippetsService* ntp_snippets_service_; | 231 NTPSnippetsService* ntp_snippets_service_; |
230 | 232 |
231 DISALLOW_COPY_AND_ASSIGN(ContentSuggestionsService); | 233 DISALLOW_COPY_AND_ASSIGN(ContentSuggestionsService); |
232 }; | 234 }; |
233 | 235 |
234 } // namespace ntp_snippets | 236 } // namespace ntp_snippets |
235 | 237 |
236 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_SERVICE_H_ | 238 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_SERVICE_H_ |
OLD | NEW |