| 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 const base::Time& end_time, | 119 const base::Time& end_time, |
| 120 const std::string& etag, | 120 const std::string& etag, |
| 121 const std::string& last_modified, | 121 const std::string& last_modified, |
| 122 int64_t received_bytes, | 122 int64_t received_bytes, |
| 123 int64_t total_bytes, | 123 int64_t total_bytes, |
| 124 const std::string& hash, | 124 const std::string& hash, |
| 125 DownloadItem::DownloadState state, | 125 DownloadItem::DownloadState state, |
| 126 DownloadDangerType danger_type, | 126 DownloadDangerType danger_type, |
| 127 DownloadInterruptReason interrupt_reason, | 127 DownloadInterruptReason interrupt_reason, |
| 128 bool opened, | 128 bool opened, |
| 129 const net::BoundNetLog& bound_net_log) | 129 const net::NetLogWithSource& bound_net_log) |
| 130 : guid_(base::ToUpperASCII(guid)), | 130 : guid_(base::ToUpperASCII(guid)), |
| 131 download_id_(download_id), | 131 download_id_(download_id), |
| 132 target_path_(target_path), | 132 target_path_(target_path), |
| 133 url_chain_(url_chain), | 133 url_chain_(url_chain), |
| 134 referrer_url_(referrer_url), | 134 referrer_url_(referrer_url), |
| 135 site_url_(site_url), | 135 site_url_(site_url), |
| 136 tab_url_(tab_url), | 136 tab_url_(tab_url), |
| 137 tab_referrer_url_(tab_refererr_url), | 137 tab_referrer_url_(tab_refererr_url), |
| 138 mime_type_(mime_type), | 138 mime_type_(mime_type), |
| 139 original_mime_type_(original_mime_type), | 139 original_mime_type_(original_mime_type), |
| (...skipping 18 matching lines...) Expand all Loading... |
| 158 DCHECK(state_ == COMPLETE_INTERNAL || state_ == INTERRUPTED_INTERNAL || | 158 DCHECK(state_ == COMPLETE_INTERNAL || state_ == INTERRUPTED_INTERNAL || |
| 159 state_ == CANCELLED_INTERNAL); | 159 state_ == CANCELLED_INTERNAL); |
| 160 DCHECK(base::IsValidGUID(guid_)); | 160 DCHECK(base::IsValidGUID(guid_)); |
| 161 Init(false /* not actively downloading */, SRC_HISTORY_IMPORT); | 161 Init(false /* not actively downloading */, SRC_HISTORY_IMPORT); |
| 162 } | 162 } |
| 163 | 163 |
| 164 // Constructing for a regular download: | 164 // Constructing for a regular download: |
| 165 DownloadItemImpl::DownloadItemImpl(DownloadItemImplDelegate* delegate, | 165 DownloadItemImpl::DownloadItemImpl(DownloadItemImplDelegate* delegate, |
| 166 uint32_t download_id, | 166 uint32_t download_id, |
| 167 const DownloadCreateInfo& info, | 167 const DownloadCreateInfo& info, |
| 168 const net::BoundNetLog& bound_net_log) | 168 const net::NetLogWithSource& bound_net_log) |
| 169 : guid_(base::ToUpperASCII(base::GenerateGUID())), | 169 : guid_(base::ToUpperASCII(base::GenerateGUID())), |
| 170 download_id_(download_id), | 170 download_id_(download_id), |
| 171 target_disposition_((info.save_info->prompt_for_save_location) | 171 target_disposition_((info.save_info->prompt_for_save_location) |
| 172 ? TARGET_DISPOSITION_PROMPT | 172 ? TARGET_DISPOSITION_PROMPT |
| 173 : TARGET_DISPOSITION_OVERWRITE), | 173 : TARGET_DISPOSITION_OVERWRITE), |
| 174 url_chain_(info.url_chain), | 174 url_chain_(info.url_chain), |
| 175 referrer_url_(info.referrer_url), | 175 referrer_url_(info.referrer_url), |
| 176 site_url_(info.site_url), | 176 site_url_(info.site_url), |
| 177 tab_url_(info.tab_url), | 177 tab_url_(info.tab_url), |
| 178 tab_referrer_url_(info.tab_referrer_url), | 178 tab_referrer_url_(info.tab_referrer_url), |
| (...skipping 30 matching lines...) Expand all Loading... |
| 209 } | 209 } |
| 210 | 210 |
| 211 // Constructing for the "Save Page As..." feature: | 211 // Constructing for the "Save Page As..." feature: |
| 212 DownloadItemImpl::DownloadItemImpl( | 212 DownloadItemImpl::DownloadItemImpl( |
| 213 DownloadItemImplDelegate* delegate, | 213 DownloadItemImplDelegate* delegate, |
| 214 uint32_t download_id, | 214 uint32_t download_id, |
| 215 const base::FilePath& path, | 215 const base::FilePath& path, |
| 216 const GURL& url, | 216 const GURL& url, |
| 217 const std::string& mime_type, | 217 const std::string& mime_type, |
| 218 std::unique_ptr<DownloadRequestHandleInterface> request_handle, | 218 std::unique_ptr<DownloadRequestHandleInterface> request_handle, |
| 219 const net::BoundNetLog& bound_net_log) | 219 const net::NetLogWithSource& bound_net_log) |
| 220 : is_save_package_download_(true), | 220 : is_save_package_download_(true), |
| 221 request_handle_(std::move(request_handle)), | 221 request_handle_(std::move(request_handle)), |
| 222 guid_(base::ToUpperASCII(base::GenerateGUID())), | 222 guid_(base::ToUpperASCII(base::GenerateGUID())), |
| 223 download_id_(download_id), | 223 download_id_(download_id), |
| 224 target_path_(path), | 224 target_path_(path), |
| 225 url_chain_(1, url), | 225 url_chain_(1, url), |
| 226 mime_type_(mime_type), | 226 mime_type_(mime_type), |
| 227 original_mime_type_(mime_type), | 227 original_mime_type_(mime_type), |
| 228 start_tick_(base::TimeTicks::Now()), | 228 start_tick_(base::TimeTicks::Now()), |
| 229 state_(IN_PROGRESS_INTERNAL), | 229 state_(IN_PROGRESS_INTERNAL), |
| (...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 978 file_externally_removed_ = true; | 978 file_externally_removed_ = true; |
| 979 DVLOG(20) << __func__ << "() download=" << DebugString(true); | 979 DVLOG(20) << __func__ << "() download=" << DebugString(true); |
| 980 UpdateObservers(); | 980 UpdateObservers(); |
| 981 } | 981 } |
| 982 | 982 |
| 983 base::WeakPtr<DownloadDestinationObserver> | 983 base::WeakPtr<DownloadDestinationObserver> |
| 984 DownloadItemImpl::DestinationObserverAsWeakPtr() { | 984 DownloadItemImpl::DestinationObserverAsWeakPtr() { |
| 985 return weak_ptr_factory_.GetWeakPtr(); | 985 return weak_ptr_factory_.GetWeakPtr(); |
| 986 } | 986 } |
| 987 | 987 |
| 988 const net::BoundNetLog& DownloadItemImpl::GetBoundNetLog() const { | 988 const net::NetLogWithSource& DownloadItemImpl::GetNetLogWithSource() const { |
| 989 return bound_net_log_; | 989 return bound_net_log_; |
| 990 } | 990 } |
| 991 | 991 |
| 992 void DownloadItemImpl::SetTotalBytes(int64_t total_bytes) { | 992 void DownloadItemImpl::SetTotalBytes(int64_t total_bytes) { |
| 993 total_bytes_ = total_bytes; | 993 total_bytes_ = total_bytes; |
| 994 } | 994 } |
| 995 | 995 |
| 996 void DownloadItemImpl::OnAllDataSaved( | 996 void DownloadItemImpl::OnAllDataSaved( |
| 997 int64_t total_bytes, | 997 int64_t total_bytes, |
| 998 std::unique_ptr<crypto::SecureHash> hash_state) { | 998 std::unique_ptr<crypto::SecureHash> hash_state) { |
| (...skipping 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2086 case RESUME_MODE_USER_CONTINUE: | 2086 case RESUME_MODE_USER_CONTINUE: |
| 2087 return "USER_CONTINUE"; | 2087 return "USER_CONTINUE"; |
| 2088 case RESUME_MODE_USER_RESTART: | 2088 case RESUME_MODE_USER_RESTART: |
| 2089 return "USER_RESTART"; | 2089 return "USER_RESTART"; |
| 2090 } | 2090 } |
| 2091 NOTREACHED() << "Unknown resume mode " << mode; | 2091 NOTREACHED() << "Unknown resume mode " << mode; |
| 2092 return "unknown"; | 2092 return "unknown"; |
| 2093 } | 2093 } |
| 2094 | 2094 |
| 2095 } // namespace content | 2095 } // namespace content |
| OLD | NEW |