| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 } | 59 } |
| 60 | 60 |
| 61 DownloadFileImpl::~DownloadFileImpl() { | 61 DownloadFileImpl::~DownloadFileImpl() { |
| 62 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | 62 DCHECK_CURRENTLY_ON(BrowserThread::FILE); |
| 63 --number_active_objects_; | 63 --number_active_objects_; |
| 64 } | 64 } |
| 65 | 65 |
| 66 void DownloadFileImpl::Initialize(const InitializeCallback& callback) { | 66 void DownloadFileImpl::Initialize(const InitializeCallback& callback) { |
| 67 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | 67 DCHECK_CURRENTLY_ON(BrowserThread::FILE); |
| 68 | 68 |
| 69 update_timer_.reset(new base::RepeatingTimer<DownloadFileImpl>()); | 69 update_timer_.reset(new base::RepeatingTimer()); |
| 70 DownloadInterruptReason result = | 70 DownloadInterruptReason result = |
| 71 file_.Initialize(default_download_directory_); | 71 file_.Initialize(default_download_directory_); |
| 72 if (result != DOWNLOAD_INTERRUPT_REASON_NONE) { | 72 if (result != DOWNLOAD_INTERRUPT_REASON_NONE) { |
| 73 BrowserThread::PostTask( | 73 BrowserThread::PostTask( |
| 74 BrowserThread::UI, FROM_HERE, base::Bind(callback, result)); | 74 BrowserThread::UI, FROM_HERE, base::Bind(callback, result)); |
| 75 return; | 75 return; |
| 76 } | 76 } |
| 77 | 77 |
| 78 stream_reader_->RegisterCallback( | 78 stream_reader_->RegisterCallback( |
| 79 base::Bind(&DownloadFileImpl::StreamActive, weak_factory_.GetWeakPtr())); | 79 base::Bind(&DownloadFileImpl::StreamActive, weak_factory_.GetWeakPtr())); |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |