Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(485)

Unified Diff: storage/browser/fileapi/file_system_operation_runner.cc

Issue 1194783002: Add fileManagerPrivate.onCopyError event. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: storage/browser/fileapi/file_system_operation_runner.cc
diff --git a/storage/browser/fileapi/file_system_operation_runner.cc b/storage/browser/fileapi/file_system_operation_runner.cc
index 8dc39e6c747c33452a8888b128f5823ac7eed208..469b756537a7aadede969cea9471b854b6a27a9b 100644
--- a/storage/browser/fileapi/file_system_operation_runner.cc
+++ b/storage/browser/fileapi/file_system_operation_runner.cc
@@ -86,6 +86,8 @@ OperationID FileSystemOperationRunner::Copy(
const FileSystemURL& src_url,
const FileSystemURL& dest_url,
CopyOrMoveOption option,
+ const bool continue_with_error,
+ const CopyOrMoveErrorCallback& error_callback,
const CopyProgressCallback& progress_callback,
const StatusCallback& callback) {
base::File::Error error = base::File::FILE_OK;
@@ -100,13 +102,17 @@ OperationID FileSystemOperationRunner::Copy(
PrepareForWrite(handle.id, dest_url);
PrepareForRead(handle.id, src_url);
operation->Copy(
- src_url, dest_url, option,
- progress_callback.is_null() ?
- CopyProgressCallback() :
- base::Bind(&FileSystemOperationRunner::OnCopyProgress, AsWeakPtr(),
- handle, progress_callback),
- base::Bind(&FileSystemOperationRunner::DidFinish, AsWeakPtr(),
- handle, callback));
+ src_url, dest_url, option, continue_with_error,
+ error_callback.is_null()
+ ? CopyOrMoveErrorCallback()
+ : base::Bind(&FileSystemOperationRunner::OnCopyOrMoveError,
+ AsWeakPtr(), handle, error_callback),
+ progress_callback.is_null()
+ ? CopyProgressCallback()
+ : base::Bind(&FileSystemOperationRunner::OnCopyProgress, AsWeakPtr(),
+ handle, progress_callback),
+ base::Bind(&FileSystemOperationRunner::DidFinish, AsWeakPtr(), handle,
+ callback));
return handle.id;
}
@@ -611,6 +617,22 @@ void FileSystemOperationRunner::DidCreateSnapshot(
FinishOperation(handle.id);
}
+void FileSystemOperationRunner::OnCopyOrMoveError(
+ const OperationHandle& handle,
+ const CopyOrMoveErrorCallback& callback,
+ base::File::Error error,
+ const FileSystemURL& source_url,
+ const FileSystemURL& dest_url) {
+ if (handle.scope) {
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
+ FROM_HERE,
+ base::Bind(&FileSystemOperationRunner::OnCopyOrMoveError, AsWeakPtr(),
+ handle, callback, error, source_url, dest_url));
+ return;
+ }
+ callback.Run(error, source_url, dest_url);
+}
+
void FileSystemOperationRunner::OnCopyProgress(
const OperationHandle& handle,
const CopyProgressCallback& callback,

Powered by Google App Engine
This is Rietveld 408576698