Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(398)

Side by Side Diff: content/browser/download/download_item_impl.cc

Issue 2095523002: Make //crypto factories return std::unique_ptr<>s (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: I'm blind Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/browser/download/base_file.cc ('k') | crypto/ec_private_key.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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"
35 #include "base/metrics/histogram.h" 34 #include "base/metrics/histogram.h"
36 #include "base/stl_util.h" 35 #include "base/stl_util.h"
37 #include "base/strings/string_util.h" 36 #include "base/strings/string_util.h"
38 #include "base/strings/stringprintf.h" 37 #include "base/strings/stringprintf.h"
39 #include "base/strings/utf_string_conversions.h" 38 #include "base/strings/utf_string_conversions.h"
40 #include "content/browser/download/download_create_info.h" 39 #include "content/browser/download/download_create_info.h"
41 #include "content/browser/download/download_file.h" 40 #include "content/browser/download/download_file.h"
42 #include "content/browser/download/download_interrupt_reasons_impl.h" 41 #include "content/browser/download/download_interrupt_reasons_impl.h"
43 #include "content/browser/download/download_item_impl_delegate.h" 42 #include "content/browser/download/download_item_impl_delegate.h"
44 #include "content/browser/download/download_net_log_parameters.h" 43 #include "content/browser/download/download_net_log_parameters.h"
(...skipping 1123 matching lines...) Expand 10 before | Expand all | Expand 10 after
1168 // download should go back to being interrupted. 1167 // download should go back to being interrupted.
1169 if (new_create_info.result != DOWNLOAD_INTERRUPT_REASON_NONE) { 1168 if (new_create_info.result != DOWNLOAD_INTERRUPT_REASON_NONE) {
1170 DCHECK(!download_file_.get()); 1169 DCHECK(!download_file_.get());
1171 1170
1172 // Download requests that are interrupted by Start() should result in a 1171 // Download requests that are interrupted by Start() should result in a
1173 // DownloadCreateInfo with an intact DownloadSaveInfo. 1172 // DownloadCreateInfo with an intact DownloadSaveInfo.
1174 DCHECK(new_create_info.save_info); 1173 DCHECK(new_create_info.save_info);
1175 1174
1176 int64_t offset = new_create_info.save_info->offset; 1175 int64_t offset = new_create_info.save_info->offset;
1177 std::unique_ptr<crypto::SecureHash> hash_state = 1176 std::unique_ptr<crypto::SecureHash> hash_state =
1178 base::WrapUnique(new_create_info.save_info->hash_state 1177 new_create_info.save_info->hash_state
1179 ? new_create_info.save_info->hash_state->Clone() 1178 ? new_create_info.save_info->hash_state->Clone()
1180 : nullptr); 1179 : nullptr;
1181 1180
1182 // Interrupted downloads also need a target path. 1181 // Interrupted downloads also need a target path.
1183 if (target_path_.empty()) { 1182 if (target_path_.empty()) {
1184 received_bytes_ = offset; 1183 received_bytes_ = offset;
1185 hash_state_ = std::move(hash_state); 1184 hash_state_ = std::move(hash_state);
1186 hash_.clear(); 1185 hash_.clear();
1187 destination_error_ = new_create_info.result; 1186 destination_error_ = new_create_info.result;
1188 TransitionTo(INTERRUPTED_TARGET_PENDING_INTERNAL); 1187 TransitionTo(INTERRUPTED_TARGET_PENDING_INTERNAL);
1189 DetermineDownloadTarget(); 1188 DetermineDownloadTarget();
1190 return; 1189 return;
(...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after
2098 case RESUME_MODE_USER_CONTINUE: 2097 case RESUME_MODE_USER_CONTINUE:
2099 return "USER_CONTINUE"; 2098 return "USER_CONTINUE";
2100 case RESUME_MODE_USER_RESTART: 2099 case RESUME_MODE_USER_RESTART:
2101 return "USER_RESTART"; 2100 return "USER_RESTART";
2102 } 2101 }
2103 NOTREACHED() << "Unknown resume mode " << mode; 2102 NOTREACHED() << "Unknown resume mode " << mode;
2104 return "unknown"; 2103 return "unknown";
2105 } 2104 }
2106 2105
2107 } // namespace content 2106 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/download/base_file.cc ('k') | crypto/ec_private_key.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698