| Index: webkit/fileapi/local_file_system_operation.cc
|
| diff --git a/webkit/fileapi/local_file_system_operation.cc b/webkit/fileapi/local_file_system_operation.cc
|
| index dc0281a67b7df20dcc444947ff1c1ed9accffe91..2debcede2b878aee75e1231e5f157a08c63e8271 100644
|
| --- a/webkit/fileapi/local_file_system_operation.cc
|
| +++ b/webkit/fileapi/local_file_system_operation.cc
|
| @@ -11,6 +11,7 @@
|
| #include "net/base/escape.h"
|
| #include "net/url_request/url_request_context.h"
|
| #include "webkit/blob/shareable_file_reference.h"
|
| +#include "webkit/fileapi/cross_operation_delegate.h"
|
| #include "webkit/fileapi/file_observers.h"
|
| #include "webkit/fileapi/file_system_context.h"
|
| #include "webkit/fileapi/file_system_file_util_proxy.h"
|
| @@ -36,13 +37,6 @@ bool IsMediaFileSystemType(FileSystemType type) {
|
| type == kFileSystemTypeDeviceMedia;
|
| }
|
|
|
| -bool IsCrossOperationAllowed(FileSystemType src_type,
|
| - FileSystemType dest_type) {
|
| - // If two types are supposed to run on different task runners we should not
|
| - // allow cross FileUtil operations at this layer.
|
| - return IsMediaFileSystemType(src_type) == IsMediaFileSystemType(dest_type);
|
| -}
|
| -
|
| } // namespace
|
|
|
| // LocalFileSystemOperation::ScopedUpdateNotifier -----------------------------
|
| @@ -54,9 +48,7 @@ class LocalFileSystemOperation::ScopedUpdateNotifier {
|
| ~ScopedUpdateNotifier();
|
|
|
| private:
|
| - // Not owned; owned by the owner of this instance
|
| - // (i.e. LocalFileSystemOperation).
|
| - FileSystemOperationContext* operation_context_;
|
| + UpdateObserverList update_observers_;
|
| FileSystemURL url_;
|
| DISALLOW_COPY_AND_ASSIGN(ScopedUpdateNotifier);
|
| };
|
| @@ -64,14 +56,12 @@ class LocalFileSystemOperation::ScopedUpdateNotifier {
|
| LocalFileSystemOperation::ScopedUpdateNotifier::ScopedUpdateNotifier(
|
| FileSystemOperationContext* operation_context,
|
| const FileSystemURL& url)
|
| - : operation_context_(operation_context), url_(url) {
|
| - operation_context_->update_observers()->Notify(
|
| - &FileUpdateObserver::OnStartUpdate, MakeTuple(url_));
|
| + : update_observers_(*operation_context->update_observers()), url_(url) {
|
| + update_observers_.Notify(&FileUpdateObserver::OnStartUpdate, MakeTuple(url_));
|
| }
|
|
|
| LocalFileSystemOperation::ScopedUpdateNotifier::~ScopedUpdateNotifier() {
|
| - operation_context_->update_observers()->Notify(
|
| - &FileUpdateObserver::OnEndUpdate, MakeTuple(url_));
|
| + update_observers_.Notify(&FileUpdateObserver::OnEndUpdate, MakeTuple(url_));
|
| }
|
|
|
| // LocalFileSystemOperation ---------------------------------------------------
|
| @@ -86,7 +76,7 @@ void LocalFileSystemOperation::CreateFile(const FileSystemURL& url,
|
| const StatusCallback& callback) {
|
| DCHECK(SetPendingOperationType(kOperationCreateFile));
|
|
|
| - base::PlatformFileError result = SetUp(url, &src_util_, SETUP_FOR_CREATE);
|
| + base::PlatformFileError result = SetUp(url, &file_util_, SETUP_FOR_CREATE);
|
| if (result != base::PLATFORM_FILE_OK) {
|
| callback.Run(result);
|
| delete this;
|
| @@ -106,7 +96,7 @@ void LocalFileSystemOperation::CreateDirectory(const FileSystemURL& url,
|
| const StatusCallback& callback) {
|
| DCHECK(SetPendingOperationType(kOperationCreateDirectory));
|
|
|
| - base::PlatformFileError result = SetUp(url, &src_util_, SETUP_FOR_CREATE);
|
| + base::PlatformFileError result = SetUp(url, &file_util_, SETUP_FOR_CREATE);
|
| if (result != base::PLATFORM_FILE_OK) {
|
| callback.Run(result);
|
| delete this;
|
| @@ -123,70 +113,53 @@ void LocalFileSystemOperation::Copy(const FileSystemURL& src_url,
|
| const FileSystemURL& dest_url,
|
| const StatusCallback& callback) {
|
| DCHECK(SetPendingOperationType(kOperationCopy));
|
| - is_cross_operation_ = (src_url.type() != dest_url.type());
|
|
|
| - base::PlatformFileError result = SetUp(src_url, &src_util_, SETUP_FOR_READ);
|
| - if (result == base::PLATFORM_FILE_OK)
|
| - result = SetUp(dest_url, &dest_util_, SETUP_FOR_CREATE);
|
| - if (result == base::PLATFORM_FILE_OK) {
|
| - if (!IsCrossOperationAllowed(src_url.type(), dest_url.type()))
|
| - result = base::PLATFORM_FILE_ERROR_INVALID_OPERATION;
|
| - }
|
| + base::PlatformFileError result = SetUp(
|
| + dest_url, &file_util_, SETUP_FOR_WRITE);
|
| if (result != base::PLATFORM_FILE_OK) {
|
| callback.Run(result);
|
| delete this;
|
| return;
|
| }
|
|
|
| - GetUsageAndQuotaThenRunTask(
|
| - dest_url,
|
| - base::Bind(&LocalFileSystemOperation::DoCopy,
|
| - base::Unretained(this), src_url, dest_url, callback),
|
| - base::Bind(callback, base::PLATFORM_FILE_ERROR_FAILED));
|
| + DCHECK(!recursive_operation_delegate_);
|
| + recursive_operation_delegate_.reset(
|
| + new CrossOperationDelegate(
|
| + this, src_url, dest_url,
|
| + CrossOperationDelegate::OPERATION_COPY,
|
| + base::Bind(&LocalFileSystemOperation::DidFinishDelegatedOperation,
|
| + base::Unretained(this), callback)));
|
| + recursive_operation_delegate_->RunRecursively();
|
| }
|
|
|
| void LocalFileSystemOperation::Move(const FileSystemURL& src_url,
|
| const FileSystemURL& dest_url,
|
| const StatusCallback& callback) {
|
| DCHECK(SetPendingOperationType(kOperationMove));
|
| - is_cross_operation_ = (src_url.type() != dest_url.type());
|
|
|
| - scoped_ptr<LocalFileSystemOperation> deleter(this);
|
| -
|
| - // Temporarily disables cross-filesystem move.
|
| - // TODO(kinuko,tzik,kinaba): This special handling must be removed once
|
| - // we support saner cross-filesystem operation.
|
| - // (See http://crbug.com/130055)
|
| - if (is_cross_operation_) {
|
| - callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION);
|
| - return;
|
| - }
|
| -
|
| - base::PlatformFileError result = SetUp(src_url, &src_util_, SETUP_FOR_WRITE);
|
| - if (result == base::PLATFORM_FILE_OK)
|
| - result = SetUp(dest_url, &dest_util_, SETUP_FOR_CREATE);
|
| - if (result == base::PLATFORM_FILE_OK) {
|
| - if (!IsCrossOperationAllowed(src_url.type(), dest_url.type()))
|
| - result = base::PLATFORM_FILE_ERROR_INVALID_OPERATION;
|
| - }
|
| + base::PlatformFileError result = SetUp(
|
| + src_url, &file_util_, SETUP_FOR_WRITE);
|
| if (result != base::PLATFORM_FILE_OK) {
|
| callback.Run(result);
|
| + delete this;
|
| return;
|
| }
|
|
|
| - GetUsageAndQuotaThenRunTask(
|
| - dest_url,
|
| - base::Bind(&LocalFileSystemOperation::DoMove,
|
| - base::Unretained(deleter.release()),
|
| - src_url, dest_url, callback),
|
| - base::Bind(callback, base::PLATFORM_FILE_ERROR_FAILED));
|
| + DCHECK(!recursive_operation_delegate_);
|
| + recursive_operation_delegate_.reset(
|
| + new CrossOperationDelegate(
|
| + this, src_url, dest_url,
|
| + CrossOperationDelegate::OPERATION_MOVE,
|
| + base::Bind(&LocalFileSystemOperation::DidFinishDelegatedOperation,
|
| + base::Unretained(this), callback)));
|
| + recursive_operation_delegate_->RunRecursively();
|
| }
|
|
|
| void LocalFileSystemOperation::DirectoryExists(const FileSystemURL& url,
|
| const StatusCallback& callback) {
|
| DCHECK(SetPendingOperationType(kOperationDirectoryExists));
|
|
|
| - base::PlatformFileError result = SetUp(url, &src_util_, SETUP_FOR_READ);
|
| + base::PlatformFileError result = SetUp(url, &file_util_, SETUP_FOR_READ);
|
| if (result != base::PLATFORM_FILE_OK) {
|
| callback.Run(result);
|
| delete this;
|
| @@ -194,7 +167,7 @@ void LocalFileSystemOperation::DirectoryExists(const FileSystemURL& url,
|
| }
|
|
|
| FileSystemFileUtilProxy::GetFileInfo(
|
| - operation_context(), src_util_, url,
|
| + operation_context(), file_util_, url,
|
| base::Bind(&LocalFileSystemOperation::DidDirectoryExists,
|
| base::Owned(this), callback));
|
| }
|
| @@ -203,7 +176,7 @@ void LocalFileSystemOperation::FileExists(const FileSystemURL& url,
|
| const StatusCallback& callback) {
|
| DCHECK(SetPendingOperationType(kOperationFileExists));
|
|
|
| - base::PlatformFileError result = SetUp(url, &src_util_, SETUP_FOR_READ);
|
| + base::PlatformFileError result = SetUp(url, &file_util_, SETUP_FOR_READ);
|
| if (result != base::PLATFORM_FILE_OK) {
|
| callback.Run(result);
|
| delete this;
|
| @@ -211,7 +184,7 @@ void LocalFileSystemOperation::FileExists(const FileSystemURL& url,
|
| }
|
|
|
| FileSystemFileUtilProxy::GetFileInfo(
|
| - operation_context(), src_util_, url,
|
| + operation_context(), file_util_, url,
|
| base::Bind(&LocalFileSystemOperation::DidFileExists,
|
| base::Owned(this), callback));
|
| }
|
| @@ -220,7 +193,7 @@ void LocalFileSystemOperation::GetMetadata(
|
| const FileSystemURL& url, const GetMetadataCallback& callback) {
|
| DCHECK(SetPendingOperationType(kOperationGetMetadata));
|
|
|
| - base::PlatformFileError result = SetUp(url, &src_util_, SETUP_FOR_READ);
|
| + base::PlatformFileError result = SetUp(url, &file_util_, SETUP_FOR_READ);
|
| if (result != base::PLATFORM_FILE_OK) {
|
| callback.Run(result, base::PlatformFileInfo(), FilePath());
|
| delete this;
|
| @@ -228,7 +201,7 @@ void LocalFileSystemOperation::GetMetadata(
|
| }
|
|
|
| FileSystemFileUtilProxy::GetFileInfo(
|
| - operation_context(), src_util_, url,
|
| + operation_context(), file_util_, url,
|
| base::Bind(&LocalFileSystemOperation::DidGetMetadata,
|
| base::Owned(this), callback));
|
| }
|
| @@ -237,7 +210,7 @@ void LocalFileSystemOperation::ReadDirectory(
|
| const FileSystemURL& url, const ReadDirectoryCallback& callback) {
|
| DCHECK(SetPendingOperationType(kOperationReadDirectory));
|
|
|
| - base::PlatformFileError result = SetUp(url, &src_util_, SETUP_FOR_READ);
|
| + base::PlatformFileError result = SetUp(url, &file_util_, SETUP_FOR_READ);
|
| if (result != base::PLATFORM_FILE_OK) {
|
| callback.Run(result, std::vector<base::FileUtilProxy::Entry>(), false);
|
| delete this;
|
| @@ -245,7 +218,7 @@ void LocalFileSystemOperation::ReadDirectory(
|
| }
|
|
|
| FileSystemFileUtilProxy::ReadDirectory(
|
| - operation_context(), src_util_, url,
|
| + operation_context(), file_util_, url,
|
| base::Bind(&LocalFileSystemOperation::DidReadDirectory,
|
| base::Owned(this), callback));
|
| }
|
| @@ -254,14 +227,16 @@ void LocalFileSystemOperation::Remove(const FileSystemURL& url,
|
| bool recursive,
|
| const StatusCallback& callback) {
|
| DCHECK(SetPendingOperationType(kOperationRemove));
|
| - DCHECK(!remove_operation_delegate_);
|
| - remove_operation_delegate_.reset(new RemoveOperationDelegate(
|
| - this, base::Bind(&LocalFileSystemOperation::DidFinishDelegatedOperation,
|
| - base::Unretained(this), callback)));
|
| + DCHECK(!recursive_operation_delegate_);
|
| + recursive_operation_delegate_.reset(
|
| + new RemoveOperationDelegate(
|
| + this, url,
|
| + base::Bind(&LocalFileSystemOperation::DidFinishDelegatedOperation,
|
| + base::Unretained(this), callback)));
|
| if (recursive)
|
| - remove_operation_delegate_->RunRecursively(url);
|
| + recursive_operation_delegate_->RunRecursively();
|
| else
|
| - remove_operation_delegate_->Run(url);
|
| + recursive_operation_delegate_->Run();
|
| }
|
|
|
| void LocalFileSystemOperation::Write(
|
| @@ -277,7 +252,7 @@ void LocalFileSystemOperation::Truncate(const FileSystemURL& url, int64 length,
|
| const StatusCallback& callback) {
|
| DCHECK(SetPendingOperationType(kOperationTruncate));
|
|
|
| - base::PlatformFileError result = SetUp(url, &src_util_, SETUP_FOR_WRITE);
|
| + base::PlatformFileError result = SetUp(url, &file_util_, SETUP_FOR_WRITE);
|
| if (result != base::PLATFORM_FILE_OK) {
|
| callback.Run(result);
|
| delete this;
|
| @@ -296,7 +271,7 @@ void LocalFileSystemOperation::TouchFile(const FileSystemURL& url,
|
| const StatusCallback& callback) {
|
| DCHECK(SetPendingOperationType(kOperationTouchFile));
|
|
|
| - base::PlatformFileError result = SetUp(url, &src_util_, SETUP_FOR_WRITE);
|
| + base::PlatformFileError result = SetUp(url, &file_util_, SETUP_FOR_WRITE);
|
| if (result != base::PLATFORM_FILE_OK) {
|
| callback.Run(result);
|
| delete this;
|
| @@ -304,7 +279,7 @@ void LocalFileSystemOperation::TouchFile(const FileSystemURL& url,
|
| }
|
|
|
| FileSystemFileUtilProxy::Touch(
|
| - operation_context(), src_util_, url,
|
| + operation_context(), file_util_, url,
|
| last_access_time, last_modified_time,
|
| base::Bind(&LocalFileSystemOperation::DidTouchFile,
|
| base::Owned(this), callback));
|
| @@ -332,13 +307,13 @@ void LocalFileSystemOperation::OpenFile(const FileSystemURL& url,
|
| base::PLATFORM_FILE_WRITE | base::PLATFORM_FILE_EXCLUSIVE_WRITE |
|
| base::PLATFORM_FILE_DELETE_ON_CLOSE |
|
| base::PLATFORM_FILE_WRITE_ATTRIBUTES)) {
|
| - base::PlatformFileError result = SetUp(url, &src_util_, SETUP_FOR_CREATE);
|
| + base::PlatformFileError result = SetUp(url, &file_util_, SETUP_FOR_CREATE);
|
| if (result != base::PLATFORM_FILE_OK) {
|
| callback.Run(result, base::PlatformFile(), base::ProcessHandle());
|
| return;
|
| }
|
| } else {
|
| - base::PlatformFileError result = SetUp(url, &src_util_, SETUP_FOR_READ);
|
| + base::PlatformFileError result = SetUp(url, &file_util_, SETUP_FOR_READ);
|
| if (result != base::PLATFORM_FILE_OK) {
|
| callback.Run(result, base::PlatformFile(), base::ProcessHandle());
|
| return;
|
| @@ -402,13 +377,13 @@ void LocalFileSystemOperation::SyncGetPlatformPath(const FileSystemURL& url,
|
| FilePath* platform_path) {
|
| DCHECK(SetPendingOperationType(kOperationGetLocalPath));
|
|
|
| - base::PlatformFileError result = SetUp(url, &src_util_, SETUP_FOR_READ);
|
| + base::PlatformFileError result = SetUp(url, &file_util_, SETUP_FOR_READ);
|
| if (result != base::PLATFORM_FILE_OK) {
|
| delete this;
|
| return;
|
| }
|
|
|
| - src_util_->GetLocalFilePath(operation_context(), url, platform_path);
|
| + file_util_->GetLocalFilePath(operation_context(), url, platform_path);
|
|
|
| delete this;
|
| }
|
| @@ -418,7 +393,7 @@ void LocalFileSystemOperation::CreateSnapshotFile(
|
| const SnapshotFileCallback& callback) {
|
| DCHECK(SetPendingOperationType(kOperationCreateSnapshotFile));
|
|
|
| - base::PlatformFileError result = SetUp(url, &src_util_, SETUP_FOR_READ);
|
| + base::PlatformFileError result = SetUp(url, &file_util_, SETUP_FOR_READ);
|
| if (result != base::PLATFORM_FILE_OK) {
|
| callback.Run(result, base::PlatformFileInfo(), FilePath(), NULL);
|
| delete this;
|
| @@ -426,7 +401,7 @@ void LocalFileSystemOperation::CreateSnapshotFile(
|
| }
|
|
|
| FileSystemFileUtilProxy::CreateSnapshotFile(
|
| - operation_context(), src_util_, url,
|
| + operation_context(), file_util_, url,
|
| base::Bind(&LocalFileSystemOperation::DidCreateSnapshotFile,
|
| base::Owned(this), callback));
|
| }
|
| @@ -438,7 +413,7 @@ void LocalFileSystemOperation::CopyInForeignFile(
|
| DCHECK(SetPendingOperationType(kOperationCopyInForeignFile));
|
|
|
| base::PlatformFileError result = SetUp(
|
| - dest_url, &dest_util_, SETUP_FOR_CREATE);
|
| + dest_url, &file_util_, SETUP_FOR_CREATE);
|
| if (result != base::PLATFORM_FILE_OK) {
|
| callback.Run(result);
|
| delete this;
|
| @@ -457,7 +432,7 @@ void LocalFileSystemOperation::RemoveFile(
|
| const FileSystemURL& url,
|
| const StatusCallback& callback) {
|
| DCHECK(SetPendingOperationType(kOperationRemove));
|
| - base::PlatformFileError result = SetUp(url, &src_util_, SETUP_FOR_WRITE);
|
| + base::PlatformFileError result = SetUp(url, &file_util_, SETUP_FOR_WRITE);
|
| if (result != base::PLATFORM_FILE_OK) {
|
| callback.Run(result);
|
| delete this;
|
| @@ -465,7 +440,7 @@ void LocalFileSystemOperation::RemoveFile(
|
| }
|
|
|
| FileSystemFileUtilProxy::DeleteFile(
|
| - operation_context(), src_util_, url,
|
| + operation_context(), file_util_, url,
|
| base::Bind(&LocalFileSystemOperation::DidFinishFileOperation,
|
| base::Owned(this), callback));
|
| }
|
| @@ -474,7 +449,7 @@ void LocalFileSystemOperation::RemoveDirectory(
|
| const FileSystemURL& url,
|
| const StatusCallback& callback) {
|
| DCHECK(SetPendingOperationType(kOperationRemove));
|
| - base::PlatformFileError result = SetUp(url, &src_util_, SETUP_FOR_WRITE);
|
| + base::PlatformFileError result = SetUp(url, &file_util_, SETUP_FOR_WRITE);
|
| if (result != base::PLATFORM_FILE_OK) {
|
| callback.Run(result);
|
| delete this;
|
| @@ -482,20 +457,77 @@ void LocalFileSystemOperation::RemoveDirectory(
|
| }
|
|
|
| FileSystemFileUtilProxy::DeleteDirectory(
|
| - operation_context(), src_util_, url,
|
| + operation_context(), file_util_, url,
|
| base::Bind(&LocalFileSystemOperation::DidFinishFileOperation,
|
| base::Owned(this), callback));
|
| }
|
|
|
| +void LocalFileSystemOperation::CopyFileLocal(
|
| + const FileSystemURL& src_url,
|
| + const FileSystemURL& dest_url,
|
| + const StatusCallback& callback) {
|
| + DCHECK(SetPendingOperationType(kOperationCopy));
|
| + DCHECK_EQ(src_url.origin(), dest_url.origin());
|
| + DCHECK_EQ(src_url.type(), dest_url.type());
|
| +
|
| + base::PlatformFileError result = SetUp(src_url, &file_util_, SETUP_FOR_READ);
|
| + if (result == base::PLATFORM_FILE_OK)
|
| + result = SetUp(dest_url, &file_util_, SETUP_FOR_CREATE);
|
| + if (result != base::PLATFORM_FILE_OK) {
|
| + callback.Run(result);
|
| + delete this;
|
| + return;
|
| + }
|
| +
|
| + // Record read access for src_url.
|
| + operation_context()->access_observers()->Notify(
|
| + &FileAccessObserver::OnAccess, MakeTuple(src_url));
|
| + // Record update access for dest_url.
|
| + scoped_update_notifiers_.push_back(new ScopedUpdateNotifier(
|
| + operation_context(), dest_url));
|
| +
|
| + GetUsageAndQuotaThenRunTask(
|
| + dest_url,
|
| + base::Bind(&LocalFileSystemOperation::DoCopyFileLocal,
|
| + base::Unretained(this), src_url, dest_url, callback),
|
| + base::Bind(callback, base::PLATFORM_FILE_ERROR_FAILED));
|
| +}
|
| +
|
| +void LocalFileSystemOperation::MoveFileLocal(
|
| + const FileSystemURL& src_url,
|
| + const FileSystemURL& dest_url,
|
| + const StatusCallback& callback) {
|
| + DCHECK(SetPendingOperationType(kOperationMove));
|
| + DCHECK_EQ(src_url.origin(), dest_url.origin());
|
| + DCHECK_EQ(src_url.type(), dest_url.type());
|
| +
|
| + base::PlatformFileError result = SetUp(src_url, &file_util_, SETUP_FOR_WRITE);
|
| + if (result == base::PLATFORM_FILE_OK)
|
| + result = SetUp(dest_url, &file_util_, SETUP_FOR_CREATE);
|
| + if (result != base::PLATFORM_FILE_OK) {
|
| + callback.Run(result);
|
| + delete this;
|
| + return;
|
| + }
|
| +
|
| + // Record update access for dest_url.
|
| + scoped_update_notifiers_.push_back(new ScopedUpdateNotifier(
|
| + operation_context(), dest_url));
|
| +
|
| + GetUsageAndQuotaThenRunTask(
|
| + dest_url,
|
| + base::Bind(&LocalFileSystemOperation::DoMoveFileLocal,
|
| + base::Unretained(this), src_url, dest_url, callback),
|
| + base::Bind(callback, base::PLATFORM_FILE_ERROR_FAILED));
|
| +}
|
| +
|
| LocalFileSystemOperation::LocalFileSystemOperation(
|
| FileSystemContext* file_system_context,
|
| scoped_ptr<FileSystemOperationContext> operation_context)
|
| : file_system_context_(file_system_context),
|
| operation_context_(operation_context.Pass()),
|
| - src_util_(NULL),
|
| - dest_util_(NULL),
|
| + file_util_(NULL),
|
| overriding_operation_context_(NULL),
|
| - is_cross_operation_(false),
|
| peer_handle_(base::kNullProcessHandle),
|
| pending_operation_(kOperationNone),
|
| weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
|
| @@ -549,7 +581,7 @@ base::Closure LocalFileSystemOperation::GetWriteClosure(
|
| const WriteCallback& callback) {
|
| DCHECK(SetPendingOperationType(kOperationWrite));
|
|
|
| - base::PlatformFileError result = SetUp(url, &src_util_, SETUP_FOR_WRITE);
|
| + base::PlatformFileError result = SetUp(url, &file_util_, SETUP_FOR_WRITE);
|
| if (result != base::PLATFORM_FILE_OK) {
|
| return base::Bind(&LocalFileSystemOperation::DidFailWrite,
|
| base::Owned(this), callback, result);
|
| @@ -595,7 +627,7 @@ void LocalFileSystemOperation::DoCreateFile(
|
| bool exclusive) {
|
| FileSystemFileUtilProxy::EnsureFileExists(
|
| operation_context(),
|
| - src_util_, url,
|
| + file_util_, url,
|
| base::Bind(
|
| exclusive ?
|
| &LocalFileSystemOperation::DidEnsureFileExistsExclusive :
|
| @@ -609,41 +641,40 @@ void LocalFileSystemOperation::DoCreateDirectory(
|
| bool exclusive, bool recursive) {
|
| FileSystemFileUtilProxy::CreateDirectory(
|
| operation_context(),
|
| - src_util_, url, exclusive, recursive,
|
| + file_util_, url, exclusive, recursive,
|
| base::Bind(&LocalFileSystemOperation::DidFinishFileOperation,
|
| base::Owned(this), callback));
|
| }
|
|
|
| -void LocalFileSystemOperation::DoCopy(const FileSystemURL& src_url,
|
| - const FileSystemURL& dest_url,
|
| - const StatusCallback& callback) {
|
| - FileSystemFileUtilProxy::Copy(
|
| +void LocalFileSystemOperation::DoCopyFileLocal(
|
| + const FileSystemURL& src_url,
|
| + const FileSystemURL& dest_url,
|
| + const StatusCallback& callback) {
|
| + FileSystemFileUtilProxy::CopyFileLocal(
|
| operation_context(),
|
| - src_util_, dest_util_,
|
| - src_url, dest_url,
|
| + file_util_, src_url, dest_url,
|
| base::Bind(&LocalFileSystemOperation::DidFinishFileOperation,
|
| base::Owned(this), callback));
|
| }
|
|
|
| -void LocalFileSystemOperation::DoCopyInForeignFile(
|
| - const FilePath& src_local_disk_file_path,
|
| +void LocalFileSystemOperation::DoMoveFileLocal(
|
| + const FileSystemURL& src_url,
|
| const FileSystemURL& dest_url,
|
| const StatusCallback& callback) {
|
| - FileSystemFileUtilProxy::CopyInForeignFile(
|
| + FileSystemFileUtilProxy::MoveFileLocal(
|
| operation_context(),
|
| - dest_util_,
|
| - src_local_disk_file_path, dest_url,
|
| + file_util_, src_url, dest_url,
|
| base::Bind(&LocalFileSystemOperation::DidFinishFileOperation,
|
| base::Owned(this), callback));
|
| }
|
|
|
| -void LocalFileSystemOperation::DoMove(const FileSystemURL& src_url,
|
| - const FileSystemURL& dest_url,
|
| - const StatusCallback& callback) {
|
| - FileSystemFileUtilProxy::Move(
|
| +void LocalFileSystemOperation::DoCopyInForeignFile(
|
| + const FilePath& src_local_disk_file_path,
|
| + const FileSystemURL& dest_url,
|
| + const StatusCallback& callback) {
|
| + FileSystemFileUtilProxy::CopyInForeignFile(
|
| operation_context(),
|
| - src_util_, dest_util_,
|
| - src_url, dest_url,
|
| + file_util_, src_local_disk_file_path, dest_url,
|
| base::Bind(&LocalFileSystemOperation::DidFinishFileOperation,
|
| base::Owned(this), callback));
|
| }
|
| @@ -652,7 +683,7 @@ void LocalFileSystemOperation::DoTruncate(const FileSystemURL& url,
|
| const StatusCallback& callback,
|
| int64 length) {
|
| FileSystemFileUtilProxy::Truncate(
|
| - operation_context(), src_util_, url, length,
|
| + operation_context(), file_util_, url, length,
|
| base::Bind(&LocalFileSystemOperation::DidFinishFileOperation,
|
| base::Owned(this), callback));
|
| }
|
| @@ -661,7 +692,7 @@ void LocalFileSystemOperation::DoOpenFile(const FileSystemURL& url,
|
| const OpenFileCallback& callback,
|
| int file_flags) {
|
| FileSystemFileUtilProxy::CreateOrOpen(
|
| - operation_context(), src_util_, url, file_flags,
|
| + operation_context(), file_util_, url, file_flags,
|
| base::Bind(&LocalFileSystemOperation::DidOpenFile,
|
| base::Owned(this), callback));
|
| }
|
| @@ -825,14 +856,8 @@ base::PlatformFileError LocalFileSystemOperation::SetUp(
|
| return base::PLATFORM_FILE_ERROR_SECURITY;
|
|
|
| if (mode == SETUP_FOR_READ) {
|
| - // TODO(kinuko): This doesn't work well for cross-filesystem operation
|
| - // in the current architecture since the operation context (thus the
|
| - // observers) is configured for the destination URL while this method
|
| - // could be called for both src and dest URL.
|
| - if (!is_cross_operation_) {
|
| - operation_context()->access_observers()->Notify(
|
| - &FileAccessObserver::OnAccess, MakeTuple(url));
|
| - }
|
| + operation_context()->access_observers()->Notify(
|
| + &FileAccessObserver::OnAccess, MakeTuple(url));
|
| return base::PLATFORM_FILE_OK;
|
| }
|
|
|
|
|