| 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 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 void DownloadFileImpl::Initialize(const InitializeCallback& callback) { | 72 void DownloadFileImpl::Initialize(const InitializeCallback& callback) { |
| 73 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | 73 DCHECK_CURRENTLY_ON(BrowserThread::FILE); |
| 74 | 74 |
| 75 update_timer_.reset(new base::RepeatingTimer()); | 75 update_timer_.reset(new base::RepeatingTimer()); |
| 76 DownloadInterruptReason result = | 76 DownloadInterruptReason result = |
| 77 file_.Initialize(save_info_->file_path, | 77 file_.Initialize(save_info_->file_path, |
| 78 default_download_directory_, | 78 default_download_directory_, |
| 79 std::move(save_info_->file), | 79 std::move(save_info_->file), |
| 80 save_info_->offset, | 80 save_info_->offset, |
| 81 save_info_->hash_of_partial_file, | 81 save_info_->hash_of_partial_file, |
| 82 std::move(save_info_->hash_state)); | 82 std::move(save_info_->hash_state), |
| 83 false); |
| 83 if (result != DOWNLOAD_INTERRUPT_REASON_NONE) { | 84 if (result != DOWNLOAD_INTERRUPT_REASON_NONE) { |
| 84 BrowserThread::PostTask( | 85 BrowserThread::PostTask( |
| 85 BrowserThread::UI, FROM_HERE, base::Bind(callback, result)); | 86 BrowserThread::UI, FROM_HERE, base::Bind(callback, result)); |
| 86 return; | 87 return; |
| 87 } | 88 } |
| 88 | 89 |
| 89 stream_reader_->RegisterCallback( | 90 stream_reader_->RegisterCallback( |
| 90 base::Bind(&DownloadFileImpl::StreamActive, weak_factory_.GetWeakPtr())); | 91 base::Bind(&DownloadFileImpl::StreamActive, weak_factory_.GetWeakPtr())); |
| 91 | 92 |
| 92 download_start_ = base::TimeTicks::Now(); | 93 download_start_ = base::TimeTicks::Now(); |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 const base::FilePath& new_path, | 359 const base::FilePath& new_path, |
| 359 const RenameCompletionCallback& completion_callback) | 360 const RenameCompletionCallback& completion_callback) |
| 360 : option(option), | 361 : option(option), |
| 361 new_path(new_path), | 362 new_path(new_path), |
| 362 retries_left(kMaxRenameRetries), | 363 retries_left(kMaxRenameRetries), |
| 363 completion_callback(completion_callback) {} | 364 completion_callback(completion_callback) {} |
| 364 | 365 |
| 365 DownloadFileImpl::RenameParameters::~RenameParameters() {} | 366 DownloadFileImpl::RenameParameters::~RenameParameters() {} |
| 366 | 367 |
| 367 } // namespace content | 368 } // namespace content |
| OLD | NEW |