Chromium Code Reviews| 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 210 url_chain_(info.url_chain), | 210 url_chain_(info.url_chain), |
| 211 referrer_url_(info.referrer_url), | 211 referrer_url_(info.referrer_url), |
| 212 site_url_(info.site_url), | 212 site_url_(info.site_url), |
| 213 tab_url_(info.tab_url), | 213 tab_url_(info.tab_url), |
| 214 tab_referrer_url_(info.tab_referrer_url), | 214 tab_referrer_url_(info.tab_referrer_url), |
| 215 suggested_filename_(base::UTF16ToUTF8(info.save_info->suggested_name)), | 215 suggested_filename_(base::UTF16ToUTF8(info.save_info->suggested_name)), |
| 216 forced_file_path_(info.save_info->file_path), | 216 forced_file_path_(info.save_info->file_path), |
| 217 transition_type_(info.transition_type ? info.transition_type.value() | 217 transition_type_(info.transition_type ? info.transition_type.value() |
| 218 : ui::PAGE_TRANSITION_LINK), | 218 : ui::PAGE_TRANSITION_LINK), |
| 219 has_user_gesture_(info.has_user_gesture), | 219 has_user_gesture_(info.has_user_gesture), |
| 220 response_code_(info.response_code), | |
| 220 content_disposition_(info.content_disposition), | 221 content_disposition_(info.content_disposition), |
| 221 mime_type_(info.mime_type), | 222 mime_type_(info.mime_type), |
| 222 original_mime_type_(info.original_mime_type), | 223 original_mime_type_(info.original_mime_type), |
| 223 remote_address_(info.remote_address), | 224 remote_address_(info.remote_address), |
| 224 total_bytes_(info.total_bytes), | 225 total_bytes_(info.total_bytes), |
| 225 last_reason_(info.result), | 226 last_reason_(info.result), |
| 226 start_tick_(base::TimeTicks::Now()), | 227 start_tick_(base::TimeTicks::Now()), |
| 227 state_(INITIAL_INTERNAL), | 228 state_(INITIAL_INTERNAL), |
| 228 start_time_(info.start_time), | 229 start_time_(info.start_time), |
| 229 delegate_(delegate), | 230 delegate_(delegate), |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 598 } | 599 } |
| 599 | 600 |
| 600 const GURL& DownloadItemImpl::GetTabReferrerUrl() const { | 601 const GURL& DownloadItemImpl::GetTabReferrerUrl() const { |
| 601 return tab_referrer_url_; | 602 return tab_referrer_url_; |
| 602 } | 603 } |
| 603 | 604 |
| 604 std::string DownloadItemImpl::GetSuggestedFilename() const { | 605 std::string DownloadItemImpl::GetSuggestedFilename() const { |
| 605 return suggested_filename_; | 606 return suggested_filename_; |
| 606 } | 607 } |
| 607 | 608 |
| 609 int DownloadItemImpl::GetResponseCode() const { | |
| 610 return response_code_; | |
| 611 } | |
| 612 | |
| 608 std::string DownloadItemImpl::GetContentDisposition() const { | 613 std::string DownloadItemImpl::GetContentDisposition() const { |
| 609 return content_disposition_; | 614 return content_disposition_; |
| 610 } | 615 } |
| 611 | 616 |
| 612 std::string DownloadItemImpl::GetMimeType() const { | 617 std::string DownloadItemImpl::GetMimeType() const { |
| 613 return mime_type_; | 618 return mime_type_; |
| 614 } | 619 } |
| 615 | 620 |
| 616 std::string DownloadItemImpl::GetOriginalMimeType() const { | 621 std::string DownloadItemImpl::GetOriginalMimeType() const { |
| 617 return original_mime_type_; | 622 return original_mime_type_; |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1028 int origin_state = 0; | 1033 int origin_state = 0; |
| 1029 bool is_partial = received_bytes_ > 0; | 1034 bool is_partial = received_bytes_ > 0; |
| 1030 if (chain_iter != new_create_info.url_chain.end()) | 1035 if (chain_iter != new_create_info.url_chain.end()) |
| 1031 origin_state |= ORIGIN_STATE_ON_RESUMPTION_ADDITIONAL_REDIRECTS; | 1036 origin_state |= ORIGIN_STATE_ON_RESUMPTION_ADDITIONAL_REDIRECTS; |
| 1032 if (etag_ != new_create_info.etag || | 1037 if (etag_ != new_create_info.etag || |
| 1033 last_modified_time_ != new_create_info.last_modified) { | 1038 last_modified_time_ != new_create_info.last_modified) { |
| 1034 received_slices_.clear(); | 1039 received_slices_.clear(); |
| 1035 received_bytes_ = 0; | 1040 received_bytes_ = 0; |
| 1036 origin_state |= ORIGIN_STATE_ON_RESUMPTION_VALIDATORS_CHANGED; | 1041 origin_state |= ORIGIN_STATE_ON_RESUMPTION_VALIDATORS_CHANGED; |
| 1037 } | 1042 } |
| 1038 if (content_disposition_ != new_create_info.content_disposition) | 1043 if (content_disposition_ != new_create_info.content_disposition) |
|
Peter Beverloo
2017/04/11 15:10:24
It feels to me like the response code should be pa
| |
| 1039 origin_state |= ORIGIN_STATE_ON_RESUMPTION_CONTENT_DISPOSITION_CHANGED; | 1044 origin_state |= ORIGIN_STATE_ON_RESUMPTION_CONTENT_DISPOSITION_CHANGED; |
| 1040 RecordOriginStateOnResumption(is_partial, origin_state); | 1045 RecordOriginStateOnResumption(is_partial, origin_state); |
| 1041 | 1046 |
| 1042 url_chain_.insert( | 1047 url_chain_.insert( |
| 1043 url_chain_.end(), chain_iter, new_create_info.url_chain.end()); | 1048 url_chain_.end(), chain_iter, new_create_info.url_chain.end()); |
| 1044 etag_ = new_create_info.etag; | 1049 etag_ = new_create_info.etag; |
| 1045 last_modified_time_ = new_create_info.last_modified; | 1050 last_modified_time_ = new_create_info.last_modified; |
| 1051 response_code_ = new_create_info.response_code; | |
| 1046 content_disposition_ = new_create_info.content_disposition; | 1052 content_disposition_ = new_create_info.content_disposition; |
| 1047 // It is possible that the previous download attempt failed right before the | 1053 // It is possible that the previous download attempt failed right before the |
| 1048 // response is received. Need to reset the MIME type. | 1054 // response is received. Need to reset the MIME type. |
| 1049 mime_type_ = new_create_info.mime_type; | 1055 mime_type_ = new_create_info.mime_type; |
| 1050 | 1056 |
| 1051 // Don't update observers. This method is expected to be called just before a | 1057 // Don't update observers. This method is expected to be called just before a |
| 1052 // DownloadFile is created and Start() is called. The observers will be | 1058 // DownloadFile is created and Start() is called. The observers will be |
| 1053 // notified when the download transitions to the IN_PROGRESS state. | 1059 // notified when the download transitions to the IN_PROGRESS state. |
| 1054 } | 1060 } |
| 1055 | 1061 |
| (...skipping 1190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2246 case RESUME_MODE_USER_CONTINUE: | 2252 case RESUME_MODE_USER_CONTINUE: |
| 2247 return "USER_CONTINUE"; | 2253 return "USER_CONTINUE"; |
| 2248 case RESUME_MODE_USER_RESTART: | 2254 case RESUME_MODE_USER_RESTART: |
| 2249 return "USER_RESTART"; | 2255 return "USER_RESTART"; |
| 2250 } | 2256 } |
| 2251 NOTREACHED() << "Unknown resume mode " << mode; | 2257 NOTREACHED() << "Unknown resume mode " << mode; |
| 2252 return "unknown"; | 2258 return "unknown"; |
| 2253 } | 2259 } |
| 2254 | 2260 |
| 2255 } // namespace content | 2261 } // namespace content |
| OLD | NEW |