| Index: content/browser/download/download_manager_impl.cc
|
| diff --git a/content/browser/download/download_manager_impl.cc b/content/browser/download/download_manager_impl.cc
|
| index 8131d2740b1bbc811762e9fd9e361eda65287c10..2ef6b930ecd4e6a846d2f3a007554614dba8f534 100644
|
| --- a/content/browser/download/download_manager_impl.cc
|
| +++ b/content/browser/download/download_manager_impl.cc
|
| @@ -588,25 +588,10 @@ DownloadInterruptReason DownloadManagerImpl::BeginDownloadRequest(
|
| return DOWNLOAD_INTERRUPT_REASON_NONE;
|
| }
|
|
|
| -namespace {
|
| -
|
| -bool EmptyFilter(const GURL& url) {
|
| - return true;
|
| -}
|
| -
|
| -bool RemoveDownloadByURLAndTime(
|
| +int DownloadManagerImpl::RemoveDownloadsByURLAndTime(
|
| const base::Callback<bool(const GURL&)>& url_filter,
|
| - base::Time remove_begin,
|
| - base::Time remove_end,
|
| - const DownloadItemImpl* download_item) {
|
| - return url_filter.Run(download_item->GetURL()) &&
|
| - download_item->GetStartTime() >= remove_begin &&
|
| - (remove_end.is_null() || download_item->GetStartTime() < remove_end);
|
| -}
|
| -
|
| -} // namespace
|
| -
|
| -int DownloadManagerImpl::RemoveDownloads(const DownloadRemover& remover) {
|
| + base::Time remove_begin,
|
| + base::Time remove_end) {
|
| int count = 0;
|
| auto it = downloads_.begin();
|
| while (it != downloads_.end()) {
|
| @@ -616,7 +601,9 @@ int DownloadManagerImpl::RemoveDownloads(const DownloadRemover& remover) {
|
| ++it;
|
|
|
| if (download->GetState() != DownloadItem::IN_PROGRESS &&
|
| - remover.Run(download)) {
|
| + url_filter.Run(download->GetURL()) &&
|
| + download->GetStartTime() >= remove_begin &&
|
| + (remove_end.is_null() || download->GetStartTime() < remove_end)) {
|
| download->Remove();
|
| count++;
|
| }
|
| @@ -624,25 +611,6 @@ int DownloadManagerImpl::RemoveDownloads(const DownloadRemover& remover) {
|
| return count;
|
| }
|
|
|
| -int DownloadManagerImpl::RemoveDownloadsByURLAndTime(
|
| - const base::Callback<bool(const GURL&)>& url_filter,
|
| - base::Time remove_begin,
|
| - base::Time remove_end) {
|
| - return RemoveDownloads(base::Bind(&RemoveDownloadByURLAndTime,
|
| - url_filter,
|
| - remove_begin, remove_end));
|
| -}
|
| -
|
| -int DownloadManagerImpl::RemoveAllDownloads() {
|
| - const base::Callback<bool(const GURL&)> empty_filter =
|
| - base::Bind(&EmptyFilter);
|
| - // The null times make the date range unbounded.
|
| - int num_deleted = RemoveDownloadsByURLAndTime(
|
| - empty_filter, base::Time(), base::Time());
|
| - RecordClearAllSize(num_deleted);
|
| - return num_deleted;
|
| -}
|
| -
|
| void DownloadManagerImpl::DownloadUrl(
|
| std::unique_ptr<DownloadUrlParameters> params) {
|
| if (params->post_id() >= 0) {
|
|
|