OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "content/browser/download/download_item_impl.h" | 5 #include "content/browser/download/download_item_impl.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 request_handle_(request_handle), | 170 request_handle_(request_handle), |
171 download_id_(info.download_id), | 171 download_id_(info.download_id), |
172 full_path_(info.path), | 172 full_path_(info.path), |
173 url_chain_(info.url_chain), | 173 url_chain_(info.url_chain), |
174 referrer_url_(info.referrer_url), | 174 referrer_url_(info.referrer_url), |
175 suggested_filename_(UTF16ToUTF8(info.save_info.suggested_name)), | 175 suggested_filename_(UTF16ToUTF8(info.save_info.suggested_name)), |
176 content_disposition_(info.content_disposition), | 176 content_disposition_(info.content_disposition), |
177 mime_type_(info.mime_type), | 177 mime_type_(info.mime_type), |
178 original_mime_type_(info.original_mime_type), | 178 original_mime_type_(info.original_mime_type), |
179 referrer_charset_(info.referrer_charset), | 179 referrer_charset_(info.referrer_charset), |
| 180 remote_address_(info.remote_address), |
180 total_bytes_(info.total_bytes), | 181 total_bytes_(info.total_bytes), |
181 received_bytes_(0), | 182 received_bytes_(0), |
182 bytes_per_sec_(0), | 183 bytes_per_sec_(0), |
183 last_reason_(DOWNLOAD_INTERRUPT_REASON_NONE), | 184 last_reason_(DOWNLOAD_INTERRUPT_REASON_NONE), |
184 start_tick_(base::TimeTicks::Now()), | 185 start_tick_(base::TimeTicks::Now()), |
185 state_(IN_PROGRESS), | 186 state_(IN_PROGRESS), |
186 start_time_(info.start_time), | 187 start_time_(info.start_time), |
187 db_handle_(DownloadItem::kUninitializedHandle), | 188 db_handle_(DownloadItem::kUninitializedHandle), |
188 download_manager_(download_manager), | 189 download_manager_(download_manager), |
189 is_paused_(false), | 190 is_paused_(false), |
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
842 std::string DownloadItemImpl::GetContentDisposition() const { | 843 std::string DownloadItemImpl::GetContentDisposition() const { |
843 return content_disposition_; | 844 return content_disposition_; |
844 } | 845 } |
845 std::string DownloadItemImpl::GetMimeType() const { return mime_type_; } | 846 std::string DownloadItemImpl::GetMimeType() const { return mime_type_; } |
846 std::string DownloadItemImpl::GetOriginalMimeType() const { | 847 std::string DownloadItemImpl::GetOriginalMimeType() const { |
847 return original_mime_type_; | 848 return original_mime_type_; |
848 } | 849 } |
849 std::string DownloadItemImpl::GetReferrerCharset() const { | 850 std::string DownloadItemImpl::GetReferrerCharset() const { |
850 return referrer_charset_; | 851 return referrer_charset_; |
851 } | 852 } |
| 853 std::string DownloadItemImpl::GetRemoteAddress() const { |
| 854 return remote_address_; |
| 855 } |
852 int64 DownloadItemImpl::GetTotalBytes() const { return total_bytes_; } | 856 int64 DownloadItemImpl::GetTotalBytes() const { return total_bytes_; } |
853 void DownloadItemImpl::SetTotalBytes(int64 total_bytes) { | 857 void DownloadItemImpl::SetTotalBytes(int64 total_bytes) { |
854 total_bytes_ = total_bytes; | 858 total_bytes_ = total_bytes; |
855 } | 859 } |
856 const std::string& DownloadItemImpl::GetHash() const { return hash_; } | 860 const std::string& DownloadItemImpl::GetHash() const { return hash_; } |
857 int64 DownloadItemImpl::GetReceivedBytes() const { return received_bytes_; } | 861 int64 DownloadItemImpl::GetReceivedBytes() const { return received_bytes_; } |
858 int32 DownloadItemImpl::GetId() const { return download_id_.local(); } | 862 int32 DownloadItemImpl::GetId() const { return download_id_.local(); } |
859 DownloadId DownloadItemImpl::GetGlobalId() const { return download_id_; } | 863 DownloadId DownloadItemImpl::GetGlobalId() const { return download_id_; } |
860 base::Time DownloadItemImpl::GetStartTime() const { return start_time_; } | 864 base::Time DownloadItemImpl::GetStartTime() const { return start_time_; } |
861 base::Time DownloadItemImpl::GetEndTime() const { return end_time_; } | 865 base::Time DownloadItemImpl::GetEndTime() const { return end_time_; } |
(...skipping 30 matching lines...) Expand all Loading... |
892 void DownloadItemImpl::SetOpened(bool opened) { opened_ = opened; } | 896 void DownloadItemImpl::SetOpened(bool opened) { opened_ = opened; } |
893 bool DownloadItemImpl::GetOpened() const { return opened_; } | 897 bool DownloadItemImpl::GetOpened() const { return opened_; } |
894 InterruptReason DownloadItemImpl::GetLastReason() const { | 898 InterruptReason DownloadItemImpl::GetLastReason() const { |
895 return last_reason_; | 899 return last_reason_; |
896 } | 900 } |
897 DownloadStateInfo DownloadItemImpl::GetStateInfo() const { return state_info_; } | 901 DownloadStateInfo DownloadItemImpl::GetStateInfo() const { return state_info_; } |
898 bool DownloadItemImpl::NeedsRename() const { | 902 bool DownloadItemImpl::NeedsRename() const { |
899 return state_info_.target_name != full_path_.BaseName(); | 903 return state_info_.target_name != full_path_.BaseName(); |
900 } | 904 } |
901 void DownloadItemImpl::MockDownloadOpenForTesting() { open_enabled_ = false; } | 905 void DownloadItemImpl::MockDownloadOpenForTesting() { open_enabled_ = false; } |
OLD | NEW |