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 |
11 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
12 #include "components/ntp_snippets/category.h" | 12 #include "components/ntp_snippets/category.h" |
| 13 #include "components/ntp_snippets/category_info.h" |
13 #include "components/ntp_snippets/category_status.h" | 14 #include "components/ntp_snippets/category_status.h" |
14 #include "components/ntp_snippets/content_suggestion.h" | 15 #include "components/ntp_snippets/content_suggestion.h" |
15 | 16 |
16 namespace gfx { | 17 namespace gfx { |
17 class Image; | 18 class Image; |
18 } | 19 } |
19 | 20 |
20 namespace ntp_snippets { | 21 namespace ntp_snippets { |
21 | 22 |
22 // Provides content suggestions from one particular source. | 23 // Provides content suggestions from one particular source. |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 // Returns the categories provided by this provider. | 71 // Returns the categories provided by this provider. |
71 // When the set of provided categories changes, the Observer is notified | 72 // When the set of provided categories changes, the Observer is notified |
72 // through |OnNewSuggestions| or |OnCategoryStatusChanged| for added | 73 // through |OnNewSuggestions| or |OnCategoryStatusChanged| for added |
73 // categories, and through |OnCategoryStatusChanged| with parameter | 74 // categories, and through |OnCategoryStatusChanged| with parameter |
74 // NOT_PROVIDED for removed categories. | 75 // NOT_PROVIDED for removed categories. |
75 virtual std::vector<Category> GetProvidedCategories() = 0; | 76 virtual std::vector<Category> GetProvidedCategories() = 0; |
76 | 77 |
77 // Determines the status of the given |category|, see CategoryStatus. | 78 // Determines the status of the given |category|, see CategoryStatus. |
78 virtual CategoryStatus GetCategoryStatus(Category category) = 0; | 79 virtual CategoryStatus GetCategoryStatus(Category category) = 0; |
79 | 80 |
| 81 // Returns the meta information for the given |category|. |
| 82 virtual CategoryInfo GetCategoryInfo(Category category) = 0; |
| 83 |
80 // 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 |
81 // a once-dismissed suggestion is never delivered again (through the | 85 // a once-dismissed suggestion is never delivered again (through the |
82 // Observer). The provider must not call Observer::OnSuggestionsChanged if the | 86 // Observer). The provider must not call Observer::OnSuggestionsChanged if the |
83 // removal of the dismissed suggestion is the only change. | 87 // removal of the dismissed suggestion is the only change. |
84 virtual void DismissSuggestion(const std::string& suggestion_id) = 0; | 88 virtual void DismissSuggestion(const std::string& suggestion_id) = 0; |
85 | 89 |
86 // 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 |
87 // 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. |
88 // 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 |
89 // fails, the callback gets a null image. | 93 // fails, the callback gets a null image. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 CategoryFactory* category_factory() const { return category_factory_; } | 132 CategoryFactory* category_factory() const { return category_factory_; } |
129 | 133 |
130 private: | 134 private: |
131 Observer* observer_; | 135 Observer* observer_; |
132 CategoryFactory* category_factory_; | 136 CategoryFactory* category_factory_; |
133 }; | 137 }; |
134 | 138 |
135 } // namespace ntp_snippets | 139 } // namespace ntp_snippets |
136 | 140 |
137 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_PROVIDER_H_ | 141 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_PROVIDER_H_ |
OLD | NEW |