| 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 30 matching lines...) Expand all Loading... |
| 120 CategoryFactory* category_factory() const { return category_factory_; } | 124 CategoryFactory* category_factory() const { return category_factory_; } |
| 121 | 125 |
| 122 private: | 126 private: |
| 123 Observer* observer_; | 127 Observer* observer_; |
| 124 CategoryFactory* category_factory_; | 128 CategoryFactory* category_factory_; |
| 125 }; | 129 }; |
| 126 | 130 |
| 127 } // namespace ntp_snippets | 131 } // namespace ntp_snippets |
| 128 | 132 |
| 129 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_PROVIDER_H_ | 133 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_PROVIDER_H_ |
| OLD | NEW |