| 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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 } | 235 } |
| 236 | 236 |
| 237 void DownloadSuggestionsProvider::FetchSuggestionImage( | 237 void DownloadSuggestionsProvider::FetchSuggestionImage( |
| 238 const ContentSuggestion::ID& suggestion_id, | 238 const ContentSuggestion::ID& suggestion_id, |
| 239 const ntp_snippets::ImageFetchedCallback& callback) { | 239 const ntp_snippets::ImageFetchedCallback& callback) { |
| 240 // TODO(vitaliii): Fetch proper thumbnail from OfflinePageModel once it is | 240 // TODO(vitaliii): Fetch proper thumbnail from OfflinePageModel once it is |
| 241 // available there. | 241 // available there. |
| 242 // TODO(vitaliii): Provide site's favicon for assets downloads or file type. | 242 // TODO(vitaliii): Provide site's favicon for assets downloads or file type. |
| 243 // See crbug.com/631447. | 243 // See crbug.com/631447. |
| 244 base::ThreadTaskRunnerHandle::Get()->PostTask( | 244 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 245 FROM_HERE, base::Bind(callback, gfx::Image())); | 245 FROM_HERE, base::BindOnce(callback, gfx::Image())); |
| 246 } | 246 } |
| 247 | 247 |
| 248 void DownloadSuggestionsProvider::Fetch( | 248 void DownloadSuggestionsProvider::Fetch( |
| 249 const ntp_snippets::Category& category, | 249 const ntp_snippets::Category& category, |
| 250 const std::set<std::string>& known_suggestion_ids, | 250 const std::set<std::string>& known_suggestion_ids, |
| 251 const ntp_snippets::FetchDoneCallback& callback) { | 251 const ntp_snippets::FetchDoneCallback& callback) { |
| 252 LOG(DFATAL) << "DownloadSuggestionsProvider has no |Fetch| functionality!"; | 252 LOG(DFATAL) << "DownloadSuggestionsProvider has no |Fetch| functionality!"; |
| 253 base::ThreadTaskRunnerHandle::Get()->PostTask( | 253 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 254 FROM_HERE, | 254 FROM_HERE, |
| 255 base::Bind( | 255 base::BindOnce( |
| 256 callback, | 256 callback, |
| 257 ntp_snippets::Status( | 257 ntp_snippets::Status( |
| 258 ntp_snippets::StatusCode::PERMANENT_ERROR, | 258 ntp_snippets::StatusCode::PERMANENT_ERROR, |
| 259 "DownloadSuggestionsProvider has no |Fetch| functionality!"), | 259 "DownloadSuggestionsProvider has no |Fetch| functionality!"), |
| 260 base::Passed(std::vector<ContentSuggestion>()))); | 260 base::Passed(std::vector<ContentSuggestion>()))); |
| 261 } | 261 } |
| 262 | 262 |
| 263 void DownloadSuggestionsProvider::ClearHistory( | 263 void DownloadSuggestionsProvider::ClearHistory( |
| 264 base::Time begin, | 264 base::Time begin, |
| 265 base::Time end, | 265 base::Time end, |
| (...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 849 void DownloadSuggestionsProvider::UnregisterDownloadItemObservers() { | 849 void DownloadSuggestionsProvider::UnregisterDownloadItemObservers() { |
| 850 DCHECK_NE(download_manager_, nullptr); | 850 DCHECK_NE(download_manager_, nullptr); |
| 851 | 851 |
| 852 std::vector<DownloadItem*> all_downloads; | 852 std::vector<DownloadItem*> all_downloads; |
| 853 download_manager_->GetAllDownloads(&all_downloads); | 853 download_manager_->GetAllDownloads(&all_downloads); |
| 854 | 854 |
| 855 for (DownloadItem* item : all_downloads) { | 855 for (DownloadItem* item : all_downloads) { |
| 856 item->RemoveObserver(this); | 856 item->RemoveObserver(this); |
| 857 } | 857 } |
| 858 } | 858 } |
| OLD | NEW |