| 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 #include "chrome/browser/ntp_snippets/download_suggestions_provider.h" | 5 #include "chrome/browser/ntp_snippets/download_suggestions_provider.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 Category category) { | 181 Category category) { |
| 182 DCHECK_EQ(provided_category_, category); | 182 DCHECK_EQ(provided_category_, category); |
| 183 return category_status_; | 183 return category_status_; |
| 184 } | 184 } |
| 185 | 185 |
| 186 CategoryInfo DownloadSuggestionsProvider::GetCategoryInfo(Category category) { | 186 CategoryInfo DownloadSuggestionsProvider::GetCategoryInfo(Category category) { |
| 187 DCHECK_EQ(provided_category_, category); | 187 DCHECK_EQ(provided_category_, category); |
| 188 return CategoryInfo( | 188 return CategoryInfo( |
| 189 l10n_util::GetStringUTF16(IDS_NTP_DOWNLOAD_SUGGESTIONS_SECTION_HEADER), | 189 l10n_util::GetStringUTF16(IDS_NTP_DOWNLOAD_SUGGESTIONS_SECTION_HEADER), |
| 190 ntp_snippets::ContentSuggestionsCardLayout::MINIMAL_CARD, | 190 ntp_snippets::ContentSuggestionsCardLayout::MINIMAL_CARD, |
| 191 /*has_more_action=*/false, | 191 /*has_fetch_action=*/false, |
| 192 /*has_reload_action=*/false, | |
| 193 /*has_view_all_action=*/true, | 192 /*has_view_all_action=*/true, |
| 194 /*show_if_empty=*/false, | 193 /*show_if_empty=*/false, |
| 195 l10n_util::GetStringUTF16(IDS_NTP_DOWNLOADS_SUGGESTIONS_SECTION_EMPTY)); | 194 l10n_util::GetStringUTF16(IDS_NTP_DOWNLOADS_SUGGESTIONS_SECTION_EMPTY)); |
| 196 } | 195 } |
| 197 | 196 |
| 198 void DownloadSuggestionsProvider::DismissSuggestion( | 197 void DownloadSuggestionsProvider::DismissSuggestion( |
| 199 const ContentSuggestion::ID& suggestion_id) { | 198 const ContentSuggestion::ID& suggestion_id) { |
| 200 DCHECK_EQ(provided_category_, suggestion_id.category()); | 199 DCHECK_EQ(provided_category_, suggestion_id.category()); |
| 201 std::set<std::string> dismissed_ids = | 200 std::set<std::string> dismissed_ids = |
| 202 ReadDismissedIDsFromPrefs(CorrespondsToOfflinePage(suggestion_id)); | 201 ReadDismissedIDsFromPrefs(CorrespondsToOfflinePage(suggestion_id)); |
| (...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 810 void DownloadSuggestionsProvider::UnregisterDownloadItemObservers() { | 809 void DownloadSuggestionsProvider::UnregisterDownloadItemObservers() { |
| 811 DCHECK_NE(download_manager_, nullptr); | 810 DCHECK_NE(download_manager_, nullptr); |
| 812 | 811 |
| 813 std::vector<DownloadItem*> all_downloads; | 812 std::vector<DownloadItem*> all_downloads; |
| 814 download_manager_->GetAllDownloads(&all_downloads); | 813 download_manager_->GetAllDownloads(&all_downloads); |
| 815 | 814 |
| 816 for (DownloadItem* item : all_downloads) { | 815 for (DownloadItem* item : all_downloads) { |
| 817 item->RemoveObserver(this); | 816 item->RemoveObserver(this); |
| 818 } | 817 } |
| 819 } | 818 } |
| OLD | NEW |