| OLD | NEW |
| 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 "content/browser/download/download_manager.h" | 5 #include "content/browser/download/download_manager.h" |
| 6 | 6 |
| 7 #include <iterator> | 7 #include <iterator> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 606 // Clean up will happen when the history system create callback runs if we | 606 // Clean up will happen when the history system create callback runs if we |
| 607 // don't have a valid db_handle yet. | 607 // don't have a valid db_handle yet. |
| 608 if (download->db_handle() != DownloadItem::kUninitializedHandle) { | 608 if (download->db_handle() != DownloadItem::kUninitializedHandle) { |
| 609 in_progress_.erase(download->id()); | 609 in_progress_.erase(download->id()); |
| 610 active_downloads_.erase(download->id()); | 610 active_downloads_.erase(download->id()); |
| 611 UpdateDownloadProgress(); // Reflect removal from in_progress_. | 611 UpdateDownloadProgress(); // Reflect removal from in_progress_. |
| 612 delegate_->UpdateItemInPersistentStore(download); | 612 delegate_->UpdateItemInPersistentStore(download); |
| 613 } | 613 } |
| 614 } | 614 } |
| 615 | 615 |
| 616 void DownloadManager::SetDownloadManagerDelegate( |
| 617 DownloadManagerDelegate* delegate) { |
| 618 delegate_ = delegate; |
| 619 } |
| 620 |
| 616 void DownloadManager::UpdateDownloadProgress() { | 621 void DownloadManager::UpdateDownloadProgress() { |
| 617 delegate_->DownloadProgressUpdated(); | 622 delegate_->DownloadProgressUpdated(); |
| 618 } | 623 } |
| 619 | 624 |
| 620 int DownloadManager::RemoveDownloadItems( | 625 int DownloadManager::RemoveDownloadItems( |
| 621 const DownloadVector& pending_deletes) { | 626 const DownloadVector& pending_deletes) { |
| 622 if (pending_deletes.empty()) | 627 if (pending_deletes.empty()) |
| 623 return 0; | 628 return 0; |
| 624 | 629 |
| 625 // Delete from internal maps. | 630 // Delete from internal maps. |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1061 DCHECK(ContainsKey(save_page_downloads_, download->id())); | 1066 DCHECK(ContainsKey(save_page_downloads_, download->id())); |
| 1062 save_page_downloads_.erase(download->id()); | 1067 save_page_downloads_.erase(download->id()); |
| 1063 | 1068 |
| 1064 if (download->IsComplete()) | 1069 if (download->IsComplete()) |
| 1065 NotificationService::current()->Notify( | 1070 NotificationService::current()->Notify( |
| 1066 content::NOTIFICATION_SAVE_PACKAGE_SUCCESSFULLY_FINISHED, | 1071 content::NOTIFICATION_SAVE_PACKAGE_SUCCESSFULLY_FINISHED, |
| 1067 Source<DownloadManager>(this), | 1072 Source<DownloadManager>(this), |
| 1068 Details<DownloadItem>(download)); | 1073 Details<DownloadItem>(download)); |
| 1069 } | 1074 } |
| 1070 } | 1075 } |
| OLD | NEW |