| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/drive/chromeos/file_system/download_operation.h" | 5 #include "components/drive/chromeos/file_system/download_operation.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 DCHECK(entry_); | 277 DCHECK(entry_); |
| 278 } | 278 } |
| 279 | 279 |
| 280 base::Closure GetCancelClosure() { | 280 base::Closure GetCancelClosure() { |
| 281 return base::Bind(&DownloadParams::Cancel, weak_ptr_factory_.GetWeakPtr()); | 281 return base::Bind(&DownloadParams::Cancel, weak_ptr_factory_.GetWeakPtr()); |
| 282 } | 282 } |
| 283 | 283 |
| 284 void OnCacheFileFound(const base::FilePath& cache_file_path) { | 284 void OnCacheFileFound(const base::FilePath& cache_file_path) { |
| 285 if (!initialized_callback_.is_null()) { | 285 if (!initialized_callback_.is_null()) { |
| 286 initialized_callback_.Run(FILE_ERROR_OK, cache_file_path, | 286 initialized_callback_.Run(FILE_ERROR_OK, cache_file_path, |
| 287 base::WrapUnique(new ResourceEntry(*entry_))); | 287 base::MakeUnique<ResourceEntry>(*entry_)); |
| 288 } | 288 } |
| 289 completion_callback_.Run(FILE_ERROR_OK, cache_file_path, std::move(entry_)); | 289 completion_callback_.Run(FILE_ERROR_OK, cache_file_path, std::move(entry_)); |
| 290 } | 290 } |
| 291 | 291 |
| 292 void OnStartDownloading(const base::Closure& cancel_download_closure) { | 292 void OnStartDownloading(const base::Closure& cancel_download_closure) { |
| 293 cancel_download_closure_ = cancel_download_closure; | 293 cancel_download_closure_ = cancel_download_closure; |
| 294 if (initialized_callback_.is_null()) { | 294 if (initialized_callback_.is_null()) { |
| 295 return; | 295 return; |
| 296 } | 296 } |
| 297 | 297 |
| 298 DCHECK(entry_); | 298 DCHECK(entry_); |
| 299 initialized_callback_.Run(FILE_ERROR_OK, base::FilePath(), | 299 initialized_callback_.Run(FILE_ERROR_OK, base::FilePath(), |
| 300 base::WrapUnique(new ResourceEntry(*entry_))); | 300 base::MakeUnique<ResourceEntry>(*entry_)); |
| 301 } | 301 } |
| 302 | 302 |
| 303 void OnError(FileError error) const { | 303 void OnError(FileError error) const { |
| 304 completion_callback_.Run(error, base::FilePath(), | 304 completion_callback_.Run(error, base::FilePath(), |
| 305 std::unique_ptr<ResourceEntry>()); | 305 std::unique_ptr<ResourceEntry>()); |
| 306 } | 306 } |
| 307 | 307 |
| 308 void OnDownloadCompleted(const base::FilePath& cache_file_path, | 308 void OnDownloadCompleted(const base::FilePath& cache_file_path, |
| 309 std::unique_ptr<ResourceEntry> entry) const { | 309 std::unique_ptr<ResourceEntry> entry) const { |
| 310 completion_callback_.Run(FILE_ERROR_OK, cache_file_path, std::move(entry)); | 310 completion_callback_.Run(FILE_ERROR_OK, cache_file_path, std::move(entry)); |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 delegate_->OnFileChangedByOperation(changed_files); | 529 delegate_->OnFileChangedByOperation(changed_files); |
| 530 params->OnDownloadCompleted(*cache_file_path, std::move(entry_after_update)); | 530 params->OnDownloadCompleted(*cache_file_path, std::move(entry_after_update)); |
| 531 } | 531 } |
| 532 | 532 |
| 533 void DownloadOperation::CancelJob(JobID job_id) { | 533 void DownloadOperation::CancelJob(JobID job_id) { |
| 534 scheduler_->CancelJob(job_id); | 534 scheduler_->CancelJob(job_id); |
| 535 } | 535 } |
| 536 | 536 |
| 537 } // namespace file_system | 537 } // namespace file_system |
| 538 } // namespace drive | 538 } // namespace drive |
| OLD | NEW |