| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/fileapi/async_file_util.h" | 5 #include "chrome/browser/chromeos/drive/fileapi/async_file_util.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 base::File file, | 72 base::File file, |
| 73 const base::Closure& close_callback_on_ui_thread) { | 73 const base::Closure& close_callback_on_ui_thread) { |
| 74 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 74 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 75 | 75 |
| 76 // It is necessary to make a closure, which runs on file closing here. | 76 // It is necessary to make a closure, which runs on file closing here. |
| 77 // It will be provided as a FileSystem::OpenFileCallback's argument later. | 77 // It will be provided as a FileSystem::OpenFileCallback's argument later. |
| 78 // (crbug.com/259184). | 78 // (crbug.com/259184). |
| 79 callback.Run( | 79 callback.Run( |
| 80 std::move(file), | 80 std::move(file), |
| 81 base::Bind(&google_apis::RunTaskWithTaskRunner, | 81 base::Bind(&google_apis::RunTaskWithTaskRunner, |
| 82 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), | 82 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI), |
| 83 close_callback_on_ui_thread)); | 83 close_callback_on_ui_thread)); |
| 84 } | 84 } |
| 85 | 85 |
| 86 // Runs CreateOrOpenFile when the error happens. | 86 // Runs CreateOrOpenFile when the error happens. |
| 87 void RunCreateOrOpenFileCallbackOnError( | 87 void RunCreateOrOpenFileCallbackOnError( |
| 88 const AsyncFileUtil::CreateOrOpenCallback& callback, | 88 const AsyncFileUtil::CreateOrOpenCallback& callback, |
| 89 base::File::Error error) { | 89 base::File::Error error) { |
| 90 callback.Run(base::File(error), base::Closure()); | 90 callback.Run(base::File(error), base::Closure()); |
| 91 } | 91 } |
| 92 | 92 |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 base::Bind(&RunCreateSnapshotFileCallback, callback))), | 446 base::Bind(&RunCreateSnapshotFileCallback, callback))), |
| 447 base::Bind(callback, | 447 base::Bind(callback, |
| 448 base::File::FILE_ERROR_FAILED, | 448 base::File::FILE_ERROR_FAILED, |
| 449 base::File::Info(), | 449 base::File::Info(), |
| 450 base::FilePath(), | 450 base::FilePath(), |
| 451 scoped_refptr<storage::ShareableFileReference>())); | 451 scoped_refptr<storage::ShareableFileReference>())); |
| 452 } | 452 } |
| 453 | 453 |
| 454 } // namespace internal | 454 } // namespace internal |
| 455 } // namespace drive | 455 } // namespace drive |
| OLD | NEW |