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 #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 Loading... |
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 Loading... |
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 |
OLD | NEW |