| 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 CHROME_BROWSER_NTP_SNIPPETS_DOWNLOAD_SUGGESTIONS_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_NTP_SNIPPETS_DOWNLOAD_SUGGESTIONS_PROVIDER_H_ |
| 6 #define CHROME_BROWSER_NTP_SNIPPETS_DOWNLOAD_SUGGESTIONS_PROVIDER_H_ | 6 #define CHROME_BROWSER_NTP_SNIPPETS_DOWNLOAD_SUGGESTIONS_PROVIDER_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 public offline_pages::OfflinePageModel::Observer, | 39 public offline_pages::OfflinePageModel::Observer, |
| 40 public content::DownloadManager::Observer, | 40 public content::DownloadManager::Observer, |
| 41 public content::DownloadItem::Observer, | 41 public content::DownloadItem::Observer, |
| 42 public DownloadHistory::Observer { | 42 public DownloadHistory::Observer { |
| 43 public: | 43 public: |
| 44 DownloadSuggestionsProvider( | 44 DownloadSuggestionsProvider( |
| 45 ContentSuggestionsProvider::Observer* observer, | 45 ContentSuggestionsProvider::Observer* observer, |
| 46 offline_pages::OfflinePageModel* offline_page_model, | 46 offline_pages::OfflinePageModel* offline_page_model, |
| 47 content::DownloadManager* download_manager, | 47 content::DownloadManager* download_manager, |
| 48 DownloadHistory* download_history, | 48 DownloadHistory* download_history, |
| 49 PrefService* pref_service, | 49 PrefService* pref_service); |
| 50 bool download_manager_ui_enabled); | |
| 51 ~DownloadSuggestionsProvider() override; | 50 ~DownloadSuggestionsProvider() override; |
| 52 | 51 |
| 53 // ContentSuggestionsProvider implementation. | 52 // ContentSuggestionsProvider implementation. |
| 54 ntp_snippets::CategoryStatus GetCategoryStatus( | 53 ntp_snippets::CategoryStatus GetCategoryStatus( |
| 55 ntp_snippets::Category category) override; | 54 ntp_snippets::Category category) override; |
| 56 ntp_snippets::CategoryInfo GetCategoryInfo( | 55 ntp_snippets::CategoryInfo GetCategoryInfo( |
| 57 ntp_snippets::Category category) override; | 56 ntp_snippets::Category category) override; |
| 58 void DismissSuggestion( | 57 void DismissSuggestion( |
| 59 const ntp_snippets::ContentSuggestion::ID& suggestion_id) override; | 58 const ntp_snippets::ContentSuggestion::ID& suggestion_id) override; |
| 60 void FetchSuggestionImage( | 59 void FetchSuggestionImage( |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 // |kMaxSuggestionsCount| offline pages, then all of them which satisfy the | 214 // |kMaxSuggestionsCount| offline pages, then all of them which satisfy the |
| 216 // criteria above are cached, otherwise only |kMaxSuggestionsCount|. | 215 // criteria above are cached, otherwise only |kMaxSuggestionsCount|. |
| 217 std::vector<offline_pages::OfflinePageItem> cached_offline_page_downloads_; | 216 std::vector<offline_pages::OfflinePageItem> cached_offline_page_downloads_; |
| 218 // Cached asset downloads. If there are not enough offline page downloads, all | 217 // Cached asset downloads. If there are not enough offline page downloads, all |
| 219 // of these could be shown (they are the most recently downloaded, not | 218 // of these could be shown (they are the most recently downloaded, not |
| 220 // dismissed and not invalidated). Order is undefined. If the model has less | 219 // dismissed and not invalidated). Order is undefined. If the model has less |
| 221 // than |kMaxSuggestionsCount| asset downloads, then all of them which satisfy | 220 // than |kMaxSuggestionsCount| asset downloads, then all of them which satisfy |
| 222 // the criteria above are cached, otherwise only |kMaxSuggestionsCount|. | 221 // the criteria above are cached, otherwise only |kMaxSuggestionsCount|. |
| 223 std::vector<const content::DownloadItem*> cached_asset_downloads_; | 222 std::vector<const content::DownloadItem*> cached_asset_downloads_; |
| 224 | 223 |
| 225 // Whether the Download Manager UI is enabled, in which case the More button | |
| 226 // for the Downloads section can redirect there. | |
| 227 const bool download_manager_ui_enabled_; | |
| 228 | |
| 229 bool is_asset_downloads_initialization_complete_; | 224 bool is_asset_downloads_initialization_complete_; |
| 230 | 225 |
| 231 base::WeakPtrFactory<DownloadSuggestionsProvider> weak_ptr_factory_; | 226 base::WeakPtrFactory<DownloadSuggestionsProvider> weak_ptr_factory_; |
| 232 | 227 |
| 233 DISALLOW_COPY_AND_ASSIGN(DownloadSuggestionsProvider); | 228 DISALLOW_COPY_AND_ASSIGN(DownloadSuggestionsProvider); |
| 234 }; | 229 }; |
| 235 | 230 |
| 236 #endif // CHROME_BROWSER_NTP_SNIPPETS_DOWNLOAD_SUGGESTIONS_PROVIDER_H_ | 231 #endif // CHROME_BROWSER_NTP_SNIPPETS_DOWNLOAD_SUGGESTIONS_PROVIDER_H_ |
| OLD | NEW |