| 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 10 matching lines...) Expand all Loading... |
| 21 namespace ntp_snippets { | 21 namespace ntp_snippets { |
| 22 | 22 |
| 23 // Provides content suggestions from one particular source. | 23 // Provides content suggestions from one particular source. |
| 24 // A provider can provide suggestions for multiple ContentSuggestionCategories, | 24 // A provider can provide suggestions for multiple ContentSuggestionCategories, |
| 25 // but for every category that it provides, it will be the only provider in the | 25 // but for every category that it provides, it will be the only provider in the |
| 26 // system which provides suggestions for that category. | 26 // system which provides suggestions for that category. |
| 27 // Providers are created by the ContentSuggestionsServiceFactory and owned and | 27 // Providers are created by the ContentSuggestionsServiceFactory and owned and |
| 28 // shut down by the ContentSuggestionsService. | 28 // shut down by the ContentSuggestionsService. |
| 29 class ContentSuggestionsProvider { | 29 class ContentSuggestionsProvider { |
| 30 public: | 30 public: |
| 31 using ImageFetchedCallback = | 31 using ImageFetchedCallback = base::Callback<void(const gfx::Image&)>; |
| 32 base::Callback<void(const std::string& suggestion_id, const gfx::Image&)>; | |
| 33 using DismissedSuggestionsCallback = base::Callback<void( | 32 using DismissedSuggestionsCallback = base::Callback<void( |
| 34 std::vector<ContentSuggestion> dismissed_suggestions)>; | 33 std::vector<ContentSuggestion> dismissed_suggestions)>; |
| 35 | 34 |
| 36 // The observer of a provider is notified when new data is available. | 35 // The observer of a provider is notified when new data is available. |
| 37 class Observer { | 36 class Observer { |
| 38 public: | 37 public: |
| 39 // Called when the available content changed. | 38 // Called when the available content changed. |
| 40 // If a provider provides suggestions for multiple categories, this callback | 39 // If a provider provides suggestions for multiple categories, this callback |
| 41 // is called once per category. The |suggestions| parameter always contains | 40 // is called once per category. The |suggestions| parameter always contains |
| 42 // the full list of currently available suggestions for that category, i.e., | 41 // the full list of currently available suggestions for that category, i.e., |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 CategoryFactory* category_factory() const { return category_factory_; } | 142 CategoryFactory* category_factory() const { return category_factory_; } |
| 144 | 143 |
| 145 private: | 144 private: |
| 146 Observer* observer_; | 145 Observer* observer_; |
| 147 CategoryFactory* category_factory_; | 146 CategoryFactory* category_factory_; |
| 148 }; | 147 }; |
| 149 | 148 |
| 150 } // namespace ntp_snippets | 149 } // namespace ntp_snippets |
| 151 | 150 |
| 152 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_PROVIDER_H_ | 151 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_PROVIDER_H_ |
| OLD | NEW |