| 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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 void DownloadManagerImpl::DetermineDownloadTarget( | 215 void DownloadManagerImpl::DetermineDownloadTarget( |
| 216 DownloadItemImpl* item, const DownloadTargetCallback& callback) { | 216 DownloadItemImpl* item, const DownloadTargetCallback& callback) { |
| 217 // Note that this next call relies on | 217 // Note that this next call relies on |
| 218 // DownloadItemImplDelegate::DownloadTargetCallback and | 218 // DownloadItemImplDelegate::DownloadTargetCallback and |
| 219 // DownloadManagerDelegate::DownloadTargetCallback having the same | 219 // DownloadManagerDelegate::DownloadTargetCallback having the same |
| 220 // type. If the types ever diverge, gasket code will need to | 220 // type. If the types ever diverge, gasket code will need to |
| 221 // be written here. | 221 // be written here. |
| 222 if (!delegate_ || !delegate_->DetermineDownloadTarget(item, callback)) { | 222 if (!delegate_ || !delegate_->DetermineDownloadTarget(item, callback)) { |
| 223 base::FilePath target_path = item->GetForcedFilePath(); | 223 base::FilePath target_path = item->GetForcedFilePath(); |
| 224 // TODO(asanka): Determine a useful path if |target_path| is empty. | 224 // TODO(asanka): Determine a useful path if |target_path| is empty. |
| 225 callback.Run(target_path, | 225 callback.Run(target_path, DownloadItem::TARGET_DISPOSITION_OVERWRITE, |
| 226 DownloadItem::TARGET_DISPOSITION_OVERWRITE, | 226 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, target_path, |
| 227 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, | 227 DOWNLOAD_INTERRUPT_REASON_NONE); |
| 228 target_path); | |
| 229 } | 228 } |
| 230 } | 229 } |
| 231 | 230 |
| 232 bool DownloadManagerImpl::ShouldCompleteDownload( | 231 bool DownloadManagerImpl::ShouldCompleteDownload( |
| 233 DownloadItemImpl* item, const base::Closure& complete_callback) { | 232 DownloadItemImpl* item, const base::Closure& complete_callback) { |
| 234 if (!delegate_ || | 233 if (!delegate_ || |
| 235 delegate_->ShouldCompleteDownload(item, complete_callback)) { | 234 delegate_->ShouldCompleteDownload(item, complete_callback)) { |
| 236 return true; | 235 return true; |
| 237 } | 236 } |
| 238 // Otherwise, the delegate has accepted responsibility to run the | 237 // Otherwise, the delegate has accepted responsibility to run the |
| (...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 764 if (delegate_) | 763 if (delegate_) |
| 765 delegate_->OpenDownload(download); | 764 delegate_->OpenDownload(download); |
| 766 } | 765 } |
| 767 | 766 |
| 768 void DownloadManagerImpl::ShowDownloadInShell(DownloadItemImpl* download) { | 767 void DownloadManagerImpl::ShowDownloadInShell(DownloadItemImpl* download) { |
| 769 if (delegate_) | 768 if (delegate_) |
| 770 delegate_->ShowDownloadInShell(download); | 769 delegate_->ShowDownloadInShell(download); |
| 771 } | 770 } |
| 772 | 771 |
| 773 } // namespace content | 772 } // namespace content |
| OLD | NEW |