| 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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 CategoryStatus DownloadSuggestionsProvider::GetCategoryStatus( | 209 CategoryStatus DownloadSuggestionsProvider::GetCategoryStatus( |
| 210 Category category) { | 210 Category category) { |
| 211 DCHECK_EQ(provided_category_, category); | 211 DCHECK_EQ(provided_category_, category); |
| 212 return category_status_; | 212 return category_status_; |
| 213 } | 213 } |
| 214 | 214 |
| 215 CategoryInfo DownloadSuggestionsProvider::GetCategoryInfo(Category category) { | 215 CategoryInfo DownloadSuggestionsProvider::GetCategoryInfo(Category category) { |
| 216 DCHECK_EQ(provided_category_, category); | 216 DCHECK_EQ(provided_category_, category); |
| 217 return CategoryInfo( | 217 return CategoryInfo( |
| 218 l10n_util::GetStringUTF16(IDS_NTP_DOWNLOAD_SUGGESTIONS_SECTION_HEADER), | 218 l10n_util::GetStringUTF16(IDS_NTP_DOWNLOAD_SUGGESTIONS_SECTION_HEADER), |
| 219 ntp_snippets::ContentSuggestionsCardLayout::MINIMAL_CARD, | 219 ntp_snippets::ContentSuggestionsCardLayout::FULL_CARD, |
| 220 /*has_fetch_action=*/false, | 220 /*has_fetch_action=*/false, |
| 221 /*has_view_all_action=*/true, | 221 /*has_view_all_action=*/true, |
| 222 /*show_if_empty=*/false, | 222 /*show_if_empty=*/false, |
| 223 l10n_util::GetStringUTF16(IDS_NTP_DOWNLOADS_SUGGESTIONS_SECTION_EMPTY)); | 223 l10n_util::GetStringUTF16(IDS_NTP_DOWNLOADS_SUGGESTIONS_SECTION_EMPTY)); |
| 224 } | 224 } |
| 225 | 225 |
| 226 void DownloadSuggestionsProvider::DismissSuggestion( | 226 void DownloadSuggestionsProvider::DismissSuggestion( |
| 227 const ContentSuggestion::ID& suggestion_id) { | 227 const ContentSuggestion::ID& suggestion_id) { |
| 228 DCHECK_EQ(provided_category_, suggestion_id.category()); | 228 DCHECK_EQ(provided_category_, suggestion_id.category()); |
| 229 std::set<std::string> dismissed_ids = | 229 std::set<std::string> dismissed_ids = |
| (...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 851 void DownloadSuggestionsProvider::UnregisterDownloadItemObservers() { | 851 void DownloadSuggestionsProvider::UnregisterDownloadItemObservers() { |
| 852 DCHECK_NE(download_manager_, nullptr); | 852 DCHECK_NE(download_manager_, nullptr); |
| 853 | 853 |
| 854 std::vector<DownloadItem*> all_downloads; | 854 std::vector<DownloadItem*> all_downloads; |
| 855 download_manager_->GetAllDownloads(&all_downloads); | 855 download_manager_->GetAllDownloads(&all_downloads); |
| 856 | 856 |
| 857 for (DownloadItem* item : all_downloads) { | 857 for (DownloadItem* item : all_downloads) { |
| 858 item->RemoveObserver(this); | 858 item->RemoveObserver(this); |
| 859 } | 859 } |
| 860 } | 860 } |
| OLD | NEW |