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

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

Issue 1648683002: [Merge to 49] [Downloads] Avoid resetting SecureHash state across an interruption. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2623
Patch Set: Created 4 years, 10 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.h ('k') | content/browser/download/download_browsertest.cc » ('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 #include "content/browser/download/base_file.h" 5 #include "content/browser/download/base_file.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/files/file.h" 10 #include "base/files/file.h"
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 } 196 }
197 197
198 Detach(); 198 Detach();
199 } 199 }
200 200
201 void BaseFile::Finish() { 201 void BaseFile::Finish() {
202 DCHECK_CURRENTLY_ON(BrowserThread::FILE); 202 DCHECK_CURRENTLY_ON(BrowserThread::FILE);
203 203
204 if (calculate_hash_) 204 if (calculate_hash_)
205 secure_hash_->Finish(sha256_hash_, crypto::kSHA256Length); 205 secure_hash_->Finish(sha256_hash_, crypto::kSHA256Length);
206
207 Close(); 206 Close();
208 } 207 }
209 208
209 void BaseFile::FinishWithError() {
210 DCHECK_CURRENTLY_ON(BrowserThread::FILE);
211 Close();
212 }
213
210 void BaseFile::SetClientGuid(const std::string& guid) { 214 void BaseFile::SetClientGuid(const std::string& guid) {
211 client_guid_ = guid; 215 client_guid_ = guid;
212 } 216 }
213 217
214 // OS_WIN, OS_MACOSX and OS_LINUX have specialized implementations. 218 // OS_WIN, OS_MACOSX and OS_LINUX have specialized implementations.
215 #if !defined(OS_WIN) && !defined(OS_MACOSX) && !defined(OS_LINUX) 219 #if !defined(OS_WIN) && !defined(OS_MACOSX) && !defined(OS_LINUX)
216 DownloadInterruptReason BaseFile::AnnotateWithSourceInformation() { 220 DownloadInterruptReason BaseFile::AnnotateWithSourceInformation() {
217 return DOWNLOAD_INTERRUPT_REASON_NONE; 221 return DOWNLOAD_INTERRUPT_REASON_NONE;
218 } 222 }
219 #endif 223 #endif
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 const char* operation, 347 const char* operation,
344 int os_error, 348 int os_error,
345 DownloadInterruptReason reason) { 349 DownloadInterruptReason reason) {
346 bound_net_log_.AddEvent( 350 bound_net_log_.AddEvent(
347 net::NetLog::TYPE_DOWNLOAD_FILE_ERROR, 351 net::NetLog::TYPE_DOWNLOAD_FILE_ERROR,
348 base::Bind(&FileInterruptedNetLogCallback, operation, os_error, reason)); 352 base::Bind(&FileInterruptedNetLogCallback, operation, os_error, reason));
349 return reason; 353 return reason;
350 } 354 }
351 355
352 } // namespace content 356 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/download/base_file.h ('k') | content/browser/download/download_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698