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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 | 71 |
72 State state() { return state_; } | 72 State state() { return state_; } |
73 | 73 |
74 // Gets all categories for which a provider is registered. The categories | 74 // Gets all categories for which a provider is registered. The categories |
75 // may or may not be available, see |GetCategoryStatus()|. | 75 // may or may not be available, see |GetCategoryStatus()|. |
76 const std::vector<Category>& GetCategories() const { return categories_; } | 76 const std::vector<Category>& GetCategories() const { return categories_; } |
77 | 77 |
78 // Gets the status of a category. | 78 // Gets the status of a category. |
79 CategoryStatus GetCategoryStatus(Category category) const; | 79 CategoryStatus GetCategoryStatus(Category category) const; |
80 | 80 |
| 81 // Gets the meta information of a category. |
| 82 CategoryInfo GetCategoryInfo(Category category) const; |
| 83 |
81 // Gets the available suggestions for a category. The result is empty if the | 84 // Gets the available suggestions for a category. The result is empty if the |
82 // category is available and empty, but also if the category is unavailable | 85 // category is available and empty, but also if the category is unavailable |
83 // for any reason, see |GetCategoryStatus()|. | 86 // for any reason, see |GetCategoryStatus()|. |
84 const std::vector<ContentSuggestion>& GetSuggestionsForCategory( | 87 const std::vector<ContentSuggestion>& GetSuggestionsForCategory( |
85 Category category) const; | 88 Category category) const; |
86 | 89 |
87 // Fetches the image for the suggestion with the given |suggestion_id| and | 90 // Fetches the image for the suggestion with the given |suggestion_id| and |
88 // runs the |callback|. If that suggestion doesn't exist or the fetch fails, | 91 // runs the |callback|. If that suggestion doesn't exist or the fetch fails, |
89 // the callback gets an empty image. | 92 // the callback gets an empty image. |
90 void FetchSuggestionImage(const std::string& suggestion_id, | 93 void FetchSuggestionImage(const std::string& suggestion_id, |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 // background fetching and debugging calls to it. If the NTPSnippetsService is | 196 // background fetching and debugging calls to it. If the NTPSnippetsService is |
194 // loaded, it is also present in |providers_|, otherwise this is a nullptr. | 197 // loaded, it is also present in |providers_|, otherwise this is a nullptr. |
195 NTPSnippetsService* ntp_snippets_service_; | 198 NTPSnippetsService* ntp_snippets_service_; |
196 | 199 |
197 DISALLOW_COPY_AND_ASSIGN(ContentSuggestionsService); | 200 DISALLOW_COPY_AND_ASSIGN(ContentSuggestionsService); |
198 }; | 201 }; |
199 | 202 |
200 } // namespace ntp_snippets | 203 } // namespace ntp_snippets |
201 | 204 |
202 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_SERVICE_H_ | 205 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_SERVICE_H_ |
OLD | NEW |