Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Unified Diff: chrome/browser/ui/webui/downloads_dom_handler.cc

Issue 10837125: Revert 149794 - DownloadItem::Observer::OnDownloadDestroyed() replaces DownloadItem::REMOVING (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1228/src/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/webui/downloads_dom_handler.h ('k') | content/browser/download/download_item_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/downloads_dom_handler.cc
===================================================================
--- chrome/browser/ui/webui/downloads_dom_handler.cc (revision 150095)
+++ chrome/browser/ui/webui/downloads_dom_handler.cc (working copy)
@@ -179,6 +179,14 @@
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;
@@ -186,17 +194,6 @@
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) {
« no previous file with comments | « chrome/browser/ui/webui/downloads_dom_handler.h ('k') | content/browser/download/download_item_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698