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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 83 |
84 // Dismisses the suggestion with the given ID. A provider needs to ensure that | 84 // Dismisses the suggestion with the given ID. A provider needs to ensure that |
85 // a once-dismissed suggestion is never delivered again (through the | 85 // a once-dismissed suggestion is never delivered again (through the |
86 // Observer). The provider must not call Observer::OnSuggestionsChanged if the | 86 // Observer). The provider must not call Observer::OnSuggestionsChanged if the |
87 // removal of the dismissed suggestion is the only change. | 87 // removal of the dismissed suggestion is the only change. |
88 virtual void DismissSuggestion(const std::string& suggestion_id) = 0; | 88 virtual void DismissSuggestion(const std::string& suggestion_id) = 0; |
89 | 89 |
90 // Fetches the image for the suggestion with the given ID and returns it | 90 // Fetches the image for the suggestion with the given ID and returns it |
91 // through the callback. This fetch may occur locally or from the internet. | 91 // through the callback. This fetch may occur locally or from the internet. |
92 // If that suggestion doesn't exist, doesn't have an image or if the fetch | 92 // If that suggestion doesn't exist, doesn't have an image or if the fetch |
93 // fails, the callback gets a null image. | 93 // fails, the callback gets a null image. The callback will not be called |
| 94 // synchronously. |
94 virtual void FetchSuggestionImage(const std::string& suggestion_id, | 95 virtual void FetchSuggestionImage(const std::string& suggestion_id, |
95 const ImageFetchedCallback& callback) = 0; | 96 const ImageFetchedCallback& callback) = 0; |
96 | 97 |
97 // Used only for debugging purposes. Clears all caches for the given category, | 98 // Used only for debugging purposes. Clears all caches for the given category, |
98 // so that the next fetch starts from scratch. | 99 // so that the next fetch starts from scratch. |
99 virtual void ClearCachedSuggestionsForDebugging(Category category) = 0; | 100 virtual void ClearCachedSuggestionsForDebugging(Category category) = 0; |
100 | 101 |
101 // Used only for debugging purposes. Retrieves suggestions for the given | 102 // Used only for debugging purposes. Retrieves suggestions for the given |
102 // |category| that have previously been dismissed and are still stored in the | 103 // |category| that have previously been dismissed and are still stored in the |
103 // provider. If the provider doesn't store dismissed suggestions for the given | 104 // provider. If the provider doesn't store dismissed suggestions for the given |
(...skipping 28 matching lines...) Expand all Loading... |
132 CategoryFactory* category_factory() const { return category_factory_; } | 133 CategoryFactory* category_factory() const { return category_factory_; } |
133 | 134 |
134 private: | 135 private: |
135 Observer* observer_; | 136 Observer* observer_; |
136 CategoryFactory* category_factory_; | 137 CategoryFactory* category_factory_; |
137 }; | 138 }; |
138 | 139 |
139 } // namespace ntp_snippets | 140 } // namespace ntp_snippets |
140 | 141 |
141 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_PROVIDER_H_ | 142 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_PROVIDER_H_ |
OLD | NEW |