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 "chrome/browser/chromeos/drive/download_handler.h" | 5 #include "chrome/browser/chromeos/drive/download_handler.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/supports_user_data.h" | 9 #include "base/supports_user_data.h" |
10 #include "base/threading/sequenced_worker_pool.h" | 10 #include "base/threading/sequenced_worker_pool.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 DCHECK(created) << "Temporary download file creation failed"; | 65 DCHECK(created) << "Temporary download file creation failed"; |
66 return drive_tmp_download_path; | 66 return drive_tmp_download_path; |
67 } | 67 } |
68 | 68 |
69 // Moves downloaded file to Drive. | 69 // Moves downloaded file to Drive. |
70 void MoveDownloadedFile(const base::FilePath& downloaded_file, | 70 void MoveDownloadedFile(const base::FilePath& downloaded_file, |
71 FileError error, | 71 FileError error, |
72 const base::FilePath& dest_path) { | 72 const base::FilePath& dest_path) { |
73 if (error != FILE_ERROR_OK) | 73 if (error != FILE_ERROR_OK) |
74 return; | 74 return; |
75 file_util::Move(downloaded_file, dest_path); | 75 base::Move(downloaded_file, dest_path); |
76 } | 76 } |
77 | 77 |
78 // Used to implement CheckForFileExistence(). | 78 // Used to implement CheckForFileExistence(). |
79 void ContinueCheckingForFileExistence( | 79 void ContinueCheckingForFileExistence( |
80 const content::CheckForFileExistenceCallback& callback, | 80 const content::CheckForFileExistenceCallback& callback, |
81 FileError error, | 81 FileError error, |
82 scoped_ptr<ResourceEntry> entry) { | 82 scoped_ptr<ResourceEntry> entry) { |
83 callback.Run(error == FILE_ERROR_OK); | 83 callback.Run(error == FILE_ERROR_OK); |
84 } | 84 } |
85 | 85 |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 } | 302 } |
303 | 303 |
304 void DownloadHandler::UploadDownloadItem(DownloadItem* download) { | 304 void DownloadHandler::UploadDownloadItem(DownloadItem* download) { |
305 DCHECK_EQ(DownloadItem::COMPLETE, download->GetState()); | 305 DCHECK_EQ(DownloadItem::COMPLETE, download->GetState()); |
306 file_write_helper_->PrepareWritableFileAndRun( | 306 file_write_helper_->PrepareWritableFileAndRun( |
307 util::ExtractDrivePath(GetTargetPath(download)), | 307 util::ExtractDrivePath(GetTargetPath(download)), |
308 base::Bind(&MoveDownloadedFile, download->GetTargetFilePath())); | 308 base::Bind(&MoveDownloadedFile, download->GetTargetFilePath())); |
309 } | 309 } |
310 | 310 |
311 } // namespace drive | 311 } // namespace drive |
OLD | NEW |