Index: chrome/browser/ui/webui/downloads_dom_handler.cc |
diff --git a/chrome/browser/ui/webui/downloads_dom_handler.cc b/chrome/browser/ui/webui/downloads_dom_handler.cc |
index 5ab35f113d923063dcddd69aa4d7f34c611bbe1d..83c753e117528f88fbe891c6801d22dc592253f5 100644 |
--- a/chrome/browser/ui/webui/downloads_dom_handler.cc |
+++ b/chrome/browser/ui/webui/downloads_dom_handler.cc |
@@ -532,8 +532,8 @@ void DownloadsDOMHandler::HandleClearAll(const base::ListValue* args) { |
CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_CLEAR_ALL); |
std::vector<content::DownloadItem*> downloads; |
- if (main_notifier_.GetManager()) |
- main_notifier_.GetManager()->GetAllDownloads(&downloads); |
+ if (GetMainNotifierManager()) |
+ GetMainNotifierManager()->GetAllDownloads(&downloads); |
if (original_notifier_ && original_notifier_->GetManager()) |
original_notifier_->GetManager()->GetAllDownloads(&downloads); |
RemoveDownloads(downloads); |
@@ -543,8 +543,10 @@ void DownloadsDOMHandler::RemoveDownloads( |
const std::vector<content::DownloadItem*>& to_remove) { |
std::set<uint32> ids; |
for (auto* download : to_remove) { |
- if (IsRemoved(*download)) |
+ if (IsRemoved(*download) || |
+ download->GetState() == content::DownloadItem::IN_PROGRESS) { |
continue; |
+ } |
DownloadsDOMHandlerData::Create(download)->set_is_removed(true); |
ids.insert(download->GetId()); |
@@ -579,6 +581,10 @@ void DownloadsDOMHandler::ScheduleSendCurrentDownloads() { |
weak_ptr_factory_.GetWeakPtr())); |
} |
+content::DownloadManager* DownloadsDOMHandler::GetMainNotifierManager() { |
+ return main_notifier_.GetManager(); |
+} |
+ |
void DownloadsDOMHandler::SendCurrentDownloads() { |
update_scheduled_ = false; |
content::DownloadManager::DownloadVector all_items, filtered_items; |