| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 210 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 211 | 211 |
| 212 if (calculate_hash_) | 212 if (calculate_hash_) |
| 213 secure_hash_->Finish(sha256_hash_, kSha256HashLen); | 213 secure_hash_->Finish(sha256_hash_, kSha256HashLen); |
| 214 | 214 |
| 215 Close(); | 215 Close(); |
| 216 } | 216 } |
| 217 | 217 |
| 218 // OS_WIN, OS_MACOSX and OS_LINUX have specialized implementations. | 218 // OS_WIN, OS_MACOSX and OS_LINUX have specialized implementations. |
| 219 #if !defined(OS_WIN) && !defined(OS_MACOSX) && !defined(OS_LINUX) | 219 #if !defined(OS_WIN) && !defined(OS_MACOSX) && !defined(OS_LINUX) |
| 220 void BaseFile::AnnotateWithSourceInformation() { | 220 content::DownloadInterruptReason BaseFile::AnnotateWithSourceInformation() { |
| 221 return content::DOWNLOAD_INTERRUPT_REASON_NONE; |
| 221 } | 222 } |
| 222 #endif | 223 #endif |
| 223 | 224 |
| 224 int64 BaseFile::CurrentSpeed() const { | 225 int64 BaseFile::CurrentSpeed() const { |
| 225 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 226 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 226 return CurrentSpeedAtTime(base::TimeTicks::Now()); | 227 return CurrentSpeedAtTime(base::TimeTicks::Now()); |
| 227 } | 228 } |
| 228 | 229 |
| 229 bool BaseFile::GetHash(std::string* hash) { | 230 bool BaseFile::GetHash(std::string* hash) { |
| 230 DCHECK(!detached_); | 231 DCHECK(!detached_); |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 content::DownloadInterruptReason BaseFile::LogInterruptReason( | 357 content::DownloadInterruptReason BaseFile::LogInterruptReason( |
| 357 const char* operation, | 358 const char* operation, |
| 358 int os_error, | 359 int os_error, |
| 359 content::DownloadInterruptReason reason) { | 360 content::DownloadInterruptReason reason) { |
| 360 bound_net_log_.AddEvent( | 361 bound_net_log_.AddEvent( |
| 361 net::NetLog::TYPE_DOWNLOAD_FILE_ERROR, | 362 net::NetLog::TYPE_DOWNLOAD_FILE_ERROR, |
| 362 base::Bind(&download_net_logs::FileInterruptedCallback, operation, | 363 base::Bind(&download_net_logs::FileInterruptedCallback, operation, |
| 363 os_error, reason)); | 364 os_error, reason)); |
| 364 return reason; | 365 return reason; |
| 365 } | 366 } |
| OLD | NEW |