| 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_OFFLINE_PAGES_OFFLINE_PAGE_SUGGESTIONS_PROVIDER_
H_ | 5 #ifndef COMPONENTS_NTP_SNIPPETS_OFFLINE_PAGES_OFFLINE_PAGE_SUGGESTIONS_PROVIDER_
H_ |
| 6 #define COMPONENTS_NTP_SNIPPETS_OFFLINE_PAGES_OFFLINE_PAGE_SUGGESTIONS_PROVIDER_
H_ | 6 #define COMPONENTS_NTP_SNIPPETS_OFFLINE_PAGES_OFFLINE_PAGE_SUGGESTIONS_PROVIDER_
H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 const offline_pages::OfflinePageItem& offline_page) const; | 82 const offline_pages::OfflinePageItem& offline_page) const; |
| 83 | 83 |
| 84 // Gets the |kMaxSuggestionsCount| most recently visited OfflinePageItems from | 84 // Gets the |kMaxSuggestionsCount| most recently visited OfflinePageItems from |
| 85 // the list, orders them by last visit date and converts them to | 85 // the list, orders them by last visit date and converts them to |
| 86 // ContentSuggestions for the |category|. | 86 // ContentSuggestions for the |category|. |
| 87 std::vector<ContentSuggestion> GetMostRecentlyVisited( | 87 std::vector<ContentSuggestion> GetMostRecentlyVisited( |
| 88 Category category, | 88 Category category, |
| 89 std::vector<const offline_pages::OfflinePageItem*> offline_page_items) | 89 std::vector<const offline_pages::OfflinePageItem*> offline_page_items) |
| 90 const; | 90 const; |
| 91 | 91 |
| 92 // Reads dismissed IDs from the pref with name |pref_name|. | 92 // Fires the |OnSuggestionInvalidated| event for the suggestion corresponding |
| 93 std::set<std::string> ReadDismissedIDsFromPrefs( | 93 // to the given |offline_id| and clears it from the dismissed IDs list, if |
| 94 const std::string& pref_name) const; | 94 // necessary. |
| 95 void InvalidateSuggestion(Category category, int64_t offline_id); |
| 95 | 96 |
| 96 // Writes |dismissed_ids| to the pref with name |pref_name|. | 97 // Gets the preference name for storing the list of dismissed suggestion IDs |
| 97 void StoreDismissedIDsToPrefs(const std::string& pref_name, | 98 // for the given |category|. |
| 99 std::string GetDismissedPref(Category category) const; |
| 100 |
| 101 // Reads dismissed IDs for the given |category|. |
| 102 std::set<std::string> ReadDismissedIDsFromPrefs(Category category) const; |
| 103 |
| 104 // Writes |dismissed_ids| for the given |category|. |
| 105 void StoreDismissedIDsToPrefs(Category category, |
| 98 const std::set<std::string>& dismissed_ids); | 106 const std::set<std::string>& dismissed_ids); |
| 99 | 107 |
| 100 CategoryStatus recent_tabs_status_; | 108 CategoryStatus recent_tabs_status_; |
| 101 CategoryStatus downloads_status_; | 109 CategoryStatus downloads_status_; |
| 102 | 110 |
| 103 offline_pages::OfflinePageModel* offline_page_model_; | 111 offline_pages::OfflinePageModel* offline_page_model_; |
| 104 | 112 |
| 105 const Category recent_tabs_category_; | 113 const Category recent_tabs_category_; |
| 106 const Category downloads_category_; | 114 const Category downloads_category_; |
| 107 | 115 |
| 108 PrefService* pref_service_; | 116 PrefService* pref_service_; |
| 109 | 117 |
| 110 std::set<std::string> dismissed_recent_tab_ids_; | |
| 111 std::set<std::string> dismissed_download_ids_; | |
| 112 | |
| 113 // Whether the Download Manager UI is enabled, in which case the More button | 118 // Whether the Download Manager UI is enabled, in which case the More button |
| 114 // for the Downloads section can redirect there. | 119 // for the Downloads section can redirect there. |
| 115 const bool download_manager_ui_enabled_; | 120 const bool download_manager_ui_enabled_; |
| 116 | 121 |
| 117 DISALLOW_COPY_AND_ASSIGN(OfflinePageSuggestionsProvider); | 122 DISALLOW_COPY_AND_ASSIGN(OfflinePageSuggestionsProvider); |
| 118 }; | 123 }; |
| 119 | 124 |
| 120 } // namespace ntp_snippets | 125 } // namespace ntp_snippets |
| 121 | 126 |
| 122 #endif // COMPONENTS_NTP_SNIPPETS_OFFLINE_PAGES_OFFLINE_PAGE_SUGGESTIONS_PROVID
ER_H_ | 127 #endif // COMPONENTS_NTP_SNIPPETS_OFFLINE_PAGES_OFFLINE_PAGE_SUGGESTIONS_PROVID
ER_H_ |
| OLD | NEW |