Chromium Code Reviews| Index: components/offline_items_collection/core/offline_content_provider.h |
| diff --git a/components/offline_items_collection/core/offline_content_provider.h b/components/offline_items_collection/core/offline_content_provider.h |
| index 353a7bc25205f915961660263132cc9b55fd614d..a8026f999316a3572bb987971f67f11fef967df8 100644 |
| --- a/components/offline_items_collection/core/offline_content_provider.h |
| +++ b/components/offline_items_collection/core/offline_content_provider.h |
| @@ -8,6 +8,7 @@ |
| #include <string> |
| #include <vector> |
| +#include "base/callback.h" |
| #include "base/macros.h" |
| #include "url/gurl.h" |
| @@ -15,6 +16,7 @@ namespace offline_items_collection { |
| struct ContentId; |
| struct OfflineItem; |
| +struct OfflineItemVisuals; |
| // A provider of a set of OfflineItems that are meant to be exposed to the UI. |
| // The provider is required to notify all observers of OnItemsAvailable when the |
| @@ -23,6 +25,8 @@ struct OfflineItem; |
| class OfflineContentProvider { |
| public: |
| using OfflineItemList = std::vector<OfflineItem>; |
| + using VisualsCallback = |
| + base::Callback<void(const ContentId&, const OfflineItemVisuals*)>; |
| // An observer class that should be notified of relevant changes to the |
| // underlying data source. |
| @@ -44,6 +48,7 @@ class OfflineContentProvider { |
| // Called when the contents of |item| have been updated and the UI should be |
| // refreshed for that item. |
| + // TODO(dtrainor): Make this take a list of OfflineItems. |
| virtual void OnItemUpdated(const OfflineItem& item) = 0; |
| protected: |
| @@ -79,6 +84,13 @@ class OfflineContentProvider { |
| // Returns all OfflineItems for this particular provider. |
| virtual OfflineItemList GetAllItems() = 0; |
| + // Asks for an OfflineItemVisuals struct for an OfflineItem represented by |
| + // |id| or |nullptr| if one doesn't exist. The caller should post any |
|
nyquist
2017/04/13 05:08:25
The "caller"? Do you mean the implementor of the i
David Trainor- moved to gerrit
2017/04/13 07:20:23
Ah yeah sorry thanks!
|
| + // replies even if the results are available immediately to prevent reentrancy |
| + // and for consistent behavior. |
| + virtual void GetVisualsForItem(const ContentId& id, |
| + const VisualsCallback& callback) = 0; |
| + |
| // Adds an observer that should be notified of OfflineItem list modifications. |
| // If the provider is already initialized OnItemsAvailable should be scheduled |
| // on this observer (suggested over calling the method directly to avoid |