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 514ae7a0157fa46445cbfb804f5e7814e6292aef..2a3181c73c855d01c12bad99f2ab51968107d571 100644 |
--- a/chrome/browser/ui/webui/downloads_dom_handler.cc |
+++ b/chrome/browser/ui/webui/downloads_dom_handler.cc |
@@ -179,14 +179,6 @@ void DownloadsDOMHandler::OnDownloadUpdated(content::DownloadItem* download) { |
if (it == download_items_.end()) |
return; |
- if (download->GetState() == content::DownloadItem::REMOVING) { |
- (*it)->RemoveObserver(this); |
- *it = NULL; |
- // A later ModelChanged() notification will change the WebUI's |
- // view of the downloads list. |
- return; |
- } |
- |
const int id = static_cast<int>(it - download_items_.begin()); |
ListValue results_value; |
@@ -194,6 +186,17 @@ void DownloadsDOMHandler::OnDownloadUpdated(content::DownloadItem* download) { |
web_ui()->CallJavascriptFunction("downloadUpdated", results_value); |
} |
+void DownloadsDOMHandler::OnDownloadDestroyed( |
+ content::DownloadItem* download) { |
+ download->RemoveObserver(this); |
+ OrderedDownloads::iterator it = std::find(download_items_.begin(), |
+ download_items_.end(), |
+ download); |
+ *it = NULL; |
+ // A later ModelChanged() notification will change the WebUI's |
+ // view of the downloads list. |
+} |
+ |
// A download has started or been deleted. Query our DownloadManager for the |
// current set of downloads. |
void DownloadsDOMHandler::ModelChanged(content::DownloadManager* manager) { |
@@ -228,7 +231,6 @@ void DownloadsDOMHandler::ModelChanged(content::DownloadManager* manager) { |
// We should never see anything that isn't already in the history. |
DCHECK(*it); |
- DCHECK((*it)->IsPersisted()); |
(*it)->AddObserver(this); |
} |
@@ -316,7 +318,6 @@ void DownloadsDOMHandler::HandleRemove(const ListValue* args) { |
CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_REMOVE); |
content::DownloadItem* file = GetDownloadByValue(args); |
if (file) { |
- DCHECK(file->IsPersisted()); |
file->Remove(); |
} |
} |