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/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 | 176 |
177 // Calls CheckPreConditionForEnsureFileDownloaded() with the entry specified by | 177 // Calls CheckPreConditionForEnsureFileDownloaded() with the entry specified by |
178 // the given ID. Also fills |drive_file_path| with the path of the entry. | 178 // the given ID. Also fills |drive_file_path| with the path of the entry. |
179 FileError CheckPreConditionForEnsureFileDownloadedByLocalId( | 179 FileError CheckPreConditionForEnsureFileDownloadedByLocalId( |
180 const CheckPreconditionForEnsureFileDownloadedParams& params, | 180 const CheckPreconditionForEnsureFileDownloadedParams& params, |
181 const std::string& local_id, | 181 const std::string& local_id, |
182 base::FilePath* drive_file_path, | 182 base::FilePath* drive_file_path, |
183 base::FilePath* cache_file_path, | 183 base::FilePath* cache_file_path, |
184 base::FilePath* temp_download_file_path, | 184 base::FilePath* temp_download_file_path, |
185 ResourceEntry* entry) { | 185 ResourceEntry* entry) { |
186 *drive_file_path = params.metadata->GetFilePath(local_id); | 186 FileError error = params.metadata->GetFilePath(local_id, drive_file_path); |
| 187 if (error != FILE_ERROR_OK) |
| 188 return error; |
187 return CheckPreConditionForEnsureFileDownloaded( | 189 return CheckPreConditionForEnsureFileDownloaded( |
188 params.metadata, params.cache, params.temporary_file_directory, local_id, | 190 params.metadata, params.cache, params.temporary_file_directory, local_id, |
189 entry, cache_file_path, temp_download_file_path); | 191 entry, cache_file_path, temp_download_file_path); |
190 } | 192 } |
191 | 193 |
192 // Calls CheckPreConditionForEnsureFileDownloaded() with the entry specified by | 194 // Calls CheckPreConditionForEnsureFileDownloaded() with the entry specified by |
193 // the given file path. | 195 // the given file path. |
194 FileError CheckPreConditionForEnsureFileDownloadedByPath( | 196 FileError CheckPreConditionForEnsureFileDownloadedByPath( |
195 const CheckPreconditionForEnsureFileDownloadedParams& params, | 197 const CheckPreconditionForEnsureFileDownloadedParams& params, |
196 const base::FilePath& file_path, | 198 const base::FilePath& file_path, |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 observer_->OnDirectoryChangedByOperation(file_path.DirName()); | 517 observer_->OnDirectoryChangedByOperation(file_path.DirName()); |
516 params->OnComplete(*cache_file_path); | 518 params->OnComplete(*cache_file_path); |
517 } | 519 } |
518 | 520 |
519 void DownloadOperation::CancelJob(JobID job_id) { | 521 void DownloadOperation::CancelJob(JobID job_id) { |
520 scheduler_->CancelJob(job_id); | 522 scheduler_->CancelJob(job_id); |
521 } | 523 } |
522 | 524 |
523 } // namespace file_system | 525 } // namespace file_system |
524 } // namespace drive | 526 } // namespace drive |
OLD | NEW |