| 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 // interfaces Start, MaybeCompleteDownload, and OnDownloadCompleting | 7 // interfaces Start, MaybeCompleteDownload, and OnDownloadCompleting |
| 8 // are placed in chronological order with the other (private) routines | 8 // are placed in chronological order with the other (private) routines |
| 9 // that together define a DownloadItem's state transitions | 9 // that together define a DownloadItem's state transitions |
| 10 // as the download progresses. See "Download progression cascade" later in | 10 // as the download progresses. See "Download progression cascade" later in |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 // database handles in incognito mode starting at -1 and progressively getting | 125 // database handles in incognito mode starting at -1 and progressively getting |
| 126 // more negative. | 126 // more negative. |
| 127 | 127 |
| 128 // Constructor for reading from the history service. | 128 // Constructor for reading from the history service. |
| 129 DownloadItemImpl::DownloadItemImpl(DownloadItemImplDelegate* delegate, | 129 DownloadItemImpl::DownloadItemImpl(DownloadItemImplDelegate* delegate, |
| 130 DownloadId download_id, | 130 DownloadId download_id, |
| 131 const DownloadPersistentStoreInfo& info, | 131 const DownloadPersistentStoreInfo& info, |
| 132 const net::BoundNetLog& bound_net_log) | 132 const net::BoundNetLog& bound_net_log) |
| 133 : is_save_package_download_(false), | 133 : is_save_package_download_(false), |
| 134 download_id_(download_id), | 134 download_id_(download_id), |
| 135 current_path_(info.path), | 135 current_path_(info.current_path), |
| 136 target_path_(info.path), | 136 target_path_(info.target_path), |
| 137 target_disposition_(TARGET_DISPOSITION_OVERWRITE), | 137 target_disposition_(TARGET_DISPOSITION_OVERWRITE), |
| 138 url_chain_(1, info.url), | 138 url_chain_(info.url_chain), |
| 139 referrer_url_(info.referrer_url), | 139 referrer_url_(info.referrer_url), |
| 140 transition_type_(PAGE_TRANSITION_LINK), | 140 transition_type_(PAGE_TRANSITION_LINK), |
| 141 has_user_gesture_(false), | 141 has_user_gesture_(false), |
| 142 total_bytes_(info.total_bytes), | 142 total_bytes_(info.total_bytes), |
| 143 received_bytes_(info.received_bytes), | 143 received_bytes_(info.received_bytes), |
| 144 bytes_per_sec_(0), | 144 bytes_per_sec_(0), |
| 145 last_reason_(DOWNLOAD_INTERRUPT_REASON_NONE), | 145 last_reason_(DOWNLOAD_INTERRUPT_REASON_NONE), |
| 146 start_tick_(base::TimeTicks()), | 146 start_tick_(base::TimeTicks()), |
| 147 state_(ExternalToInternalState(info.state)), | 147 state_(ExternalToInternalState(info.state)), |
| 148 danger_type_(DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS), | 148 danger_type_(DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS), |
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 693 bool DownloadItemImpl::GetAutoOpened() { | 693 bool DownloadItemImpl::GetAutoOpened() { |
| 694 return auto_opened_; | 694 return auto_opened_; |
| 695 } | 695 } |
| 696 | 696 |
| 697 bool DownloadItemImpl::GetOpened() const { | 697 bool DownloadItemImpl::GetOpened() const { |
| 698 return opened_; | 698 return opened_; |
| 699 } | 699 } |
| 700 | 700 |
| 701 DownloadPersistentStoreInfo DownloadItemImpl::GetPersistentStoreInfo() const { | 701 DownloadPersistentStoreInfo DownloadItemImpl::GetPersistentStoreInfo() const { |
| 702 // TODO(asanka): Persist GetTargetFilePath() as well. | 702 // TODO(asanka): Persist GetTargetFilePath() as well. |
| 703 return DownloadPersistentStoreInfo(GetFullPath(), | 703 return DownloadPersistentStoreInfo(GetTargetFilePath(), |
| 704 GetURL(), | 704 GetFullPath(), |
| 705 GetUrlChain(), |
| 705 GetReferrerUrl(), | 706 GetReferrerUrl(), |
| 706 GetStartTime(), | 707 GetStartTime(), |
| 707 GetEndTime(), | 708 GetEndTime(), |
| 708 GetReceivedBytes(), | 709 GetReceivedBytes(), |
| 709 GetTotalBytes(), | 710 GetTotalBytes(), |
| 710 GetState(), | 711 GetState(), |
| 712 GetLastReason(), |
| 711 GetDbHandle(), | 713 GetDbHandle(), |
| 712 GetOpened()); | 714 GetOpened()); |
| 713 } | 715 } |
| 714 | 716 |
| 715 BrowserContext* DownloadItemImpl::GetBrowserContext() const { | 717 BrowserContext* DownloadItemImpl::GetBrowserContext() const { |
| 716 return delegate_->GetBrowserContext(); | 718 return delegate_->GetBrowserContext(); |
| 717 } | 719 } |
| 718 | 720 |
| 719 WebContents* DownloadItemImpl::GetWebContents() const { | 721 WebContents* DownloadItemImpl::GetWebContents() const { |
| 720 // TODO(rdsmith): Remove null check after removing GetWebContents() from | 722 // TODO(rdsmith): Remove null check after removing GetWebContents() from |
| (...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1449 return "CANCELLED"; | 1451 return "CANCELLED"; |
| 1450 case INTERRUPTED_INTERNAL: | 1452 case INTERRUPTED_INTERNAL: |
| 1451 return "INTERRUPTED"; | 1453 return "INTERRUPTED"; |
| 1452 default: | 1454 default: |
| 1453 NOTREACHED() << "Unknown download state " << state; | 1455 NOTREACHED() << "Unknown download state " << state; |
| 1454 return "unknown"; | 1456 return "unknown"; |
| 1455 }; | 1457 }; |
| 1456 } | 1458 } |
| 1457 | 1459 |
| 1458 } // namespace content | 1460 } // namespace content |
| OLD | NEW |