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 13 matching lines...) Expand all Loading... | |
24 #include "content/browser/download/download_item_impl.h" | 24 #include "content/browser/download/download_item_impl.h" |
25 | 25 |
26 #include <utility> | 26 #include <utility> |
27 #include <vector> | 27 #include <vector> |
28 | 28 |
29 #include "base/bind.h" | 29 #include "base/bind.h" |
30 #include "base/files/file_util.h" | 30 #include "base/files/file_util.h" |
31 #include "base/format_macros.h" | 31 #include "base/format_macros.h" |
32 #include "base/guid.h" | 32 #include "base/guid.h" |
33 #include "base/logging.h" | 33 #include "base/logging.h" |
34 #include "base/memory/ptr_util.h" | 34 #include "base/memory/ptr_util.h" |
davidben
2016/06/23 03:09:36
No longer used, I think.
| |
35 #include "base/metrics/histogram.h" | 35 #include "base/metrics/histogram.h" |
36 #include "base/stl_util.h" | 36 #include "base/stl_util.h" |
37 #include "base/strings/string_util.h" | 37 #include "base/strings/string_util.h" |
38 #include "base/strings/stringprintf.h" | 38 #include "base/strings/stringprintf.h" |
39 #include "base/strings/utf_string_conversions.h" | 39 #include "base/strings/utf_string_conversions.h" |
40 #include "content/browser/download/download_create_info.h" | 40 #include "content/browser/download/download_create_info.h" |
41 #include "content/browser/download/download_file.h" | 41 #include "content/browser/download/download_file.h" |
42 #include "content/browser/download/download_interrupt_reasons_impl.h" | 42 #include "content/browser/download/download_interrupt_reasons_impl.h" |
43 #include "content/browser/download/download_item_impl_delegate.h" | 43 #include "content/browser/download/download_item_impl_delegate.h" |
44 #include "content/browser/download/download_net_log_parameters.h" | 44 #include "content/browser/download/download_net_log_parameters.h" |
(...skipping 1123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1168 // download should go back to being interrupted. | 1168 // download should go back to being interrupted. |
1169 if (new_create_info.result != DOWNLOAD_INTERRUPT_REASON_NONE) { | 1169 if (new_create_info.result != DOWNLOAD_INTERRUPT_REASON_NONE) { |
1170 DCHECK(!download_file_.get()); | 1170 DCHECK(!download_file_.get()); |
1171 | 1171 |
1172 // Download requests that are interrupted by Start() should result in a | 1172 // Download requests that are interrupted by Start() should result in a |
1173 // DownloadCreateInfo with an intact DownloadSaveInfo. | 1173 // DownloadCreateInfo with an intact DownloadSaveInfo. |
1174 DCHECK(new_create_info.save_info); | 1174 DCHECK(new_create_info.save_info); |
1175 | 1175 |
1176 int64_t offset = new_create_info.save_info->offset; | 1176 int64_t offset = new_create_info.save_info->offset; |
1177 std::unique_ptr<crypto::SecureHash> hash_state = | 1177 std::unique_ptr<crypto::SecureHash> hash_state = |
1178 base::WrapUnique(new_create_info.save_info->hash_state | 1178 new_create_info.save_info->hash_state |
1179 ? new_create_info.save_info->hash_state->Clone() | 1179 ? new_create_info.save_info->hash_state->Clone() |
1180 : nullptr); | 1180 : nullptr; |
1181 | 1181 |
1182 // Interrupted downloads also need a target path. | 1182 // Interrupted downloads also need a target path. |
1183 if (target_path_.empty()) { | 1183 if (target_path_.empty()) { |
1184 received_bytes_ = offset; | 1184 received_bytes_ = offset; |
1185 hash_state_ = std::move(hash_state); | 1185 hash_state_ = std::move(hash_state); |
1186 hash_.clear(); | 1186 hash_.clear(); |
1187 destination_error_ = new_create_info.result; | 1187 destination_error_ = new_create_info.result; |
1188 TransitionTo(INTERRUPTED_TARGET_PENDING_INTERNAL); | 1188 TransitionTo(INTERRUPTED_TARGET_PENDING_INTERNAL); |
1189 DetermineDownloadTarget(); | 1189 DetermineDownloadTarget(); |
1190 return; | 1190 return; |
(...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2098 case RESUME_MODE_USER_CONTINUE: | 2098 case RESUME_MODE_USER_CONTINUE: |
2099 return "USER_CONTINUE"; | 2099 return "USER_CONTINUE"; |
2100 case RESUME_MODE_USER_RESTART: | 2100 case RESUME_MODE_USER_RESTART: |
2101 return "USER_RESTART"; | 2101 return "USER_RESTART"; |
2102 } | 2102 } |
2103 NOTREACHED() << "Unknown resume mode " << mode; | 2103 NOTREACHED() << "Unknown resume mode " << mode; |
2104 return "unknown"; | 2104 return "unknown"; |
2105 } | 2105 } |
2106 | 2106 |
2107 } // namespace content | 2107 } // namespace content |
OLD | NEW |