| Index: webkit/fileapi/cross_operation_delegate.cc
|
| diff --git a/webkit/fileapi/cross_operation_delegate.cc b/webkit/fileapi/cross_operation_delegate.cc
|
| index 3ec57ec05076ea4a6e9f6333c8108d802669ec3e..d03a1c5de467607bf238d27530ff3a81569aee98 100644
|
| --- a/webkit/fileapi/cross_operation_delegate.cc
|
| +++ b/webkit/fileapi/cross_operation_delegate.cc
|
| @@ -55,14 +55,16 @@ void CrossOperationDelegate::RunRecursively() {
|
| }
|
|
|
| // First try to copy/move it as a file.
|
| - CopyOrMoveFile(src_root_, dest_root_,
|
| - base::Bind(&CrossOperationDelegate::DidTryCopyOrMoveFile,
|
| - AsWeakPtr()));
|
| + Request request(src_root_, dest_root_,
|
| + base::Bind(&CrossOperationDelegate::DidTryCopyOrMoveFile,
|
| + AsWeakPtr()));
|
| + CopyOrMoveFile(request);
|
| }
|
|
|
| void CrossOperationDelegate::ProcessFile(const FileSystemURL& src_url,
|
| const StatusCallback& callback) {
|
| - CopyOrMoveFile(src_url, CreateDestURL(src_url), callback);
|
| + Request request(src_url, CreateDestURL(src_url), callback);
|
| + CopyOrMoveFile(request);
|
| }
|
|
|
| void CrossOperationDelegate::ProcessDirectory(const FileSystemURL& src_url,
|
| @@ -109,21 +111,22 @@ void CrossOperationDelegate::DidTryRemoveDestRoot(
|
| // TODO(kinuko): This could be too expensive for same_file_system_==true
|
| // and operation==MOVE case, probably we can just rename the root directory.
|
| // http://crbug.com/172187
|
| + Request request(src_root_, dest_root_, callback_);
|
| StartRecursiveOperation(
|
| src_root_, base::Bind(&CrossOperationDelegate::DidFinishCopy,
|
| - AsWeakPtr(), src_root_, callback_));
|
| + AsWeakPtr(), request));
|
| }
|
|
|
| -void CrossOperationDelegate::CopyOrMoveFile(
|
| - const FileSystemURL& src,
|
| - const FileSystemURL& dest,
|
| - const StatusCallback& callback) {
|
| +void CrossOperationDelegate::CopyOrMoveFile(const Request& request) {
|
| // Same filesystem case.
|
| if (same_file_system_) {
|
| - if (operation_type_ == OPERATION_MOVE)
|
| - NewSourceOperation()->MoveFileLocal(src, dest, callback);
|
| - else
|
| - NewSourceOperation()->CopyFileLocal(src, dest, callback);
|
| + if (operation_type_ == OPERATION_MOVE) {
|
| + NewSourceOperation()->MoveFileLocal(request.src, request.dest,
|
| + request.callback);
|
| + } else {
|
| + NewSourceOperation()->CopyFileLocal(request.src, request.dest,
|
| + request.callback);
|
| + }
|
| return;
|
| }
|
|
|
| @@ -131,22 +134,22 @@ void CrossOperationDelegate::CopyOrMoveFile(
|
| // Perform CreateSnapshotFile, CopyInForeignFile and then calls
|
| // copy_callback which removes the source file if operation_type == MOVE.
|
| StatusCallback copy_callback =
|
| - base::Bind(&CrossOperationDelegate::DidFinishCopy, AsWeakPtr(),
|
| - src, callback);
|
| + base::Bind(&CrossOperationDelegate::DidFinishCopy, AsWeakPtr(), request);
|
| + Request copy_request(request.src, request.dest, copy_callback);
|
| NewSourceOperation()->CreateSnapshotFile(
|
| - src, base::Bind(&CrossOperationDelegate::DidCreateSnapshot, AsWeakPtr(),
|
| - dest, copy_callback));
|
| + request.src,
|
| + base::Bind(&CrossOperationDelegate::DidCreateSnapshot, AsWeakPtr(),
|
| + copy_request));
|
| }
|
|
|
| void CrossOperationDelegate::DidCreateSnapshot(
|
| - const FileSystemURL& dest,
|
| - const StatusCallback& callback,
|
| + const Request& request,
|
| base::PlatformFileError error,
|
| const base::PlatformFileInfo& file_info,
|
| const base::FilePath& platform_path,
|
| const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref) {
|
| if (error != base::PLATFORM_FILE_OK) {
|
| - callback.Run(error);
|
| + request.callback.Run(error);
|
| return;
|
| }
|
| current_file_ref_ = file_ref;
|
| @@ -159,41 +162,42 @@ void CrossOperationDelegate::DidCreateSnapshot(
|
| file_system_context()->GetCopyOrMoveFileValidatorFactory(
|
| dest_root_.type(), &error);
|
| if (error != base::PLATFORM_FILE_OK) {
|
| - callback.Run(error);
|
| + request.callback.Run(error);
|
| return;
|
| }
|
| if (!factory) {
|
| - DidValidateFile(dest, callback, file_info, platform_path, error);
|
| + DidValidateFile(request, file_info, platform_path, error);
|
| return;
|
| }
|
|
|
| - validator_.reset(factory->CreateCopyOrMoveFileValidator(platform_path));
|
| + base::FilePath src_path = request.src.virtual_path();
|
| + validator_.reset(
|
| + factory->CreateCopyOrMoveFileValidator(src_path, platform_path));
|
| validator_->StartValidation(
|
| base::Bind(&CrossOperationDelegate::DidValidateFile, AsWeakPtr(),
|
| - dest, callback, file_info, platform_path));
|
| + request, file_info, platform_path));
|
| }
|
|
|
| void CrossOperationDelegate::DidValidateFile(
|
| - const FileSystemURL& dest,
|
| - const StatusCallback& callback,
|
| + const Request& request,
|
| const base::PlatformFileInfo& file_info,
|
| const base::FilePath& platform_path,
|
| base::PlatformFileError error) {
|
| if (error != base::PLATFORM_FILE_OK) {
|
| - callback.Run(error);
|
| + request.callback.Run(error);
|
| return;
|
| }
|
|
|
| - NewDestOperation()->CopyInForeignFile(platform_path, dest, callback);
|
| + NewDestOperation()->CopyInForeignFile(platform_path, request.dest,
|
| + request.callback);
|
| }
|
|
|
| void CrossOperationDelegate::DidFinishCopy(
|
| - const FileSystemURL& src,
|
| - const StatusCallback& callback,
|
| + const Request& request,
|
| base::PlatformFileError error) {
|
| if (error != base::PLATFORM_FILE_OK ||
|
| operation_type_ == OPERATION_COPY) {
|
| - callback.Run(error);
|
| + request.callback.Run(error);
|
| return;
|
| }
|
|
|
| @@ -201,17 +205,17 @@ void CrossOperationDelegate::DidFinishCopy(
|
|
|
| // Remove the source for finalizing move operation.
|
| NewSourceOperation()->Remove(
|
| - src, true /* recursive */,
|
| + request.src, true /* recursive */,
|
| base::Bind(&CrossOperationDelegate::DidRemoveSourceForMove,
|
| - AsWeakPtr(), callback));
|
| + AsWeakPtr(), request));
|
| }
|
|
|
| void CrossOperationDelegate::DidRemoveSourceForMove(
|
| - const StatusCallback& callback,
|
| + const Request& request,
|
| base::PlatformFileError error) {
|
| if (error == base::PLATFORM_FILE_ERROR_NOT_FOUND)
|
| error = base::PLATFORM_FILE_OK;
|
| - callback.Run(error);
|
| + request.callback.Run(error);
|
| }
|
|
|
| FileSystemURL CrossOperationDelegate::CreateDestURL(
|
|
|