| Index: storage/browser/fileapi/file_system_operation_impl.cc
|
| diff --git a/webkit/browser/fileapi/file_system_operation_impl.cc b/storage/browser/fileapi/file_system_operation_impl.cc
|
| similarity index 63%
|
| rename from webkit/browser/fileapi/file_system_operation_impl.cc
|
| rename to storage/browser/fileapi/file_system_operation_impl.cc
|
| index 0f6728cbb5b821576e3cca99cf84a9297bd80978..aea67d7c6392f1b16700443712fe3c65bdd41819 100644
|
| --- a/webkit/browser/fileapi/file_system_operation_impl.cc
|
| +++ b/storage/browser/fileapi/file_system_operation_impl.cc
|
| @@ -2,7 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "webkit/browser/fileapi/file_system_operation_impl.h"
|
| +#include "storage/browser/fileapi/file_system_operation_impl.h"
|
|
|
| #include "base/bind.h"
|
| #include "base/single_thread_task_runner.h"
|
| @@ -10,33 +10,33 @@
|
| #include "base/time/time.h"
|
| #include "net/base/escape.h"
|
| #include "net/url_request/url_request.h"
|
| -#include "webkit/browser/fileapi/async_file_util.h"
|
| -#include "webkit/browser/fileapi/copy_or_move_operation_delegate.h"
|
| -#include "webkit/browser/fileapi/file_observers.h"
|
| -#include "webkit/browser/fileapi/file_system_backend.h"
|
| -#include "webkit/browser/fileapi/file_system_context.h"
|
| -#include "webkit/browser/fileapi/file_system_file_util.h"
|
| -#include "webkit/browser/fileapi/file_system_operation_context.h"
|
| -#include "webkit/browser/fileapi/file_system_url.h"
|
| -#include "webkit/browser/fileapi/file_writer_delegate.h"
|
| -#include "webkit/browser/fileapi/remove_operation_delegate.h"
|
| -#include "webkit/browser/fileapi/sandbox_file_system_backend.h"
|
| -#include "webkit/browser/quota/quota_manager_proxy.h"
|
| -#include "webkit/common/blob/shareable_file_reference.h"
|
| -#include "webkit/common/fileapi/file_system_types.h"
|
| -#include "webkit/common/fileapi/file_system_util.h"
|
| -#include "webkit/common/quota/quota_types.h"
|
| -
|
| -using webkit_blob::ScopedFile;
|
| -
|
| -namespace fileapi {
|
| +#include "storage/browser/fileapi/async_file_util.h"
|
| +#include "storage/browser/fileapi/copy_or_move_operation_delegate.h"
|
| +#include "storage/browser/fileapi/file_observers.h"
|
| +#include "storage/browser/fileapi/file_system_backend.h"
|
| +#include "storage/browser/fileapi/file_system_context.h"
|
| +#include "storage/browser/fileapi/file_system_file_util.h"
|
| +#include "storage/browser/fileapi/file_system_operation_context.h"
|
| +#include "storage/browser/fileapi/file_system_url.h"
|
| +#include "storage/browser/fileapi/file_writer_delegate.h"
|
| +#include "storage/browser/fileapi/remove_operation_delegate.h"
|
| +#include "storage/browser/fileapi/sandbox_file_system_backend.h"
|
| +#include "storage/browser/quota/quota_manager_proxy.h"
|
| +#include "storage/common/blob/shareable_file_reference.h"
|
| +#include "storage/common/fileapi/file_system_types.h"
|
| +#include "storage/common/fileapi/file_system_util.h"
|
| +#include "storage/common/quota/quota_types.h"
|
| +
|
| +using storage::ScopedFile;
|
| +
|
| +namespace storage {
|
|
|
| FileSystemOperation* FileSystemOperation::Create(
|
| const FileSystemURL& url,
|
| FileSystemContext* file_system_context,
|
| scoped_ptr<FileSystemOperationContext> operation_context) {
|
| - return new FileSystemOperationImpl(url, file_system_context,
|
| - operation_context.Pass());
|
| + return new FileSystemOperationImpl(
|
| + url, file_system_context, operation_context.Pass());
|
| }
|
|
|
| FileSystemOperationImpl::~FileSystemOperationImpl() {
|
| @@ -49,7 +49,10 @@ void FileSystemOperationImpl::CreateFile(const FileSystemURL& url,
|
| GetUsageAndQuotaThenRunTask(
|
| url,
|
| base::Bind(&FileSystemOperationImpl::DoCreateFile,
|
| - weak_factory_.GetWeakPtr(), url, callback, exclusive),
|
| + weak_factory_.GetWeakPtr(),
|
| + url,
|
| + callback,
|
| + exclusive),
|
| base::Bind(callback, base::File::FILE_ERROR_FAILED));
|
| }
|
|
|
| @@ -61,8 +64,11 @@ void FileSystemOperationImpl::CreateDirectory(const FileSystemURL& url,
|
| GetUsageAndQuotaThenRunTask(
|
| url,
|
| base::Bind(&FileSystemOperationImpl::DoCreateDirectory,
|
| - weak_factory_.GetWeakPtr(), url, callback,
|
| - exclusive, recursive),
|
| + weak_factory_.GetWeakPtr(),
|
| + url,
|
| + callback,
|
| + exclusive,
|
| + recursive),
|
| base::Bind(callback, base::File::FILE_ERROR_FAILED));
|
| }
|
|
|
| @@ -76,15 +82,16 @@ void FileSystemOperationImpl::Copy(
|
| DCHECK(!recursive_operation_delegate_);
|
|
|
| // TODO(hidehiko): Support |progress_callback|. (crbug.com/278038).
|
| - recursive_operation_delegate_.reset(
|
| - new CopyOrMoveOperationDelegate(
|
| - file_system_context(),
|
| - src_url, dest_url,
|
| - CopyOrMoveOperationDelegate::OPERATION_COPY,
|
| - option,
|
| - progress_callback,
|
| - base::Bind(&FileSystemOperationImpl::DidFinishOperation,
|
| - weak_factory_.GetWeakPtr(), callback)));
|
| + recursive_operation_delegate_.reset(new CopyOrMoveOperationDelegate(
|
| + file_system_context(),
|
| + src_url,
|
| + dest_url,
|
| + CopyOrMoveOperationDelegate::OPERATION_COPY,
|
| + option,
|
| + progress_callback,
|
| + base::Bind(&FileSystemOperationImpl::DidFinishOperation,
|
| + weak_factory_.GetWeakPtr(),
|
| + callback)));
|
| recursive_operation_delegate_->RunRecursively();
|
| }
|
|
|
| @@ -94,15 +101,16 @@ void FileSystemOperationImpl::Move(const FileSystemURL& src_url,
|
| const StatusCallback& callback) {
|
| DCHECK(SetPendingOperationType(kOperationMove));
|
| DCHECK(!recursive_operation_delegate_);
|
| - recursive_operation_delegate_.reset(
|
| - new CopyOrMoveOperationDelegate(
|
| - file_system_context(),
|
| - src_url, dest_url,
|
| - CopyOrMoveOperationDelegate::OPERATION_MOVE,
|
| - option,
|
| - FileSystemOperation::CopyProgressCallback(),
|
| - base::Bind(&FileSystemOperationImpl::DidFinishOperation,
|
| - weak_factory_.GetWeakPtr(), callback)));
|
| + recursive_operation_delegate_.reset(new CopyOrMoveOperationDelegate(
|
| + file_system_context(),
|
| + src_url,
|
| + dest_url,
|
| + CopyOrMoveOperationDelegate::OPERATION_MOVE,
|
| + option,
|
| + FileSystemOperation::CopyProgressCallback(),
|
| + base::Bind(&FileSystemOperationImpl::DidFinishOperation,
|
| + weak_factory_.GetWeakPtr(),
|
| + callback)));
|
| recursive_operation_delegate_->RunRecursively();
|
| }
|
|
|
| @@ -110,31 +118,35 @@ void FileSystemOperationImpl::DirectoryExists(const FileSystemURL& url,
|
| const StatusCallback& callback) {
|
| DCHECK(SetPendingOperationType(kOperationDirectoryExists));
|
| async_file_util_->GetFileInfo(
|
| - operation_context_.Pass(), url,
|
| + operation_context_.Pass(),
|
| + url,
|
| base::Bind(&FileSystemOperationImpl::DidDirectoryExists,
|
| - weak_factory_.GetWeakPtr(), callback));
|
| + weak_factory_.GetWeakPtr(),
|
| + callback));
|
| }
|
|
|
| void FileSystemOperationImpl::FileExists(const FileSystemURL& url,
|
| const StatusCallback& callback) {
|
| DCHECK(SetPendingOperationType(kOperationFileExists));
|
| async_file_util_->GetFileInfo(
|
| - operation_context_.Pass(), url,
|
| + operation_context_.Pass(),
|
| + url,
|
| base::Bind(&FileSystemOperationImpl::DidFileExists,
|
| - weak_factory_.GetWeakPtr(), callback));
|
| + weak_factory_.GetWeakPtr(),
|
| + callback));
|
| }
|
|
|
| -void FileSystemOperationImpl::GetMetadata(
|
| - const FileSystemURL& url, const GetMetadataCallback& callback) {
|
| +void FileSystemOperationImpl::GetMetadata(const FileSystemURL& url,
|
| + const GetMetadataCallback& callback) {
|
| DCHECK(SetPendingOperationType(kOperationGetMetadata));
|
| async_file_util_->GetFileInfo(operation_context_.Pass(), url, callback);
|
| }
|
|
|
| void FileSystemOperationImpl::ReadDirectory(
|
| - const FileSystemURL& url, const ReadDirectoryCallback& callback) {
|
| + const FileSystemURL& url,
|
| + const ReadDirectoryCallback& callback) {
|
| DCHECK(SetPendingOperationType(kOperationReadDirectory));
|
| - async_file_util_->ReadDirectory(
|
| - operation_context_.Pass(), url, callback);
|
| + async_file_util_->ReadDirectory(operation_context_.Pass(), url, callback);
|
| }
|
|
|
| void FileSystemOperationImpl::Remove(const FileSystemURL& url,
|
| @@ -148,17 +160,21 @@ void FileSystemOperationImpl::Remove(const FileSystemURL& url,
|
| // first. If not supported, it is delegated to RemoveOperationDelegate
|
| // in DidDeleteRecursively.
|
| async_file_util_->DeleteRecursively(
|
| - operation_context_.Pass(), url,
|
| + operation_context_.Pass(),
|
| + url,
|
| base::Bind(&FileSystemOperationImpl::DidDeleteRecursively,
|
| - weak_factory_.GetWeakPtr(), url, callback));
|
| + weak_factory_.GetWeakPtr(),
|
| + url,
|
| + callback));
|
| return;
|
| }
|
|
|
| - recursive_operation_delegate_.reset(
|
| - new RemoveOperationDelegate(
|
| - file_system_context(), url,
|
| - base::Bind(&FileSystemOperationImpl::DidFinishOperation,
|
| - weak_factory_.GetWeakPtr(), callback)));
|
| + recursive_operation_delegate_.reset(new RemoveOperationDelegate(
|
| + file_system_context(),
|
| + url,
|
| + base::Bind(&FileSystemOperationImpl::DidFinishOperation,
|
| + weak_factory_.GetWeakPtr(),
|
| + callback)));
|
| recursive_operation_delegate_->Run();
|
| }
|
|
|
| @@ -169,19 +185,24 @@ void FileSystemOperationImpl::Write(
|
| const WriteCallback& callback) {
|
| DCHECK(SetPendingOperationType(kOperationWrite));
|
| file_writer_delegate_ = writer_delegate.Pass();
|
| - file_writer_delegate_->Start(
|
| - blob_request.Pass(),
|
| - base::Bind(&FileSystemOperationImpl::DidWrite,
|
| - weak_factory_.GetWeakPtr(), url, callback));
|
| + file_writer_delegate_->Start(blob_request.Pass(),
|
| + base::Bind(&FileSystemOperationImpl::DidWrite,
|
| + weak_factory_.GetWeakPtr(),
|
| + url,
|
| + callback));
|
| }
|
|
|
| -void FileSystemOperationImpl::Truncate(const FileSystemURL& url, int64 length,
|
| +void FileSystemOperationImpl::Truncate(const FileSystemURL& url,
|
| + int64 length,
|
| const StatusCallback& callback) {
|
| DCHECK(SetPendingOperationType(kOperationTruncate));
|
| GetUsageAndQuotaThenRunTask(
|
| url,
|
| base::Bind(&FileSystemOperationImpl::DoTruncate,
|
| - weak_factory_.GetWeakPtr(), url, callback, length),
|
| + weak_factory_.GetWeakPtr(),
|
| + url,
|
| + callback,
|
| + length),
|
| base::Bind(callback, base::File::FILE_ERROR_FAILED));
|
| }
|
|
|
| @@ -191,10 +212,13 @@ void FileSystemOperationImpl::TouchFile(const FileSystemURL& url,
|
| const StatusCallback& callback) {
|
| DCHECK(SetPendingOperationType(kOperationTouchFile));
|
| async_file_util_->Touch(
|
| - operation_context_.Pass(), url,
|
| - last_access_time, last_modified_time,
|
| + operation_context_.Pass(),
|
| + url,
|
| + last_access_time,
|
| + last_modified_time,
|
| base::Bind(&FileSystemOperationImpl::DidFinishOperation,
|
| - weak_factory_.GetWeakPtr(), callback));
|
| + weak_factory_.GetWeakPtr(),
|
| + callback));
|
| }
|
|
|
| void FileSystemOperationImpl::OpenFile(const FileSystemURL& url,
|
| @@ -202,18 +226,19 @@ void FileSystemOperationImpl::OpenFile(const FileSystemURL& url,
|
| const OpenFileCallback& callback) {
|
| DCHECK(SetPendingOperationType(kOperationOpenFile));
|
|
|
| - if (file_flags &
|
| - (base::File::FLAG_TEMPORARY | base::File::FLAG_HIDDEN)) {
|
| - callback.Run(base::File(base::File::FILE_ERROR_FAILED),
|
| - base::Closure());
|
| + if (file_flags & (base::File::FLAG_TEMPORARY | base::File::FLAG_HIDDEN)) {
|
| + callback.Run(base::File(base::File::FILE_ERROR_FAILED), base::Closure());
|
| return;
|
| }
|
| GetUsageAndQuotaThenRunTask(
|
| url,
|
| base::Bind(&FileSystemOperationImpl::DoOpenFile,
|
| weak_factory_.GetWeakPtr(),
|
| - url, callback, file_flags),
|
| - base::Bind(callback, Passed(base::File(base::File::FILE_ERROR_FAILED)),
|
| + url,
|
| + callback,
|
| + file_flags),
|
| + base::Bind(callback,
|
| + Passed(base::File(base::File::FILE_ERROR_FAILED)),
|
| base::Closure()));
|
| }
|
|
|
| @@ -253,29 +278,33 @@ void FileSystemOperationImpl::CopyInForeignFile(
|
| GetUsageAndQuotaThenRunTask(
|
| dest_url,
|
| base::Bind(&FileSystemOperationImpl::DoCopyInForeignFile,
|
| - weak_factory_.GetWeakPtr(), src_local_disk_file_path, dest_url,
|
| + weak_factory_.GetWeakPtr(),
|
| + src_local_disk_file_path,
|
| + dest_url,
|
| callback),
|
| base::Bind(callback, base::File::FILE_ERROR_FAILED));
|
| }
|
|
|
| -void FileSystemOperationImpl::RemoveFile(
|
| - const FileSystemURL& url,
|
| - const StatusCallback& callback) {
|
| +void FileSystemOperationImpl::RemoveFile(const FileSystemURL& url,
|
| + const StatusCallback& callback) {
|
| DCHECK(SetPendingOperationType(kOperationRemove));
|
| async_file_util_->DeleteFile(
|
| - operation_context_.Pass(), url,
|
| + operation_context_.Pass(),
|
| + url,
|
| base::Bind(&FileSystemOperationImpl::DidFinishOperation,
|
| - weak_factory_.GetWeakPtr(), callback));
|
| + weak_factory_.GetWeakPtr(),
|
| + callback));
|
| }
|
|
|
| -void FileSystemOperationImpl::RemoveDirectory(
|
| - const FileSystemURL& url,
|
| - const StatusCallback& callback) {
|
| +void FileSystemOperationImpl::RemoveDirectory(const FileSystemURL& url,
|
| + const StatusCallback& callback) {
|
| DCHECK(SetPendingOperationType(kOperationRemove));
|
| async_file_util_->DeleteDirectory(
|
| - operation_context_.Pass(), url,
|
| + operation_context_.Pass(),
|
| + url,
|
| base::Bind(&FileSystemOperationImpl::DidFinishOperation,
|
| - weak_factory_.GetWeakPtr(), callback));
|
| + weak_factory_.GetWeakPtr(),
|
| + callback));
|
| }
|
|
|
| void FileSystemOperationImpl::CopyFileLocal(
|
| @@ -290,23 +319,29 @@ void FileSystemOperationImpl::CopyFileLocal(
|
| GetUsageAndQuotaThenRunTask(
|
| dest_url,
|
| base::Bind(&FileSystemOperationImpl::DoCopyFileLocal,
|
| - weak_factory_.GetWeakPtr(), src_url, dest_url, option,
|
| - progress_callback, callback),
|
| + weak_factory_.GetWeakPtr(),
|
| + src_url,
|
| + dest_url,
|
| + option,
|
| + progress_callback,
|
| + callback),
|
| base::Bind(callback, base::File::FILE_ERROR_FAILED));
|
| }
|
|
|
| -void FileSystemOperationImpl::MoveFileLocal(
|
| - const FileSystemURL& src_url,
|
| - const FileSystemURL& dest_url,
|
| - CopyOrMoveOption option,
|
| - const StatusCallback& callback) {
|
| +void FileSystemOperationImpl::MoveFileLocal(const FileSystemURL& src_url,
|
| + const FileSystemURL& dest_url,
|
| + CopyOrMoveOption option,
|
| + const StatusCallback& callback) {
|
| DCHECK(SetPendingOperationType(kOperationMove));
|
| DCHECK(src_url.IsInSameFileSystem(dest_url));
|
| GetUsageAndQuotaThenRunTask(
|
| dest_url,
|
| base::Bind(&FileSystemOperationImpl::DoMoveFileLocal,
|
| weak_factory_.GetWeakPtr(),
|
| - src_url, dest_url, option, callback),
|
| + src_url,
|
| + dest_url,
|
| + option,
|
| + callback),
|
| base::Bind(callback, base::File::FILE_ERROR_FAILED));
|
| }
|
|
|
| @@ -358,14 +393,17 @@ void FileSystemOperationImpl::GetUsageAndQuotaThenRunTask(
|
| url.origin(),
|
| FileSystemTypeToQuotaStorageType(url.type()),
|
| base::Bind(&FileSystemOperationImpl::DidGetUsageAndQuotaAndRunTask,
|
| - weak_factory_.GetWeakPtr(), task, error_callback));
|
| + weak_factory_.GetWeakPtr(),
|
| + task,
|
| + error_callback));
|
| }
|
|
|
| void FileSystemOperationImpl::DidGetUsageAndQuotaAndRunTask(
|
| const base::Closure& task,
|
| const base::Closure& error_callback,
|
| quota::QuotaStatusCode status,
|
| - int64 usage, int64 quota) {
|
| + int64 usage,
|
| + int64 quota) {
|
| if (status != quota::kQuotaStatusOk) {
|
| LOG(WARNING) << "Got unexpected quota error : " << status;
|
| error_callback.Run();
|
| @@ -376,28 +414,31 @@ void FileSystemOperationImpl::DidGetUsageAndQuotaAndRunTask(
|
| task.Run();
|
| }
|
|
|
| -void FileSystemOperationImpl::DoCreateFile(
|
| - const FileSystemURL& url,
|
| - const StatusCallback& callback,
|
| - bool exclusive) {
|
| +void FileSystemOperationImpl::DoCreateFile(const FileSystemURL& url,
|
| + const StatusCallback& callback,
|
| + bool exclusive) {
|
| async_file_util_->EnsureFileExists(
|
| - operation_context_.Pass(), url,
|
| + operation_context_.Pass(),
|
| + url,
|
| base::Bind(
|
| - exclusive ?
|
| - &FileSystemOperationImpl::DidEnsureFileExistsExclusive :
|
| - &FileSystemOperationImpl::DidEnsureFileExistsNonExclusive,
|
| - weak_factory_.GetWeakPtr(), callback));
|
| + exclusive ? &FileSystemOperationImpl::DidEnsureFileExistsExclusive
|
| + : &FileSystemOperationImpl::DidEnsureFileExistsNonExclusive,
|
| + weak_factory_.GetWeakPtr(),
|
| + callback));
|
| }
|
|
|
| -void FileSystemOperationImpl::DoCreateDirectory(
|
| - const FileSystemURL& url,
|
| - const StatusCallback& callback,
|
| - bool exclusive, bool recursive) {
|
| +void FileSystemOperationImpl::DoCreateDirectory(const FileSystemURL& url,
|
| + const StatusCallback& callback,
|
| + bool exclusive,
|
| + bool recursive) {
|
| async_file_util_->CreateDirectory(
|
| operation_context_.Pass(),
|
| - url, exclusive, recursive,
|
| + url,
|
| + exclusive,
|
| + recursive,
|
| base::Bind(&FileSystemOperationImpl::DidFinishOperation,
|
| - weak_factory_.GetWeakPtr(), callback));
|
| + weak_factory_.GetWeakPtr(),
|
| + callback));
|
| }
|
|
|
| void FileSystemOperationImpl::DoCopyFileLocal(
|
| @@ -407,20 +448,28 @@ void FileSystemOperationImpl::DoCopyFileLocal(
|
| const CopyFileProgressCallback& progress_callback,
|
| const StatusCallback& callback) {
|
| async_file_util_->CopyFileLocal(
|
| - operation_context_.Pass(), src_url, dest_url, option, progress_callback,
|
| + operation_context_.Pass(),
|
| + src_url,
|
| + dest_url,
|
| + option,
|
| + progress_callback,
|
| base::Bind(&FileSystemOperationImpl::DidFinishOperation,
|
| - weak_factory_.GetWeakPtr(), callback));
|
| + weak_factory_.GetWeakPtr(),
|
| + callback));
|
| }
|
|
|
| -void FileSystemOperationImpl::DoMoveFileLocal(
|
| - const FileSystemURL& src_url,
|
| - const FileSystemURL& dest_url,
|
| - CopyOrMoveOption option,
|
| - const StatusCallback& callback) {
|
| +void FileSystemOperationImpl::DoMoveFileLocal(const FileSystemURL& src_url,
|
| + const FileSystemURL& dest_url,
|
| + CopyOrMoveOption option,
|
| + const StatusCallback& callback) {
|
| async_file_util_->MoveFileLocal(
|
| - operation_context_.Pass(), src_url, dest_url, option,
|
| + operation_context_.Pass(),
|
| + src_url,
|
| + dest_url,
|
| + option,
|
| base::Bind(&FileSystemOperationImpl::DidFinishOperation,
|
| - weak_factory_.GetWeakPtr(), callback));
|
| + weak_factory_.GetWeakPtr(),
|
| + callback));
|
| }
|
|
|
| void FileSystemOperationImpl::DoCopyInForeignFile(
|
| @@ -429,32 +478,41 @@ void FileSystemOperationImpl::DoCopyInForeignFile(
|
| const StatusCallback& callback) {
|
| async_file_util_->CopyInForeignFile(
|
| operation_context_.Pass(),
|
| - src_local_disk_file_path, dest_url,
|
| + src_local_disk_file_path,
|
| + dest_url,
|
| base::Bind(&FileSystemOperationImpl::DidFinishOperation,
|
| - weak_factory_.GetWeakPtr(), callback));
|
| + weak_factory_.GetWeakPtr(),
|
| + callback));
|
| }
|
|
|
| void FileSystemOperationImpl::DoTruncate(const FileSystemURL& url,
|
| const StatusCallback& callback,
|
| int64 length) {
|
| async_file_util_->Truncate(
|
| - operation_context_.Pass(), url, length,
|
| + operation_context_.Pass(),
|
| + url,
|
| + length,
|
| base::Bind(&FileSystemOperationImpl::DidFinishOperation,
|
| - weak_factory_.GetWeakPtr(), callback));
|
| + weak_factory_.GetWeakPtr(),
|
| + callback));
|
| }
|
|
|
| void FileSystemOperationImpl::DoOpenFile(const FileSystemURL& url,
|
| const OpenFileCallback& callback,
|
| int file_flags) {
|
| async_file_util_->CreateOrOpen(
|
| - operation_context_.Pass(), url, file_flags,
|
| + operation_context_.Pass(),
|
| + url,
|
| + file_flags,
|
| base::Bind(&FileSystemOperationImpl::DidOpenFile,
|
| - weak_factory_.GetWeakPtr(), callback));
|
| + weak_factory_.GetWeakPtr(),
|
| + callback));
|
| }
|
|
|
| void FileSystemOperationImpl::DidEnsureFileExistsExclusive(
|
| const StatusCallback& callback,
|
| - base::File::Error rv, bool created) {
|
| + base::File::Error rv,
|
| + bool created) {
|
| if (rv == base::File::FILE_OK && !created) {
|
| callback.Run(base::File::FILE_ERROR_EXISTS);
|
| } else {
|
| @@ -464,21 +522,21 @@ void FileSystemOperationImpl::DidEnsureFileExistsExclusive(
|
|
|
| void FileSystemOperationImpl::DidEnsureFileExistsNonExclusive(
|
| const StatusCallback& callback,
|
| - base::File::Error rv, bool /* created */) {
|
| + base::File::Error rv,
|
| + bool /* created */) {
|
| DidFinishOperation(callback, rv);
|
| }
|
|
|
| -void FileSystemOperationImpl::DidFinishOperation(
|
| - const StatusCallback& callback,
|
| - base::File::Error rv) {
|
| +void FileSystemOperationImpl::DidFinishOperation(const StatusCallback& callback,
|
| + base::File::Error rv) {
|
| if (!cancel_callback_.is_null()) {
|
| StatusCallback cancel_callback = cancel_callback_;
|
| callback.Run(rv);
|
|
|
| // Return OK only if we succeeded to stop the operation.
|
| - cancel_callback.Run(rv == base::File::FILE_ERROR_ABORT ?
|
| - base::File::FILE_OK :
|
| - base::File::FILE_ERROR_INVALID_OPERATION);
|
| + cancel_callback.Run(rv == base::File::FILE_ERROR_ABORT
|
| + ? base::File::FILE_OK
|
| + : base::File::FILE_ERROR_INVALID_OPERATION);
|
| } else {
|
| callback.Run(rv);
|
| }
|
| @@ -493,10 +551,9 @@ void FileSystemOperationImpl::DidDirectoryExists(
|
| callback.Run(rv);
|
| }
|
|
|
| -void FileSystemOperationImpl::DidFileExists(
|
| - const StatusCallback& callback,
|
| - base::File::Error rv,
|
| - const base::File::Info& file_info) {
|
| +void FileSystemOperationImpl::DidFileExists(const StatusCallback& callback,
|
| + base::File::Error rv,
|
| + const base::File::Info& file_info) {
|
| if (rv == base::File::FILE_OK && file_info.is_directory)
|
| rv = base::File::FILE_ERROR_NOT_A_FILE;
|
| callback.Run(rv);
|
| @@ -509,11 +566,12 @@ void FileSystemOperationImpl::DidDeleteRecursively(
|
| if (rv == base::File::FILE_ERROR_INVALID_OPERATION) {
|
| // Recursive removal is not supported on this platform.
|
| DCHECK(!recursive_operation_delegate_);
|
| - recursive_operation_delegate_.reset(
|
| - new RemoveOperationDelegate(
|
| - file_system_context(), url,
|
| - base::Bind(&FileSystemOperationImpl::DidFinishOperation,
|
| - weak_factory_.GetWeakPtr(), callback)));
|
| + recursive_operation_delegate_.reset(new RemoveOperationDelegate(
|
| + file_system_context(),
|
| + url,
|
| + base::Bind(&FileSystemOperationImpl::DidFinishOperation,
|
| + weak_factory_.GetWeakPtr(),
|
| + callback)));
|
| recursive_operation_delegate_->RunRecursively();
|
| return;
|
| }
|
| @@ -527,8 +585,8 @@ void FileSystemOperationImpl::DidWrite(
|
| base::File::Error rv,
|
| int64 bytes,
|
| FileWriterDelegate::WriteProgressStatus write_status) {
|
| - const bool complete = (
|
| - write_status != FileWriterDelegate::SUCCESS_IO_PENDING);
|
| + const bool complete =
|
| + (write_status != FileWriterDelegate::SUCCESS_IO_PENDING);
|
| if (complete && write_status != FileWriterDelegate::ERROR_WRITE_NOT_STARTED) {
|
| DCHECK(operation_context_);
|
| operation_context_->change_observers()->Notify(
|
| @@ -555,4 +613,4 @@ bool FileSystemOperationImpl::SetPendingOperationType(OperationType type) {
|
| return true;
|
| }
|
|
|
| -} // namespace fileapi
|
| +} // namespace storage
|
|
|