| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_impl.h" | 5 #include "content/browser/download/download_manager_impl.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 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 | 346 |
| 347 if (download->IsDangerous() && download->IsPartialDownload()) { | 347 if (download->IsDangerous() && download->IsPartialDownload()) { |
| 348 // The user hasn't accepted it, so we need to remove it | 348 // The user hasn't accepted it, so we need to remove it |
| 349 // from the disk. This may or may not result in it being | 349 // from the disk. This may or may not result in it being |
| 350 // removed from the DownloadManager queues and deleted | 350 // removed from the DownloadManager queues and deleted |
| 351 // (specifically, DownloadManager::DownloadRemoved only | 351 // (specifically, DownloadManager::DownloadRemoved only |
| 352 // removes and deletes it if it's known to the history service) | 352 // removes and deletes it if it's known to the history service) |
| 353 // so the only thing we know after calling this function is that | 353 // so the only thing we know after calling this function is that |
| 354 // the download was deleted if-and-only-if it was removed | 354 // the download was deleted if-and-only-if it was removed |
| 355 // from all queues. | 355 // from all queues. |
| 356 download->Delete(DownloadItem::DELETE_DUE_TO_BROWSER_SHUTDOWN); | 356 download->DiscardDangerousDownload( |
| 357 DownloadItem::DELETE_DUE_TO_BROWSER_SHUTDOWN, |
| 358 DownloadItem::AcquireFileCallback()); |
| 357 } else if (download->IsPartialDownload()) { | 359 } else if (download->IsPartialDownload()) { |
| 358 download->Cancel(false); | 360 download->Cancel(false); |
| 359 } | 361 } |
| 360 } | 362 } |
| 361 | 363 |
| 362 // At this point, all dangerous downloads have had their files removed | 364 // At this point, all dangerous downloads have had their files removed |
| 363 // and all in progress downloads have been cancelled. We can now delete | 365 // and all in progress downloads have been cancelled. We can now delete |
| 364 // anything left. | 366 // anything left. |
| 365 | 367 |
| 366 STLDeleteValues(&downloads_); | 368 STLDeleteValues(&downloads_); |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 663 if (delegate_) | 665 if (delegate_) |
| 664 delegate_->OpenDownload(download); | 666 delegate_->OpenDownload(download); |
| 665 } | 667 } |
| 666 | 668 |
| 667 void DownloadManagerImpl::ShowDownloadInShell(DownloadItemImpl* download) { | 669 void DownloadManagerImpl::ShowDownloadInShell(DownloadItemImpl* download) { |
| 668 if (delegate_) | 670 if (delegate_) |
| 669 delegate_->ShowDownloadInShell(download); | 671 delegate_->ShowDownloadInShell(download); |
| 670 } | 672 } |
| 671 | 673 |
| 672 } // namespace content | 674 } // namespace content |
| OLD | NEW |