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

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

Issue 15011006: Remove DownloadItem::GetUserVerifiedFilePath() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge with r201294 Created 7 years, 7 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 | Annotate | Revision Log
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 576 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 const base::FilePath& DownloadItemImpl::GetTargetFilePath() const { 587 const base::FilePath& DownloadItemImpl::GetTargetFilePath() const {
588 return target_path_; 588 return target_path_;
589 } 589 }
590 590
591 const base::FilePath& DownloadItemImpl::GetForcedFilePath() const { 591 const base::FilePath& DownloadItemImpl::GetForcedFilePath() const {
592 // TODO(asanka): Get rid of GetForcedFilePath(). We should instead just 592 // TODO(asanka): Get rid of GetForcedFilePath(). We should instead just
593 // require that clients respect GetTargetFilePath() if it is already set. 593 // require that clients respect GetTargetFilePath() if it is already set.
594 return forced_file_path_; 594 return forced_file_path_;
595 } 595 }
596 596
597 // TODO(asanka): Get rid of GetUserVerifiedFilePath(). http://crbug.com/134237.
598 base::FilePath DownloadItemImpl::GetUserVerifiedFilePath() const {
599 return (IsDangerous() ||
600 danger_type_ == DOWNLOAD_DANGER_TYPE_USER_VALIDATED) ?
601 GetFullPath() : GetTargetFilePath();
602 }
603
604 base::FilePath DownloadItemImpl::GetFileNameToReportUser() const { 597 base::FilePath DownloadItemImpl::GetFileNameToReportUser() const {
605 if (!display_name_.empty()) 598 if (!display_name_.empty())
606 return display_name_; 599 return display_name_;
607 return target_path_.BaseName(); 600 return target_path_.BaseName();
608 } 601 }
609 602
610 DownloadItem::TargetDisposition DownloadItemImpl::GetTargetDisposition() const { 603 DownloadItem::TargetDisposition DownloadItemImpl::GetTargetDisposition() const {
611 return target_disposition_; 604 return target_disposition_;
612 } 605 }
613 606
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 691
699 bool DownloadItemImpl::CanOpenDownload() { 692 bool DownloadItemImpl::CanOpenDownload() {
700 // We can open the file or mark it for opening on completion if the download 693 // We can open the file or mark it for opening on completion if the download
701 // is expected to complete successfully. Exclude temporary downloads, since 694 // is expected to complete successfully. Exclude temporary downloads, since
702 // they aren't owned by the download system. 695 // they aren't owned by the download system.
703 return (IsInProgress() || IsComplete()) && !IsTemporary() && 696 return (IsInProgress() || IsComplete()) && !IsTemporary() &&
704 !file_externally_removed_; 697 !file_externally_removed_;
705 } 698 }
706 699
707 bool DownloadItemImpl::ShouldOpenFileBasedOnExtension() { 700 bool DownloadItemImpl::ShouldOpenFileBasedOnExtension() {
708 return delegate_->ShouldOpenFileBasedOnExtension(GetUserVerifiedFilePath()); 701 return delegate_->ShouldOpenFileBasedOnExtension(GetTargetFilePath());
709 } 702 }
710 703
711 bool DownloadItemImpl::GetOpenWhenComplete() const { 704 bool DownloadItemImpl::GetOpenWhenComplete() const {
712 return open_when_complete_; 705 return open_when_complete_;
713 } 706 }
714 707
715 bool DownloadItemImpl::GetAutoOpened() { 708 bool DownloadItemImpl::GetAutoOpened() {
716 return auto_opened_; 709 return auto_opened_;
717 } 710 }
718 711
(...skipping 966 matching lines...) Expand 10 before | Expand all | Expand 10 after
1685 case RESUME_MODE_USER_CONTINUE: 1678 case RESUME_MODE_USER_CONTINUE:
1686 return "USER_CONTINUE"; 1679 return "USER_CONTINUE";
1687 case RESUME_MODE_USER_RESTART: 1680 case RESUME_MODE_USER_RESTART:
1688 return "USER_RESTART"; 1681 return "USER_RESTART";
1689 } 1682 }
1690 NOTREACHED() << "Unknown resume mode " << mode; 1683 NOTREACHED() << "Unknown resume mode " << mode;
1691 return "unknown"; 1684 return "unknown";
1692 } 1685 }
1693 1686
1694 } // namespace content 1687 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/download/download_item_impl.h ('k') | content/browser/download/download_manager_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698