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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 | 204 |
205 void BaseFile::Finish() { | 205 void BaseFile::Finish() { |
206 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 206 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
207 | 207 |
208 if (calculate_hash_) | 208 if (calculate_hash_) |
209 secure_hash_->Finish(sha256_hash_, kSha256HashLen); | 209 secure_hash_->Finish(sha256_hash_, kSha256HashLen); |
210 | 210 |
211 Close(); | 211 Close(); |
212 } | 212 } |
213 | 213 |
| 214 void BaseFile::SetClientGuid(const std::string& guid) { |
| 215 client_guid_ = guid; |
| 216 } |
| 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 |
220 | 224 |
221 bool BaseFile::GetHash(std::string* hash) { | 225 bool BaseFile::GetHash(std::string* hash) { |
222 DCHECK(!detached_); | 226 DCHECK(!detached_); |
223 hash->assign(reinterpret_cast<const char*>(sha256_hash_), | 227 hash->assign(reinterpret_cast<const char*>(sha256_hash_), |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 const char* operation, | 362 const char* operation, |
359 int os_error, | 363 int os_error, |
360 DownloadInterruptReason reason) { | 364 DownloadInterruptReason reason) { |
361 bound_net_log_.AddEvent( | 365 bound_net_log_.AddEvent( |
362 net::NetLog::TYPE_DOWNLOAD_FILE_ERROR, | 366 net::NetLog::TYPE_DOWNLOAD_FILE_ERROR, |
363 base::Bind(&FileInterruptedNetLogCallback, operation, os_error, reason)); | 367 base::Bind(&FileInterruptedNetLogCallback, operation, os_error, reason)); |
364 return reason; | 368 return reason; |
365 } | 369 } |
366 | 370 |
367 } // namespace content | 371 } // namespace content |
OLD | NEW |