| 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 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 802 " reason = %s" | 802 " reason = %s" |
| 803 " paused = %c" | 803 " paused = %c" |
| 804 " resume_mode = %s" | 804 " resume_mode = %s" |
| 805 " auto_resume_count = %d" | 805 " auto_resume_count = %d" |
| 806 " danger = %d" | 806 " danger = %d" |
| 807 " all_data_saved = %c" | 807 " all_data_saved = %c" |
| 808 " last_modified = '%s'" | 808 " last_modified = '%s'" |
| 809 " etag = '%s'" | 809 " etag = '%s'" |
| 810 " has_download_file = %s" | 810 " has_download_file = %s" |
| 811 " url_chain = \n\t\"%s\"\n\t" | 811 " url_chain = \n\t\"%s\"\n\t" |
| 812 " current_path = \"%" PRFilePath | 812 " current_path = \"%" PRFilePath "\"\n\t" |
| 813 "\"\n\t" | 813 " target_path = \"%" PRFilePath "\"" |
| 814 " target_path = \"%" PRFilePath "\"", | 814 " referrer = \"%s\"", |
| 815 GetTotalBytes(), | 815 GetTotalBytes(), |
| 816 GetReceivedBytes(), | 816 GetReceivedBytes(), |
| 817 DownloadInterruptReasonToString(last_reason_).c_str(), | 817 DownloadInterruptReasonToString(last_reason_).c_str(), |
| 818 IsPaused() ? 'T' : 'F', | 818 IsPaused() ? 'T' : 'F', |
| 819 DebugResumeModeString(GetResumeMode()), | 819 DebugResumeModeString(GetResumeMode()), |
| 820 auto_resume_count_, | 820 auto_resume_count_, |
| 821 GetDangerType(), | 821 GetDangerType(), |
| 822 AllDataSaved() ? 'T' : 'F', | 822 AllDataSaved() ? 'T' : 'F', |
| 823 GetLastModifiedTime().c_str(), | 823 GetLastModifiedTime().c_str(), |
| 824 GetETag().c_str(), | 824 GetETag().c_str(), |
| 825 download_file_.get() ? "true" : "false", | 825 download_file_.get() ? "true" : "false", |
| 826 url_list.c_str(), | 826 url_list.c_str(), |
| 827 GetFullPath().value().c_str(), | 827 GetFullPath().value().c_str(), |
| 828 GetTargetFilePath().value().c_str()); | 828 GetTargetFilePath().value().c_str(), |
| 829 GetReferrerUrl().spec().c_str()); |
| 829 } else { | 830 } else { |
| 830 description += base::StringPrintf(" url = \"%s\"", url_list.c_str()); | 831 description += base::StringPrintf(" url = \"%s\"", url_list.c_str()); |
| 831 } | 832 } |
| 832 | 833 |
| 833 description += " }"; | 834 description += " }"; |
| 834 | 835 |
| 835 return description; | 836 return description; |
| 836 } | 837 } |
| 837 | 838 |
| 838 DownloadItemImpl::ResumeMode DownloadItemImpl::GetResumeMode() const { | 839 DownloadItemImpl::ResumeMode DownloadItemImpl::GetResumeMode() const { |
| (...skipping 1065 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1904 // associated renderer) goes away before a response is received. | 1905 // associated renderer) goes away before a response is received. |
| 1905 scoped_ptr<DownloadUrlParameters> download_params(new DownloadUrlParameters( | 1906 scoped_ptr<DownloadUrlParameters> download_params(new DownloadUrlParameters( |
| 1906 GetURL(), -1, -1, -1, GetBrowserContext()->GetResourceContext())); | 1907 GetURL(), -1, -1, -1, GetBrowserContext()->GetResourceContext())); |
| 1907 download_params->set_file_path(GetFullPath()); | 1908 download_params->set_file_path(GetFullPath()); |
| 1908 download_params->set_offset(GetReceivedBytes()); | 1909 download_params->set_offset(GetReceivedBytes()); |
| 1909 download_params->set_last_modified(GetLastModifiedTime()); | 1910 download_params->set_last_modified(GetLastModifiedTime()); |
| 1910 download_params->set_etag(GetETag()); | 1911 download_params->set_etag(GetETag()); |
| 1911 download_params->set_hash_of_partial_file(hash_); | 1912 download_params->set_hash_of_partial_file(hash_); |
| 1912 download_params->set_hash_state(std::move(hash_state_)); | 1913 download_params->set_hash_state(std::move(hash_state_)); |
| 1913 | 1914 |
| 1915 // Note that resumed downloads disallow redirects. Hence the referrer URL |
| 1916 // (which is the contents of the Referer header for the last download request) |
| 1917 // will only be sent to the URL returned by GetURL(). |
| 1918 download_params->set_referrer( |
| 1919 Referrer(GetReferrerUrl(), blink::WebReferrerPolicyAlways)); |
| 1920 |
| 1914 TransitionTo(RESUMING_INTERNAL); | 1921 TransitionTo(RESUMING_INTERNAL); |
| 1915 delegate_->ResumeInterruptedDownload(std::move(download_params), GetId()); | 1922 delegate_->ResumeInterruptedDownload(std::move(download_params), GetId()); |
| 1916 // Just in case we were interrupted while paused. | 1923 // Just in case we were interrupted while paused. |
| 1917 is_paused_ = false; | 1924 is_paused_ = false; |
| 1918 } | 1925 } |
| 1919 | 1926 |
| 1920 // static | 1927 // static |
| 1921 DownloadItem::DownloadState DownloadItemImpl::InternalToExternalState( | 1928 DownloadItem::DownloadState DownloadItemImpl::InternalToExternalState( |
| 1922 DownloadInternalState internal_state) { | 1929 DownloadInternalState internal_state) { |
| 1923 switch (internal_state) { | 1930 switch (internal_state) { |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2087 case RESUME_MODE_USER_CONTINUE: | 2094 case RESUME_MODE_USER_CONTINUE: |
| 2088 return "USER_CONTINUE"; | 2095 return "USER_CONTINUE"; |
| 2089 case RESUME_MODE_USER_RESTART: | 2096 case RESUME_MODE_USER_RESTART: |
| 2090 return "USER_RESTART"; | 2097 return "USER_RESTART"; |
| 2091 } | 2098 } |
| 2092 NOTREACHED() << "Unknown resume mode " << mode; | 2099 NOTREACHED() << "Unknown resume mode " << mode; |
| 2093 return "unknown"; | 2100 return "unknown"; |
| 2094 } | 2101 } |
| 2095 | 2102 |
| 2096 } // namespace content | 2103 } // namespace content |
| OLD | NEW |