Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(646)

Side by Side Diff: content/browser/download/download_item_impl_delegate.cc

Issue 2618743006: Use previous target path when resuming a download after crash (Closed)
Patch Set: adding a helper function to get last used target path Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_item_impl_delegate.h" 5 #include "content/browser/download/download_item_impl_delegate.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/browser/download/download_item_impl.h" 8 #include "content/browser/download/download_item_impl.h"
9 9
10 namespace content { 10 namespace content {
(...skipping 11 matching lines...) Expand all
22 ++count_; 22 ++count_;
23 } 23 }
24 24
25 void DownloadItemImplDelegate::Detach() { 25 void DownloadItemImplDelegate::Detach() {
26 DCHECK_LT(0, count_); 26 DCHECK_LT(0, count_);
27 --count_; 27 --count_;
28 } 28 }
29 29
30 void DownloadItemImplDelegate::DetermineDownloadTarget( 30 void DownloadItemImplDelegate::DetermineDownloadTarget(
31 DownloadItemImpl* download, const DownloadTargetCallback& callback) { 31 DownloadItemImpl* download, const DownloadTargetCallback& callback) {
32 // TODO(rdsmith/asanka): Do something useful if forced file path is null. 32 // TODO(qinmin): Do something useful if both forced file path and
33 base::FilePath target_path(download->GetForcedFilePath()); 33 // target file path are null.
asanka 2017/01/10 19:34:19 Also note that this code path is unreachable in Ch
qinmin 2017/01/10 22:06:29 Done
34 base::FilePath target_path = download->GetLastUsedTargetPath();
34 callback.Run(target_path, 35 callback.Run(target_path,
35 DownloadItem::TARGET_DISPOSITION_OVERWRITE, 36 DownloadItem::TARGET_DISPOSITION_OVERWRITE,
36 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, 37 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
37 target_path); 38 target_path);
38 } 39 }
39 40
40 bool DownloadItemImplDelegate::ShouldCompleteDownload( 41 bool DownloadItemImplDelegate::ShouldCompleteDownload(
41 DownloadItemImpl* download, 42 DownloadItemImpl* download,
42 const base::Closure& complete_callback) { 43 const base::Closure& complete_callback) {
43 return true; 44 return true;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 76
76 void DownloadItemImplDelegate::ShowDownloadInShell(DownloadItemImpl* download) { 77 void DownloadItemImplDelegate::ShowDownloadInShell(DownloadItemImpl* download) {
77 } 78 }
78 79
79 void DownloadItemImplDelegate::DownloadRemoved(DownloadItemImpl* download) {} 80 void DownloadItemImplDelegate::DownloadRemoved(DownloadItemImpl* download) {}
80 81
81 void DownloadItemImplDelegate::AssertStateConsistent( 82 void DownloadItemImplDelegate::AssertStateConsistent(
82 DownloadItemImpl* download) const {} 83 DownloadItemImpl* download) const {}
83 84
84 } // namespace content 85 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698