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 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1048 } | 1048 } |
1049 bytes_per_sec_ = bytes_per_sec; | 1049 bytes_per_sec_ = bytes_per_sec; |
1050 hash_state_ = hash_state; | 1050 hash_state_ = hash_state; |
1051 received_bytes_ = bytes_so_far; | 1051 received_bytes_ = bytes_so_far; |
1052 | 1052 |
1053 // If we've received more data than we were expecting (bad server info?), | 1053 // If we've received more data than we were expecting (bad server info?), |
1054 // revert to 'unknown size mode'. | 1054 // revert to 'unknown size mode'. |
1055 if (received_bytes_ > total_bytes_) | 1055 if (received_bytes_ > total_bytes_) |
1056 total_bytes_ = 0; | 1056 total_bytes_ = 0; |
1057 | 1057 |
1058 if (bound_net_log_.GetCaptureMode().enabled()) { | 1058 if (bound_net_log_.IsCapturing()) { |
1059 bound_net_log_.AddEvent( | 1059 bound_net_log_.AddEvent( |
1060 net::NetLog::TYPE_DOWNLOAD_ITEM_UPDATED, | 1060 net::NetLog::TYPE_DOWNLOAD_ITEM_UPDATED, |
1061 net::NetLog::Int64Callback("bytes_so_far", received_bytes_)); | 1061 net::NetLog::Int64Callback("bytes_so_far", received_bytes_)); |
1062 } | 1062 } |
1063 | 1063 |
1064 UpdateObservers(); | 1064 UpdateObservers(); |
1065 } | 1065 } |
1066 | 1066 |
1067 void DownloadItemImpl::DestinationError(DownloadInterruptReason reason) { | 1067 void DownloadItemImpl::DestinationError(DownloadInterruptReason reason) { |
1068 // Postpone recognition of this error until after file name determination | 1068 // Postpone recognition of this error until after file name determination |
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1804 case RESUME_MODE_USER_CONTINUE: | 1804 case RESUME_MODE_USER_CONTINUE: |
1805 return "USER_CONTINUE"; | 1805 return "USER_CONTINUE"; |
1806 case RESUME_MODE_USER_RESTART: | 1806 case RESUME_MODE_USER_RESTART: |
1807 return "USER_RESTART"; | 1807 return "USER_RESTART"; |
1808 } | 1808 } |
1809 NOTREACHED() << "Unknown resume mode " << mode; | 1809 NOTREACHED() << "Unknown resume mode " << mode; |
1810 return "unknown"; | 1810 return "unknown"; |
1811 } | 1811 } |
1812 | 1812 |
1813 } // namespace content | 1813 } // namespace content |
OLD | NEW |