| 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 "chrome/browser/chromeos/drive/file_system/download_operation.h" | 5 #include "chrome/browser/chromeos/drive/file_system/download_operation.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/task_runner_util.h" | 10 #include "base/task_runner_util.h" |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 | 465 |
| 466 if (error != FILE_ERROR_OK) { | 466 if (error != FILE_ERROR_OK) { |
| 467 callback.OnError(error); | 467 callback.OnError(error); |
| 468 return; | 468 return; |
| 469 } | 469 } |
| 470 | 470 |
| 471 ResourceEntry* entry_ptr = params->entry.get(); | 471 ResourceEntry* entry_ptr = params->entry.get(); |
| 472 JobID id = scheduler_->DownloadFile( | 472 JobID id = scheduler_->DownloadFile( |
| 473 params->drive_file_path, | 473 params->drive_file_path, |
| 474 params->temp_download_file_path, | 474 params->temp_download_file_path, |
| 475 params->download_url, | 475 entry_ptr->resource_id(), |
| 476 params->context, | 476 params->context, |
| 477 base::Bind(&DownloadOperation::EnsureFileDownloadedAfterDownloadFile, | 477 base::Bind(&DownloadOperation::EnsureFileDownloadedAfterDownloadFile, |
| 478 weak_ptr_factory_.GetWeakPtr(), | 478 weak_ptr_factory_.GetWeakPtr(), |
| 479 params->drive_file_path, | 479 params->drive_file_path, |
| 480 base::Passed(¶ms->entry), | 480 base::Passed(¶ms->entry), |
| 481 callback), | 481 callback), |
| 482 callback.get_content_callback()); | 482 callback.get_content_callback()); |
| 483 | 483 |
| 484 // Notify via |initialized_callback| if necessary. | 484 // Notify via |initialized_callback| if necessary. |
| 485 callback.OnStartDownloading( | 485 callback.OnStartDownloading( |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 observer_->OnDirectoryChangedByOperation(file_path.DirName()); | 533 observer_->OnDirectoryChangedByOperation(file_path.DirName()); |
| 534 callback.OnComplete(*cache_file_path, entry.Pass()); | 534 callback.OnComplete(*cache_file_path, entry.Pass()); |
| 535 } | 535 } |
| 536 | 536 |
| 537 void DownloadOperation::CancelJob(JobID job_id) { | 537 void DownloadOperation::CancelJob(JobID job_id) { |
| 538 scheduler_->CancelJob(job_id); | 538 scheduler_->CancelJob(job_id); |
| 539 } | 539 } |
| 540 | 540 |
| 541 } // namespace file_system | 541 } // namespace file_system |
| 542 } // namespace drive | 542 } // namespace drive |
| OLD | NEW |