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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 internal::FileCache* cache, | 175 internal::FileCache* cache, |
176 const std::string& resource_id, | 176 const std::string& resource_id, |
177 const std::string& md5, | 177 const std::string& md5, |
178 google_apis::GDataErrorCode gdata_error, | 178 google_apis::GDataErrorCode gdata_error, |
179 const base::FilePath& downloaded_file_path, | 179 const base::FilePath& downloaded_file_path, |
180 base::FilePath* cache_file_path) { | 180 base::FilePath* cache_file_path) { |
181 DCHECK(cache); | 181 DCHECK(cache); |
182 | 182 |
183 FileError error = util::GDataToFileError(gdata_error); | 183 FileError error = util::GDataToFileError(gdata_error); |
184 if (error != FILE_ERROR_OK) { | 184 if (error != FILE_ERROR_OK) { |
185 base::Delete(downloaded_file_path, false /* recursive */); | 185 base::DeleteFile(downloaded_file_path, false /* recursive */); |
186 return error; | 186 return error; |
187 } | 187 } |
188 | 188 |
189 // Here the download is completed successfully, so store it into the cache. | 189 // Here the download is completed successfully, so store it into the cache. |
190 error = cache->Store(resource_id, md5, downloaded_file_path, | 190 error = cache->Store(resource_id, md5, downloaded_file_path, |
191 internal::FileCache::FILE_OPERATION_MOVE); | 191 internal::FileCache::FILE_OPERATION_MOVE); |
192 if (error != FILE_ERROR_OK) { | 192 if (error != FILE_ERROR_OK) { |
193 base::Delete(downloaded_file_path, false /* recursive */); | 193 base::DeleteFile(downloaded_file_path, false /* recursive */); |
194 return error; | 194 return error; |
195 } | 195 } |
196 | 196 |
197 return cache->GetFile(resource_id, md5, cache_file_path); | 197 return cache->GetFile(resource_id, md5, cache_file_path); |
198 } | 198 } |
199 | 199 |
200 } // namespace | 200 } // namespace |
201 | 201 |
202 class DownloadOperation::DownloadCallback { | 202 class DownloadOperation::DownloadCallback { |
203 public: | 203 public: |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 observer_->OnDirectoryChangedByOperation(file_path.DirName()); | 473 observer_->OnDirectoryChangedByOperation(file_path.DirName()); |
474 callback.OnComplete(*cache_file_path, entry.Pass()); | 474 callback.OnComplete(*cache_file_path, entry.Pass()); |
475 } | 475 } |
476 | 476 |
477 void DownloadOperation::CancelJob(JobID job_id) { | 477 void DownloadOperation::CancelJob(JobID job_id) { |
478 scheduler_->CancelJob(job_id); | 478 scheduler_->CancelJob(job_id); |
479 } | 479 } |
480 | 480 |
481 } // namespace file_system | 481 } // namespace file_system |
482 } // namespace drive | 482 } // namespace drive |
OLD | NEW |