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 // 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 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
601 } | 601 } |
602 | 602 |
603 const std::string& DownloadItemImpl::GetHashState() const { | 603 const std::string& DownloadItemImpl::GetHashState() const { |
604 return hash_state_; | 604 return hash_state_; |
605 } | 605 } |
606 | 606 |
607 bool DownloadItemImpl::GetFileExternallyRemoved() const { | 607 bool DownloadItemImpl::GetFileExternallyRemoved() const { |
608 return file_externally_removed_; | 608 return file_externally_removed_; |
609 } | 609 } |
610 | 610 |
| 611 void DownloadItemImpl::DeleteFile() { |
| 612 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 613 if ((GetState() != DownloadItem::COMPLETE) || |
| 614 file_externally_removed_) { |
| 615 return; |
| 616 } |
| 617 BrowserThread::PostTaskAndReply( |
| 618 BrowserThread::FILE, FROM_HERE, |
| 619 base::Bind(&DeleteDownloadedFile, current_path_), |
| 620 base::Bind(&DownloadItemImpl::OnDownloadedFileRemoved, |
| 621 weak_ptr_factory_.GetWeakPtr())); |
| 622 current_path_.clear(); |
| 623 } |
| 624 |
611 bool DownloadItemImpl::IsDangerous() const { | 625 bool DownloadItemImpl::IsDangerous() const { |
612 #if defined(OS_WIN) | 626 #if defined(OS_WIN) |
613 // TODO(noelutz): At this point only the windows views UI supports | 627 // TODO(noelutz): At this point only the windows views UI supports |
614 // warnings based on dangerous content. | 628 // warnings based on dangerous content. |
615 return (danger_type_ == DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE || | 629 return (danger_type_ == DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE || |
616 danger_type_ == DOWNLOAD_DANGER_TYPE_DANGEROUS_URL || | 630 danger_type_ == DOWNLOAD_DANGER_TYPE_DANGEROUS_URL || |
617 danger_type_ == DOWNLOAD_DANGER_TYPE_DANGEROUS_CONTENT || | 631 danger_type_ == DOWNLOAD_DANGER_TYPE_DANGEROUS_CONTENT || |
618 danger_type_ == DOWNLOAD_DANGER_TYPE_UNCOMMON_CONTENT || | 632 danger_type_ == DOWNLOAD_DANGER_TYPE_UNCOMMON_CONTENT || |
619 danger_type_ == DOWNLOAD_DANGER_TYPE_DANGEROUS_HOST || | 633 danger_type_ == DOWNLOAD_DANGER_TYPE_DANGEROUS_HOST || |
620 danger_type_ == DOWNLOAD_DANGER_TYPE_POTENTIALLY_UNWANTED); | 634 danger_type_ == DOWNLOAD_DANGER_TYPE_POTENTIALLY_UNWANTED); |
(...skipping 1061 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1682 case RESUME_MODE_USER_CONTINUE: | 1696 case RESUME_MODE_USER_CONTINUE: |
1683 return "USER_CONTINUE"; | 1697 return "USER_CONTINUE"; |
1684 case RESUME_MODE_USER_RESTART: | 1698 case RESUME_MODE_USER_RESTART: |
1685 return "USER_RESTART"; | 1699 return "USER_RESTART"; |
1686 } | 1700 } |
1687 NOTREACHED() << "Unknown resume mode " << mode; | 1701 NOTREACHED() << "Unknown resume mode " << mode; |
1688 return "unknown"; | 1702 return "unknown"; |
1689 } | 1703 } |
1690 | 1704 |
1691 } // namespace content | 1705 } // namespace content |
OLD | NEW |