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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
81 | 81 |
82 // Gets the meta information of a category. | 82 // Gets the meta information of a category. |
83 base::Optional<CategoryInfo> GetCategoryInfo(Category category) const; | 83 base::Optional<CategoryInfo> GetCategoryInfo(Category category) const; |
84 | 84 |
85 // Gets the available suggestions for a category. The result is empty if the | 85 // Gets the available suggestions for a category. The result is empty if the |
86 // category is available and empty, but also if the category is unavailable | 86 // category is available and empty, but also if the category is unavailable |
87 // for any reason, see |GetCategoryStatus()|. | 87 // for any reason, see |GetCategoryStatus()|. |
88 const std::vector<ContentSuggestion>& GetSuggestionsForCategory( | 88 const std::vector<ContentSuggestion>& GetSuggestionsForCategory( |
89 Category category) const; | 89 Category category) const; |
90 | 90 |
91 // Triggers a fetch for new suggestions (over the network, for example) for | |
92 // the given |category|. This must be initiated by the user (e.g. by clicking | |
93 // the a "More" button). | |
Marc Treib
2016/08/10 09:40:31
nit: remove "a"
Philipp Keck
2016/08/10 13:14:47
Done.
| |
94 void FetchMoreSuggestions(Category category); | |
95 | |
91 // Fetches the image for the suggestion with the given |suggestion_id| and | 96 // Fetches the image for the suggestion with the given |suggestion_id| and |
92 // runs the |callback|. If that suggestion doesn't exist or the fetch fails, | 97 // runs the |callback|. If that suggestion doesn't exist or the fetch fails, |
93 // the callback gets an empty image. The callback will not be called | 98 // the callback gets an empty image. The callback will not be called |
94 // synchronously. | 99 // synchronously. |
95 void FetchSuggestionImage(const std::string& suggestion_id, | 100 void FetchSuggestionImage(const std::string& suggestion_id, |
96 const ImageFetchedCallback& callback); | 101 const ImageFetchedCallback& callback); |
97 | 102 |
98 // Dismisses the suggestion with the given |suggestion_id|, if it exists. | 103 // Dismisses the suggestion with the given |suggestion_id|, if it exists. |
99 // This will not trigger an update through the observers. | 104 // This will not trigger an update through the observers. |
100 void DismissSuggestion(const std::string& suggestion_id); | 105 void DismissSuggestion(const std::string& suggestion_id); |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
212 // background fetching and debugging calls to it. If the NTPSnippetsService is | 217 // background fetching and debugging calls to it. If the NTPSnippetsService is |
213 // loaded, it is also present in |providers_|, otherwise this is a nullptr. | 218 // loaded, it is also present in |providers_|, otherwise this is a nullptr. |
214 NTPSnippetsService* ntp_snippets_service_; | 219 NTPSnippetsService* ntp_snippets_service_; |
215 | 220 |
216 DISALLOW_COPY_AND_ASSIGN(ContentSuggestionsService); | 221 DISALLOW_COPY_AND_ASSIGN(ContentSuggestionsService); |
217 }; | 222 }; |
218 | 223 |
219 } // namespace ntp_snippets | 224 } // namespace ntp_snippets |
220 | 225 |
221 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_SERVICE_H_ | 226 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_SERVICE_H_ |
OLD | NEW |