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

Unified Diff: chrome/browser/views/download_shelf_view.cc

Issue 3127008: Preliminary work on resuming downloads whose connections have expired.
Patch Set: Waiting to send download automation error message until after other downloads are canceled. Created 10 years, 3 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
Index: chrome/browser/views/download_shelf_view.cc
diff --git a/chrome/browser/views/download_shelf_view.cc b/chrome/browser/views/download_shelf_view.cc
index 3f9a825cc48285e11167b98b2dc21a14c07c837b..f4e9655c5dba275fff999d2c79dcd2b855ee7511 100644
--- a/chrome/browser/views/download_shelf_view.cc
+++ b/chrome/browser/views/download_shelf_view.cc
@@ -140,8 +140,15 @@ void DownloadShelfView::AddDownloadView(DownloadItemView* view) {
}
void DownloadShelfView::AddDownload(BaseDownloadItemModel* download_model) {
- DownloadItemView* view = new DownloadItemView(
- download_model->download(), this, download_model);
+ DownloadItem* dld = download_model->download();
+ // If we already have an ID, we must be restarting an interrupted download.
+ // Don't add a new one in this case.
+ for (size_t i = 0; i < download_views_.size(); ++i) {
+ DownloadItem* download = download_views_[i]->download();
+ if (download->id() == dld->id())
+ return;
+ }
+ DownloadItemView* view = new DownloadItemView(dld, this, download_model);
AddDownloadView(view);
}

Powered by Google App Engine
This is Rietveld 408576698