| 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 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 void DownloadManagerImpl::DetermineDownloadTarget( | 218 void DownloadManagerImpl::DetermineDownloadTarget( |
| 219 DownloadItemImpl* item, const DownloadTargetCallback& callback) { | 219 DownloadItemImpl* item, const DownloadTargetCallback& callback) { |
| 220 // Note that this next call relies on | 220 // Note that this next call relies on |
| 221 // DownloadItemImplDelegate::DownloadTargetCallback and | 221 // DownloadItemImplDelegate::DownloadTargetCallback and |
| 222 // DownloadManagerDelegate::DownloadTargetCallback having the same | 222 // DownloadManagerDelegate::DownloadTargetCallback having the same |
| 223 // type. If the types ever diverge, gasket code will need to | 223 // type. If the types ever diverge, gasket code will need to |
| 224 // be written here. | 224 // be written here. |
| 225 if (!delegate_ || !delegate_->DetermineDownloadTarget(item, callback)) { | 225 if (!delegate_ || !delegate_->DetermineDownloadTarget(item, callback)) { |
| 226 base::FilePath target_path = item->GetForcedFilePath(); | 226 base::FilePath target_path = item->GetForcedFilePath(); |
| 227 // TODO(asanka): Determine a useful path if |target_path| is empty. | 227 // TODO(asanka): Determine a useful path if |target_path| is empty. |
| 228 callback.Run(target_path, | 228 callback.Run(target_path, DownloadItem::TARGET_DISPOSITION_OVERWRITE, |
| 229 DownloadItem::TARGET_DISPOSITION_OVERWRITE, | 229 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, target_path, |
| 230 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, | 230 DOWNLOAD_INTERRUPT_REASON_NONE); |
| 231 target_path); | |
| 232 } | 231 } |
| 233 } | 232 } |
| 234 | 233 |
| 235 bool DownloadManagerImpl::ShouldCompleteDownload( | 234 bool DownloadManagerImpl::ShouldCompleteDownload( |
| 236 DownloadItemImpl* item, const base::Closure& complete_callback) { | 235 DownloadItemImpl* item, const base::Closure& complete_callback) { |
| 237 if (!delegate_ || | 236 if (!delegate_ || |
| 238 delegate_->ShouldCompleteDownload(item, complete_callback)) { | 237 delegate_->ShouldCompleteDownload(item, complete_callback)) { |
| 239 return true; | 238 return true; |
| 240 } | 239 } |
| 241 // Otherwise, the delegate has accepted responsibility to run the | 240 // Otherwise, the delegate has accepted responsibility to run the |
| (...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 747 if (delegate_) | 746 if (delegate_) |
| 748 delegate_->OpenDownload(download); | 747 delegate_->OpenDownload(download); |
| 749 } | 748 } |
| 750 | 749 |
| 751 void DownloadManagerImpl::ShowDownloadInShell(DownloadItemImpl* download) { | 750 void DownloadManagerImpl::ShowDownloadInShell(DownloadItemImpl* download) { |
| 752 if (delegate_) | 751 if (delegate_) |
| 753 delegate_->ShowDownloadInShell(download); | 752 delegate_->ShowDownloadInShell(download); |
| 754 } | 753 } |
| 755 | 754 |
| 756 } // namespace content | 755 } // namespace content |
| OLD | NEW |