Chromium Code Reviews| 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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 213 } | 213 } |
| 214 | 214 |
| 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().empty() ? |
|
asanka
2017/01/10 22:24:03
Ditto. No need to change //content filename determ
qinmin
2017/01/10 23:04:42
reverted
| |
| 224 // TODO(asanka): Determine a useful path if |target_path| is empty. | 224 item->GetTargetFilePath() : item->GetForcedFilePath(); |
| 225 // TODO(qinmin): Determine a useful path if |target_path| is empty. | |
| 225 callback.Run(target_path, | 226 callback.Run(target_path, |
| 226 DownloadItem::TARGET_DISPOSITION_OVERWRITE, | 227 DownloadItem::TARGET_DISPOSITION_OVERWRITE, |
| 227 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, | 228 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, |
| 228 target_path); | 229 target_path); |
| 229 } | 230 } |
| 230 } | 231 } |
| 231 | 232 |
| 232 bool DownloadManagerImpl::ShouldCompleteDownload( | 233 bool DownloadManagerImpl::ShouldCompleteDownload( |
| 233 DownloadItemImpl* item, const base::Closure& complete_callback) { | 234 DownloadItemImpl* item, const base::Closure& complete_callback) { |
| 234 if (!delegate_ || | 235 if (!delegate_ || |
| (...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 764 if (delegate_) | 765 if (delegate_) |
| 765 delegate_->OpenDownload(download); | 766 delegate_->OpenDownload(download); |
| 766 } | 767 } |
| 767 | 768 |
| 768 void DownloadManagerImpl::ShowDownloadInShell(DownloadItemImpl* download) { | 769 void DownloadManagerImpl::ShowDownloadInShell(DownloadItemImpl* download) { |
| 769 if (delegate_) | 770 if (delegate_) |
| 770 delegate_->ShowDownloadInShell(download); | 771 delegate_->ShowDownloadInShell(download); |
| 771 } | 772 } |
| 772 | 773 |
| 773 } // namespace content | 774 } // namespace content |
| OLD | NEW |