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

Side by Side Diff: content/browser/download/download_item_impl.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 // File method ordering: Methods in this file are in the same order as 5 // File method ordering: Methods in this file are in the same order as
6 // in download_item_impl.h, with the following exception: The public 6 // in download_item_impl.h, with the following exception: The public
7 // interface Start is placed in chronological order with the other 7 // interface Start is placed in chronological order with the other
8 // (private) routines that together define a DownloadItem's state 8 // (private) routines that together define a DownloadItem's state
9 // transitions as the download progresses. See "Download progression 9 // transitions as the download progresses. See "Download progression
10 // cascade" later in this file. 10 // cascade" later in this file.
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 const base::FilePath& DownloadItemImpl::GetTargetFilePath() const { 620 const base::FilePath& DownloadItemImpl::GetTargetFilePath() const {
621 return target_path_; 621 return target_path_;
622 } 622 }
623 623
624 const base::FilePath& DownloadItemImpl::GetForcedFilePath() const { 624 const base::FilePath& DownloadItemImpl::GetForcedFilePath() const {
625 // TODO(asanka): Get rid of GetForcedFilePath(). We should instead just 625 // TODO(asanka): Get rid of GetForcedFilePath(). We should instead just
626 // require that clients respect GetTargetFilePath() if it is already set. 626 // require that clients respect GetTargetFilePath() if it is already set.
627 return forced_file_path_; 627 return forced_file_path_;
628 } 628 }
629 629
630 base::FilePath DownloadItemImpl::GetLastUsedTargetPath() const {
asanka 2017/01/10 19:34:19 Is there a case where GetTargetFilePath() and GetF
qinmin 2017/01/10 22:06:29 Done.
631 if (GetForcedFilePath().empty())
632 return GetTargetFilePath();
633 return GetForcedFilePath();
634 }
635
630 base::FilePath DownloadItemImpl::GetFileNameToReportUser() const { 636 base::FilePath DownloadItemImpl::GetFileNameToReportUser() const {
631 if (!display_name_.empty()) 637 if (!display_name_.empty())
632 return display_name_; 638 return display_name_;
633 return target_path_.BaseName(); 639 return target_path_.BaseName();
634 } 640 }
635 641
636 DownloadItem::TargetDisposition DownloadItemImpl::GetTargetDisposition() const { 642 DownloadItem::TargetDisposition DownloadItemImpl::GetTargetDisposition() const {
637 return target_disposition_; 643 return target_disposition_;
638 } 644 }
639 645
(...skipping 1476 matching lines...) Expand 10 before | Expand all | Expand 10 after
2116 case RESUME_MODE_USER_CONTINUE: 2122 case RESUME_MODE_USER_CONTINUE:
2117 return "USER_CONTINUE"; 2123 return "USER_CONTINUE";
2118 case RESUME_MODE_USER_RESTART: 2124 case RESUME_MODE_USER_RESTART:
2119 return "USER_RESTART"; 2125 return "USER_RESTART";
2120 } 2126 }
2121 NOTREACHED() << "Unknown resume mode " << mode; 2127 NOTREACHED() << "Unknown resume mode " << mode;
2122 return "unknown"; 2128 return "unknown";
2123 } 2129 }
2124 2130
2125 } // namespace content 2131 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698