| Index: chrome/browser/chromeos/file_system_provider/fileapi/provider_async_file_util.cc
|
| diff --git a/chrome/browser/chromeos/file_system_provider/fileapi/provider_async_file_util.cc b/chrome/browser/chromeos/file_system_provider/fileapi/provider_async_file_util.cc
|
| index 3bad4ddef8edde30c01ea8ac9e0ff5bd0513a7c6..f6458a0d86134df806e81f7b92c8877141649b9f 100644
|
| --- a/chrome/browser/chromeos/file_system_provider/fileapi/provider_async_file_util.cc
|
| +++ b/chrome/browser/chromeos/file_system_provider/fileapi/provider_async_file_util.cc
|
| @@ -186,6 +186,33 @@ void OnCopyEntry(const fileapi::AsyncFileUtil::StatusCallback& callback,
|
| BrowserThread::IO, FROM_HERE, base::Bind(callback, result));
|
| }
|
|
|
| +// Executes MoveEntry on the UI thread.
|
| +void MoveEntryOnUIThread(
|
| + scoped_ptr<fileapi::FileSystemOperationContext> context,
|
| + const fileapi::FileSystemURL& source_url,
|
| + const fileapi::FileSystemURL& target_url,
|
| + const fileapi::AsyncFileUtil::StatusCallback& callback) {
|
| + util::FileSystemURLParser source_parser(source_url);
|
| + util::FileSystemURLParser target_parser(target_url);
|
| +
|
| + if (!source_parser.Parse() || !target_parser.Parse() ||
|
| + source_parser.file_system() != target_parser.file_system()) {
|
| + callback.Run(base::File::FILE_ERROR_INVALID_OPERATION);
|
| + return;
|
| + }
|
| +
|
| + target_parser.file_system()->MoveEntry(
|
| + source_parser.file_path(), target_parser.file_path(), callback);
|
| +}
|
| +
|
| +// Routes the response of CopyEntry to a callback of MoveLocalFile() on the
|
| +// IO thread.
|
| +void OnMoveEntry(const fileapi::AsyncFileUtil::StatusCallback& callback,
|
| + base::File::Error result) {
|
| + BrowserThread::PostTask(
|
| + BrowserThread::IO, FROM_HERE, base::Bind(callback, result));
|
| +}
|
| +
|
| } // namespace
|
|
|
| ProviderAsyncFileUtil::ProviderAsyncFileUtil() {}
|
| @@ -314,7 +341,15 @@ void ProviderAsyncFileUtil::MoveFileLocal(
|
| CopyOrMoveOption option,
|
| const StatusCallback& callback) {
|
| DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
| - callback.Run(base::File::FILE_ERROR_ACCESS_DENIED);
|
| + // TODO(mtomasz): Consier adding support for options (preserving last modified
|
| + // time) as well as the progress callback.
|
| + BrowserThread::PostTask(BrowserThread::UI,
|
| + FROM_HERE,
|
| + base::Bind(&MoveEntryOnUIThread,
|
| + base::Passed(&context),
|
| + src_url,
|
| + dest_url,
|
| + base::Bind(&OnMoveEntry, callback)));
|
| }
|
|
|
| void ProviderAsyncFileUtil::CopyInForeignFile(
|
|
|