Index: components/ntp_snippets/offline_pages/offline_page_suggestions_provider.h |
diff --git a/components/ntp_snippets/offline_pages/offline_page_suggestions_provider.h b/components/ntp_snippets/offline_pages/offline_page_suggestions_provider.h |
index 40ce31ad41090363421bc5dbb7ff710c2e574152..d7deca3711b0a0fe3b1770e991740020f906440e 100644 |
--- a/components/ntp_snippets/offline_pages/offline_page_suggestions_provider.h |
+++ b/components/ntp_snippets/offline_pages/offline_page_suggestions_provider.h |
@@ -35,6 +35,8 @@ class OfflinePageSuggestionsProvider |
public offline_pages::OfflinePageModel::Observer { |
public: |
OfflinePageSuggestionsProvider( |
+ bool recent_tabs_enabled, |
+ bool downloads_enabled, |
ContentSuggestionsProvider::Observer* observer, |
CategoryFactory* category_factory, |
offline_pages::OfflinePageModel* offline_page_model, |
@@ -69,28 +71,44 @@ class OfflinePageSuggestionsProvider |
void OnOfflinePagesLoaded( |
const offline_pages::MultipleOfflinePageItemResult& result); |
- // Updates the |category_status_| and notifies the |observer_|, if necessary. |
- void NotifyStatusChanged(CategoryStatus new_status); |
+ // Updates the |category_status_| of the |category| and notifies the |
+ // |observer_|, if necessary. |
+ void NotifyStatusChanged(Category category, CategoryStatus new_status); |
- // Converts an OfflinePageItem to a ContentSuggestion. |
+ // Converts an OfflinePageItem to a ContentSuggestion for the |category|. |
ContentSuggestion ConvertOfflinePage( |
+ Category category, |
const offline_pages::OfflinePageItem& offline_page) const; |
- // Reads |dismissed_ids_| from the prefs. |
- void ReadDismissedIDsFromPrefs(); |
+ // Gets the |kMaxSuggestionsCount| most recently visited OfflinePageItems from |
+ // the list, orders them by last visit date and converts them to |
+ // ContentSuggestions for the |category|. |
+ std::vector<ContentSuggestion> GetMostRecentlyVisited( |
+ Category category, |
+ std::vector<const offline_pages::OfflinePageItem*> offline_page_items) |
+ const; |
- // Writes |dismissed_ids_| to the prefs. |
- void StoreDismissedIDsToPrefs(); |
+ // Reads dismissed IDs from the pref with name |pref_name|. |
+ std::set<std::string> ReadDismissedIDsFromPrefs( |
+ const std::string& pref_name) const; |
- CategoryStatus category_status_; |
+ // Writes |dismissed_ids| to the pref with name |pref_name|. |
+ void StoreDismissedIDsToPrefs( |
+ const std::string& pref_name, |
+ const std::set<std::string>& dismissed_ids) const; |
Marc Treib
2016/08/12 10:12:53
nit: I wouldn't make this one const, since it fund
Philipp Keck
2016/08/12 10:22:55
Done.
|
+ |
+ CategoryStatus recent_tabs_status_; |
+ CategoryStatus downloads_status_; |
offline_pages::OfflinePageModel* offline_page_model_; |
- const Category provided_category_; |
+ const Category recent_tabs_category_; |
+ const Category downloads_category_; |
PrefService* pref_service_; |
- std::set<std::string> dismissed_ids_; |
+ std::set<std::string> dismissed_recent_tab_ids_; |
+ std::set<std::string> dismissed_download_ids_; |
DISALLOW_COPY_AND_ASSIGN(OfflinePageSuggestionsProvider); |
}; |