| 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/download_file_impl.h" | 5 #include "content/browser/download/download_file_impl.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 std::string hash; | 330 std::string hash; |
| 331 if (!GetHash(&hash) || file_.IsEmptyHash(hash)) | 331 if (!GetHash(&hash) || file_.IsEmptyHash(hash)) |
| 332 hash.clear(); | 332 hash.clear(); |
| 333 SendUpdate(); | 333 SendUpdate(); |
| 334 BrowserThread::PostTask( | 334 BrowserThread::PostTask( |
| 335 BrowserThread::UI, FROM_HERE, | 335 BrowserThread::UI, FROM_HERE, |
| 336 base::Bind( | 336 base::Bind( |
| 337 &DownloadDestinationObserver::DestinationCompleted, | 337 &DownloadDestinationObserver::DestinationCompleted, |
| 338 observer_, hash)); | 338 observer_, hash)); |
| 339 } | 339 } |
| 340 if (bound_net_log_.IsLogging()) { | 340 if (bound_net_log_.GetCaptureMode().enabled()) { |
| 341 bound_net_log_.AddEvent( | 341 bound_net_log_.AddEvent( |
| 342 net::NetLog::TYPE_DOWNLOAD_STREAM_DRAINED, | 342 net::NetLog::TYPE_DOWNLOAD_STREAM_DRAINED, |
| 343 base::Bind(&FileStreamDrainedNetLogCallback, total_incoming_data_size, | 343 base::Bind(&FileStreamDrainedNetLogCallback, total_incoming_data_size, |
| 344 num_buffers)); | 344 num_buffers)); |
| 345 } | 345 } |
| 346 } | 346 } |
| 347 | 347 |
| 348 void DownloadFileImpl::SendUpdate() { | 348 void DownloadFileImpl::SendUpdate() { |
| 349 BrowserThread::PostTask( | 349 BrowserThread::PostTask( |
| 350 BrowserThread::UI, FROM_HERE, | 350 BrowserThread::UI, FROM_HERE, |
| 351 base::Bind(&DownloadDestinationObserver::DestinationUpdate, | 351 base::Bind(&DownloadDestinationObserver::DestinationUpdate, |
| 352 observer_, file_.bytes_so_far(), CurrentSpeed(), | 352 observer_, file_.bytes_so_far(), CurrentSpeed(), |
| 353 GetHashState())); | 353 GetHashState())); |
| 354 } | 354 } |
| 355 | 355 |
| 356 // static | 356 // static |
| 357 int DownloadFile::GetNumberOfDownloadFiles() { | 357 int DownloadFile::GetNumberOfDownloadFiles() { |
| 358 return number_active_objects_; | 358 return number_active_objects_; |
| 359 } | 359 } |
| 360 | 360 |
| 361 } // namespace content | 361 } // namespace content |
| OLD | NEW |