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

Side by Side Diff: chrome/browser/download/download_manager.cc

Issue 6327016: Check for cancel in DownloadManager::OnAllDataSaved(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/download/download_manager.h" 5 #include "chrome/browser/download/download_manager.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 UpdateAppIcon(); // Reflect size updates. 502 UpdateAppIcon(); // Reflect size updates.
503 download_history_->UpdateEntry(download); 503 download_history_->UpdateEntry(download);
504 } 504 }
505 } 505 }
506 } 506 }
507 507
508 void DownloadManager::OnAllDataSaved(int32 download_id, int64 size) { 508 void DownloadManager::OnAllDataSaved(int32 download_id, int64 size) {
509 VLOG(20) << __FUNCTION__ << "()" << " download_id = " << download_id 509 VLOG(20) << __FUNCTION__ << "()" << " download_id = " << download_id
510 << " size = " << size; 510 << " size = " << size;
511 511
512 DCHECK_EQ(1U, active_downloads_.count(download_id)); 512 // If it's not in active_downloads_, that means it was cancelled; just
Paweł Hajdan Jr. 2011/01/25 07:27:46 How about removing the download from active_downlo
513 // ignore the notification.
514 if (active_downloads_.count(download_id) == 0)
515 return;
516
513 DownloadItem* download = active_downloads_[download_id]; 517 DownloadItem* download = active_downloads_[download_id];
514 download->OnAllDataSaved(size); 518 download->OnAllDataSaved(size);
515 519
516 MaybeCompleteDownload(download); 520 MaybeCompleteDownload(download);
517 } 521 }
518 522
519 bool DownloadManager::IsDownloadReadyForCompletion(DownloadItem* download) { 523 bool DownloadManager::IsDownloadReadyForCompletion(DownloadItem* download) {
520 // If we don't have all the data, the download is not ready for 524 // If we don't have all the data, the download is not ready for
521 // completion. 525 // completion.
522 if (!download->all_data_saved()) 526 if (!download->all_data_saved())
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
1125 observed_download_manager_->RemoveObserver(this); 1129 observed_download_manager_->RemoveObserver(this);
1126 } 1130 }
1127 1131
1128 void DownloadManager::OtherDownloadManagerObserver::ModelChanged() { 1132 void DownloadManager::OtherDownloadManagerObserver::ModelChanged() {
1129 observing_download_manager_->NotifyModelChanged(); 1133 observing_download_manager_->NotifyModelChanged();
1130 } 1134 }
1131 1135
1132 void DownloadManager::OtherDownloadManagerObserver::ManagerGoingDown() { 1136 void DownloadManager::OtherDownloadManagerObserver::ManagerGoingDown() {
1133 observed_download_manager_ = NULL; 1137 observed_download_manager_ = NULL;
1134 } 1138 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698