summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
Diffstat (limited to 'webkit')
-rw-r--r--webkit/browser/fileapi/async_file_test_helper.cc5
-rw-r--r--webkit/browser/fileapi/async_file_util.h5
-rw-r--r--webkit/browser/fileapi/async_file_util_adapter.cc10
-rw-r--r--webkit/browser/fileapi/async_file_util_adapter.h2
-rw-r--r--webkit/browser/fileapi/copy_or_move_operation_delegate.cc18
-rw-r--r--webkit/browser/fileapi/copy_or_move_operation_delegate.h3
-rw-r--r--webkit/browser/fileapi/file_system_file_util.h5
-rw-r--r--webkit/browser/fileapi/file_system_operation.h24
-rw-r--r--webkit/browser/fileapi/file_system_operation_impl.cc17
-rw-r--r--webkit/browser/fileapi/file_system_operation_impl.h6
-rw-r--r--webkit/browser/fileapi/file_system_operation_impl_unittest.cc53
-rw-r--r--webkit/browser/fileapi/file_system_operation_runner.cc12
-rw-r--r--webkit/browser/fileapi/file_system_operation_runner.h13
-rw-r--r--webkit/browser/fileapi/local_file_util.cc2
-rw-r--r--webkit/browser/fileapi/local_file_util.h1
-rw-r--r--webkit/browser/fileapi/obfuscated_file_util.cc1
-rw-r--r--webkit/browser/fileapi/obfuscated_file_util.h1
-rw-r--r--webkit/browser/fileapi/obfuscated_file_util_unittest.cc75
18 files changed, 202 insertions, 51 deletions
diff --git a/webkit/browser/fileapi/async_file_test_helper.cc b/webkit/browser/fileapi/async_file_test_helper.cc
index e3343d5..50fd7cd 100644
--- a/webkit/browser/fileapi/async_file_test_helper.cc
+++ b/webkit/browser/fileapi/async_file_test_helper.cc
@@ -105,7 +105,7 @@ base::PlatformFileError AsyncFileTestHelper::CopyWithProgress(
base::PlatformFileError result = base::PLATFORM_FILE_ERROR_FAILED;
base::RunLoop run_loop;
context->operation_runner()->Copy(
- src, dest, progress_callback,
+ src, dest, FileSystemOperation::OPTION_NONE, progress_callback,
AssignAndQuitCallback(&run_loop, &result));
run_loop.Run();
return result;
@@ -118,7 +118,8 @@ base::PlatformFileError AsyncFileTestHelper::Move(
base::PlatformFileError result = base::PLATFORM_FILE_ERROR_FAILED;
base::RunLoop run_loop;
context->operation_runner()->Move(
- src, dest, AssignAndQuitCallback(&run_loop, &result));
+ src, dest, FileSystemOperation::OPTION_NONE,
+ AssignAndQuitCallback(&run_loop, &result));
run_loop.Run();
return result;
}
diff --git a/webkit/browser/fileapi/async_file_util.h b/webkit/browser/fileapi/async_file_util.h
index 84a033b..4b3a9f6 100644
--- a/webkit/browser/fileapi/async_file_util.h
+++ b/webkit/browser/fileapi/async_file_util.h
@@ -10,6 +10,7 @@
#include "base/files/file_util_proxy.h"
#include "base/memory/scoped_ptr.h"
#include "base/platform_file.h"
+#include "webkit/browser/fileapi/file_system_operation.h"
#include "webkit/browser/webkit_storage_browser_export.h"
#include "webkit/common/fileapi/directory_entry.h"
@@ -79,6 +80,8 @@ class AsyncFileUtil {
typedef base::Callback<void(int64 size)> CopyFileProgressCallback;
+ typedef FileSystemOperation::CopyOrMoveOption CopyOrMoveOption;
+
// Creates an AsyncFileUtil instance which performs file operations on
// local native file system. The created instance assumes
// FileSystemURL::path() has the target platform path.
@@ -229,6 +232,7 @@ class AsyncFileUtil {
scoped_ptr<FileSystemOperationContext> context,
const FileSystemURL& src_url,
const FileSystemURL& dest_url,
+ CopyOrMoveOption option,
const CopyFileProgressCallback& progress_callback,
const StatusCallback& callback) = 0;
@@ -251,6 +255,7 @@ class AsyncFileUtil {
scoped_ptr<FileSystemOperationContext> context,
const FileSystemURL& src_url,
const FileSystemURL& dest_url,
+ CopyOrMoveOption option,
const StatusCallback& callback) = 0;
// Copies in a single file from a different filesystem.
diff --git a/webkit/browser/fileapi/async_file_util_adapter.cc b/webkit/browser/fileapi/async_file_util_adapter.cc
index 54d6797..831e937 100644
--- a/webkit/browser/fileapi/async_file_util_adapter.cc
+++ b/webkit/browser/fileapi/async_file_util_adapter.cc
@@ -253,6 +253,7 @@ void AsyncFileUtilAdapter::CopyFileLocal(
scoped_ptr<FileSystemOperationContext> context,
const FileSystemURL& src_url,
const FileSystemURL& dest_url,
+ CopyOrMoveOption option,
const CopyFileProgressCallback& progress_callback,
const StatusCallback& callback) {
// TODO(hidehiko): Support progress_callback.
@@ -260,8 +261,8 @@ void AsyncFileUtilAdapter::CopyFileLocal(
const bool success = base::PostTaskAndReplyWithResult(
context_ptr->task_runner(), FROM_HERE,
Bind(&FileSystemFileUtil::CopyOrMoveFile,
- Unretained(sync_file_util_.get()),
- base::Owned(context_ptr), src_url, dest_url, true /* copy */),
+ Unretained(sync_file_util_.get()), base::Owned(context_ptr),
+ src_url, dest_url, option, true /* copy */),
callback);
DCHECK(success);
}
@@ -270,13 +271,14 @@ void AsyncFileUtilAdapter::MoveFileLocal(
scoped_ptr<FileSystemOperationContext> context,
const FileSystemURL& src_url,
const FileSystemURL& dest_url,
+ CopyOrMoveOption option,
const StatusCallback& callback) {
FileSystemOperationContext* context_ptr = context.release();
const bool success = base::PostTaskAndReplyWithResult(
context_ptr->task_runner(), FROM_HERE,
Bind(&FileSystemFileUtil::CopyOrMoveFile,
- Unretained(sync_file_util_.get()),
- base::Owned(context_ptr), src_url, dest_url, false /* copy */),
+ Unretained(sync_file_util_.get()), base::Owned(context_ptr),
+ src_url, dest_url, option, false /* copy */),
callback);
DCHECK(success);
}
diff --git a/webkit/browser/fileapi/async_file_util_adapter.h b/webkit/browser/fileapi/async_file_util_adapter.h
index 0122b11..8e90e5d 100644
--- a/webkit/browser/fileapi/async_file_util_adapter.h
+++ b/webkit/browser/fileapi/async_file_util_adapter.h
@@ -76,12 +76,14 @@ class WEBKIT_STORAGE_BROWSER_EXPORT AsyncFileUtilAdapter
scoped_ptr<FileSystemOperationContext> context,
const FileSystemURL& src_url,
const FileSystemURL& dest_url,
+ CopyOrMoveOption option,
const CopyFileProgressCallback& progress_callback,
const StatusCallback& callback) OVERRIDE;
virtual void MoveFileLocal(
scoped_ptr<FileSystemOperationContext> context,
const FileSystemURL& src_url,
const FileSystemURL& dest_url,
+ CopyOrMoveOption option,
const StatusCallback& callback) OVERRIDE;
virtual void CopyInForeignFile(
scoped_ptr<FileSystemOperationContext> context,
diff --git a/webkit/browser/fileapi/copy_or_move_operation_delegate.cc b/webkit/browser/fileapi/copy_or_move_operation_delegate.cc
index aba17b5..845e33b 100644
--- a/webkit/browser/fileapi/copy_or_move_operation_delegate.cc
+++ b/webkit/browser/fileapi/copy_or_move_operation_delegate.cc
@@ -38,22 +38,24 @@ class CopyOrMoveOnSameFileSystemImpl
CopyOrMoveOperationDelegate::OperationType operation_type,
const FileSystemURL& src_url,
const FileSystemURL& dest_url,
+ CopyOrMoveOperationDelegate::CopyOrMoveOption option,
const FileSystemOperation::CopyFileProgressCallback&
file_progress_callback)
: operation_runner_(operation_runner),
operation_type_(operation_type),
src_url_(src_url),
dest_url_(dest_url),
+ option_(option),
file_progress_callback_(file_progress_callback) {
}
virtual void Run(
const CopyOrMoveOperationDelegate::StatusCallback& callback) OVERRIDE {
if (operation_type_ == CopyOrMoveOperationDelegate::OPERATION_MOVE) {
- operation_runner_->MoveFileLocal(src_url_, dest_url_, callback);
+ operation_runner_->MoveFileLocal(src_url_, dest_url_, option_, callback);
} else {
operation_runner_->CopyFileLocal(
- src_url_, dest_url_, file_progress_callback_, callback);
+ src_url_, dest_url_, option_, file_progress_callback_, callback);
}
}
@@ -62,6 +64,7 @@ class CopyOrMoveOnSameFileSystemImpl
CopyOrMoveOperationDelegate::OperationType operation_type_;
FileSystemURL src_url_;
FileSystemURL dest_url_;
+ CopyOrMoveOperationDelegate::CopyOrMoveOption option_;
FileSystemOperation::CopyFileProgressCallback file_progress_callback_;
DISALLOW_COPY_AND_ASSIGN(CopyOrMoveOnSameFileSystemImpl);
};
@@ -78,6 +81,7 @@ class SnapshotCopyOrMoveImpl
CopyOrMoveOperationDelegate::OperationType operation_type,
const FileSystemURL& src_url,
const FileSystemURL& dest_url,
+ CopyOrMoveOperationDelegate::CopyOrMoveOption option,
CopyOrMoveFileValidatorFactory* validator_factory,
const FileSystemOperation::CopyFileProgressCallback&
file_progress_callback)
@@ -85,6 +89,7 @@ class SnapshotCopyOrMoveImpl
operation_type_(operation_type),
src_url_(src_url),
dest_url_(dest_url),
+ option_(option),
validator_factory_(validator_factory),
file_progress_callback_(file_progress_callback),
weak_factory_(this) {
@@ -273,6 +278,9 @@ class SnapshotCopyOrMoveImpl
CopyOrMoveOperationDelegate::OperationType operation_type_;
FileSystemURL src_url_;
FileSystemURL dest_url_;
+
+ // TODO(hidehiko): Implement the option's behavior.
+ CopyOrMoveOperationDelegate::CopyOrMoveOption option_;
CopyOrMoveFileValidatorFactory* validator_factory_;
scoped_ptr<CopyOrMoveFileValidator> validator_;
FileSystemOperation::CopyFileProgressCallback file_progress_callback_;
@@ -289,12 +297,14 @@ CopyOrMoveOperationDelegate::CopyOrMoveOperationDelegate(
const FileSystemURL& src_root,
const FileSystemURL& dest_root,
OperationType operation_type,
+ CopyOrMoveOption option,
const CopyProgressCallback& progress_callback,
const StatusCallback& callback)
: RecursiveOperationDelegate(file_system_context),
src_root_(src_root),
dest_root_(dest_root),
operation_type_(operation_type),
+ option_(option),
progress_callback_(progress_callback),
callback_(callback),
weak_factory_(this) {
@@ -344,7 +354,7 @@ void CopyOrMoveOperationDelegate::ProcessFile(
CopyOrMoveImpl* impl = NULL;
if (same_file_system_) {
impl = new CopyOrMoveOnSameFileSystemImpl(
- operation_runner(), operation_type_, src_url, dest_url,
+ operation_runner(), operation_type_, src_url, dest_url, option_,
base::Bind(&CopyOrMoveOperationDelegate::OnCopyFileProgress,
weak_factory_.GetWeakPtr(), src_url));
} else {
@@ -360,7 +370,7 @@ void CopyOrMoveOperationDelegate::ProcessFile(
}
impl = new SnapshotCopyOrMoveImpl(
- operation_runner(), operation_type_, src_url, dest_url,
+ operation_runner(), operation_type_, src_url, dest_url, option_,
validator_factory,
base::Bind(&CopyOrMoveOperationDelegate::OnCopyFileProgress,
weak_factory_.GetWeakPtr(), src_url));
diff --git a/webkit/browser/fileapi/copy_or_move_operation_delegate.h b/webkit/browser/fileapi/copy_or_move_operation_delegate.h
index 77d1a76..1f82a34a 100644
--- a/webkit/browser/fileapi/copy_or_move_operation_delegate.h
+++ b/webkit/browser/fileapi/copy_or_move_operation_delegate.h
@@ -25,6 +25,7 @@ class CopyOrMoveOperationDelegate
public:
class CopyOrMoveImpl;
typedef FileSystemOperation::CopyProgressCallback CopyProgressCallback;
+ typedef FileSystemOperation::CopyOrMoveOption CopyOrMoveOption;
enum OperationType {
OPERATION_COPY,
@@ -36,6 +37,7 @@ class CopyOrMoveOperationDelegate
const FileSystemURL& src_root,
const FileSystemURL& dest_root,
OperationType operation_type,
+ CopyOrMoveOption option,
const CopyProgressCallback& progress_callback,
const StatusCallback& callback);
virtual ~CopyOrMoveOperationDelegate();
@@ -75,6 +77,7 @@ class CopyOrMoveOperationDelegate
FileSystemURL dest_root_;
bool same_file_system_;
OperationType operation_type_;
+ CopyOrMoveOption option_;
CopyProgressCallback progress_callback_;
StatusCallback callback_;
diff --git a/webkit/browser/fileapi/file_system_file_util.h b/webkit/browser/fileapi/file_system_file_util.h
index 13ea0e4..a598f83 100644
--- a/webkit/browser/fileapi/file_system_file_util.h
+++ b/webkit/browser/fileapi/file_system_file_util.h
@@ -8,6 +8,7 @@
#include "base/files/file_path.h"
#include "base/memory/scoped_ptr.h"
#include "base/platform_file.h"
+#include "webkit/browser/fileapi/file_system_operation.h"
#include "webkit/browser/webkit_storage_browser_export.h"
#include "webkit/common/blob/scoped_file.h"
@@ -27,6 +28,8 @@ class FileSystemURL;
// See http://crbug.com/128136 if you need it.
class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemFileUtil {
public:
+ typedef FileSystemOperation::CopyOrMoveOption CopyOrMoveOption;
+
// It will be implemented by each subclass such as FileSystemFileEnumerator.
class WEBKIT_STORAGE_BROWSER_EXPORT AbstractFileEnumerator {
public:
@@ -129,6 +132,7 @@ class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemFileUtil {
// Copies or moves a single file from |src_url| to |dest_url|.
// The filesystem type of |src_url| and |dest_url| MUST be same.
+ // For |option|, please see file_system_operation.h
//
// This returns:
// - PLATFORM_FILE_ERROR_NOT_FOUND if |src_url|
@@ -143,6 +147,7 @@ class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemFileUtil {
FileSystemOperationContext* context,
const FileSystemURL& src_url,
const FileSystemURL& dest_url,
+ CopyOrMoveOption option,
bool copy) = 0;
// Copies in a single file from a different filesystem.
diff --git a/webkit/browser/fileapi/file_system_operation.h b/webkit/browser/fileapi/file_system_operation.h
index 99d3b3d..8ff6956 100644
--- a/webkit/browser/fileapi/file_system_operation.h
+++ b/webkit/browser/fileapi/file_system_operation.h
@@ -209,6 +209,18 @@ class FileSystemOperation {
// set to the copied file size.
typedef base::Callback<void(int64 size)> CopyFileProgressCallback;
+ // The option for copy or move operation.
+ enum CopyOrMoveOption {
+ // No additional operation.
+ OPTION_NONE,
+
+ // Preserves last modified time if possible. If the operation to update
+ // last modified time is not supported on the file system for the
+ // destination file, this option would be simply ignored (i.e. Copy would
+ // be successfully done without preserving last modified time).
+ OPTION_PRESERVE_LAST_MODIFIED,
+ };
+
// Used for Write().
typedef base::Callback<void(base::PlatformFileError result,
int64 bytes,
@@ -233,6 +245,8 @@ class FileSystemOperation {
// |src_path| is a directory, the contents of |src_path| are copied to
// |dest_path| recursively. A new file or directory is created at
// |dest_path| as needed.
+ // |option| specifies the minor behavior of Copy(). See CopyOrMoveOption's
+ // comment for details.
// |progress_callback| is periodically called to report the progress
// update. See also the comment of CopyProgressCallback. This callback is
// optional.
@@ -247,11 +261,14 @@ class FileSystemOperation {
//
virtual void Copy(const FileSystemURL& src_path,
const FileSystemURL& dest_path,
+ CopyOrMoveOption option,
const CopyProgressCallback& progress_callback,
const StatusCallback& callback) = 0;
// Moves a file or directory from |src_path| to |dest_path|. A new file
// or directory is created at |dest_path| as needed.
+ // |option| specifies the minor behavior of Copy(). See CopyOrMoveOption's
+ // comment for details.
//
// For recursive case this internally creates new FileSystemOperations and
// calls:
@@ -263,6 +280,7 @@ class FileSystemOperation {
//
virtual void Move(const FileSystemURL& src_path,
const FileSystemURL& dest_path,
+ CopyOrMoveOption option,
const StatusCallback& callback) = 0;
// Checks if a directory is present at |path|.
@@ -393,6 +411,8 @@ class FileSystemOperation {
// Copies a file from |src_url| to |dest_url|.
// This must be called for files that belong to the same filesystem
// (i.e. type() and origin() of the |src_url| and |dest_url| must match).
+ // |option| specifies the minor behavior of Copy(). See CopyOrMoveOption's
+ // comment for details.
// |progress_callback| is periodically called to report the progress
// update. See also the comment of CopyFileProgressCallback. This callback is
// optional.
@@ -408,12 +428,15 @@ class FileSystemOperation {
//
virtual void CopyFileLocal(const FileSystemURL& src_url,
const FileSystemURL& dest_url,
+ CopyOrMoveOption option,
const CopyFileProgressCallback& progress_callback,
const StatusCallback& callback) = 0;
// Moves a local file from |src_url| to |dest_url|.
// This must be called for files that belong to the same filesystem
// (i.e. type() and origin() of the |src_url| and |dest_url| must match).
+ // |option| specifies the minor behavior of Copy(). See CopyOrMoveOption's
+ // comment for details.
//
// This returns:
// - PLATFORM_FILE_ERROR_NOT_FOUND if |src_url|
@@ -426,6 +449,7 @@ class FileSystemOperation {
//
virtual void MoveFileLocal(const FileSystemURL& src_url,
const FileSystemURL& dest_url,
+ CopyOrMoveOption option,
const StatusCallback& callback) = 0;
// Synchronously gets the platform path for the given |url|.
diff --git a/webkit/browser/fileapi/file_system_operation_impl.cc b/webkit/browser/fileapi/file_system_operation_impl.cc
index c9e75eb..3a62679 100644
--- a/webkit/browser/fileapi/file_system_operation_impl.cc
+++ b/webkit/browser/fileapi/file_system_operation_impl.cc
@@ -69,6 +69,7 @@ void FileSystemOperationImpl::CreateDirectory(const FileSystemURL& url,
void FileSystemOperationImpl::Copy(
const FileSystemURL& src_url,
const FileSystemURL& dest_url,
+ CopyOrMoveOption option,
const CopyProgressCallback& progress_callback,
const StatusCallback& callback) {
DCHECK(SetPendingOperationType(kOperationCopy));
@@ -80,6 +81,7 @@ void FileSystemOperationImpl::Copy(
file_system_context(),
src_url, dest_url,
CopyOrMoveOperationDelegate::OPERATION_COPY,
+ option,
progress_callback,
base::Bind(&FileSystemOperationImpl::DidFinishOperation,
weak_factory_.GetWeakPtr(), callback)));
@@ -88,6 +90,7 @@ void FileSystemOperationImpl::Copy(
void FileSystemOperationImpl::Move(const FileSystemURL& src_url,
const FileSystemURL& dest_url,
+ CopyOrMoveOption option,
const StatusCallback& callback) {
DCHECK(SetPendingOperationType(kOperationMove));
DCHECK(!recursive_operation_delegate_);
@@ -96,6 +99,7 @@ void FileSystemOperationImpl::Move(const FileSystemURL& src_url,
file_system_context(),
src_url, dest_url,
CopyOrMoveOperationDelegate::OPERATION_MOVE,
+ option,
FileSystemOperation::CopyProgressCallback(),
base::Bind(&FileSystemOperationImpl::DidFinishOperation,
weak_factory_.GetWeakPtr(), callback)));
@@ -284,6 +288,7 @@ void FileSystemOperationImpl::RemoveDirectory(
void FileSystemOperationImpl::CopyFileLocal(
const FileSystemURL& src_url,
const FileSystemURL& dest_url,
+ CopyOrMoveOption option,
const CopyFileProgressCallback& progress_callback,
const StatusCallback& callback) {
DCHECK(SetPendingOperationType(kOperationCopy));
@@ -292,7 +297,7 @@ void FileSystemOperationImpl::CopyFileLocal(
GetUsageAndQuotaThenRunTask(
dest_url,
base::Bind(&FileSystemOperationImpl::DoCopyFileLocal,
- weak_factory_.GetWeakPtr(), src_url, dest_url,
+ weak_factory_.GetWeakPtr(), src_url, dest_url, option,
progress_callback, callback),
base::Bind(callback, base::PLATFORM_FILE_ERROR_FAILED));
}
@@ -300,13 +305,15 @@ void FileSystemOperationImpl::CopyFileLocal(
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, callback),
+ weak_factory_.GetWeakPtr(),
+ src_url, dest_url, option, callback),
base::Bind(callback, base::PLATFORM_FILE_ERROR_FAILED));
}
@@ -404,10 +411,11 @@ void FileSystemOperationImpl::DoCreateDirectory(
void FileSystemOperationImpl::DoCopyFileLocal(
const FileSystemURL& src_url,
const FileSystemURL& dest_url,
+ CopyOrMoveOption option,
const CopyFileProgressCallback& progress_callback,
const StatusCallback& callback) {
async_file_util_->CopyFileLocal(
- operation_context_.Pass(), src_url, dest_url, progress_callback,
+ operation_context_.Pass(), src_url, dest_url, option, progress_callback,
base::Bind(&FileSystemOperationImpl::DidFinishOperation,
weak_factory_.GetWeakPtr(), callback));
}
@@ -415,9 +423,10 @@ void FileSystemOperationImpl::DoCopyFileLocal(
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,
+ operation_context_.Pass(), src_url, dest_url, option,
base::Bind(&FileSystemOperationImpl::DidFinishOperation,
weak_factory_.GetWeakPtr(), callback));
}
diff --git a/webkit/browser/fileapi/file_system_operation_impl.h b/webkit/browser/fileapi/file_system_operation_impl.h
index 8433479..a4fa3fe 100644
--- a/webkit/browser/fileapi/file_system_operation_impl.h
+++ b/webkit/browser/fileapi/file_system_operation_impl.h
@@ -40,10 +40,12 @@ class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemOperationImpl
const StatusCallback& callback) OVERRIDE;
virtual void Copy(const FileSystemURL& src_url,
const FileSystemURL& dest_url,
+ CopyOrMoveOption option,
const CopyProgressCallback& progress_callback,
const StatusCallback& callback) OVERRIDE;
virtual void Move(const FileSystemURL& src_url,
const FileSystemURL& dest_url,
+ CopyOrMoveOption option,
const StatusCallback& callback) OVERRIDE;
virtual void DirectoryExists(const FileSystemURL& url,
const StatusCallback& callback) OVERRIDE;
@@ -82,10 +84,12 @@ class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemOperationImpl
const StatusCallback& callback) OVERRIDE;
virtual void CopyFileLocal(const FileSystemURL& src_url,
const FileSystemURL& dest_url,
+ CopyOrMoveOption option,
const CopyFileProgressCallback& progress_callback,
const StatusCallback& callback) OVERRIDE;
virtual void MoveFileLocal(const FileSystemURL& src_url,
const FileSystemURL& dest_url,
+ CopyOrMoveOption option,
const StatusCallback& callback) OVERRIDE;
virtual base::PlatformFileError SyncGetPlatformPath(
const FileSystemURL& url,
@@ -131,10 +135,12 @@ class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemOperationImpl
bool recursive);
void DoCopyFileLocal(const FileSystemURL& src,
const FileSystemURL& dest,
+ CopyOrMoveOption option,
const CopyFileProgressCallback& progress_callback,
const StatusCallback& callback);
void DoMoveFileLocal(const FileSystemURL& src,
const FileSystemURL& dest,
+ CopyOrMoveOption option,
const StatusCallback& callback);
void DoCopyInForeignFile(const base::FilePath& src_local_disk_file_path,
const FileSystemURL& dest,
diff --git a/webkit/browser/fileapi/file_system_operation_impl_unittest.cc b/webkit/browser/fileapi/file_system_operation_impl_unittest.cc
index 7443aa0..39194a1 100644
--- a/webkit/browser/fileapi/file_system_operation_impl_unittest.cc
+++ b/webkit/browser/fileapi/file_system_operation_impl_unittest.cc
@@ -296,6 +296,7 @@ class FileSystemOperationImplTest
TEST_F(FileSystemOperationImplTest, TestMoveFailureSrcDoesntExist) {
change_observer()->ResetCount();
operation_runner()->Move(URLForPath("a"), URLForPath("b"),
+ FileSystemOperation::OPTION_NONE,
RecordStatusCallback());
base::RunLoop().RunUntilIdle();
EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, status());
@@ -306,7 +307,9 @@ TEST_F(FileSystemOperationImplTest, TestMoveFailureContainsPath) {
FileSystemURL src_dir(CreateDirectory("src"));
FileSystemURL dest_dir(CreateDirectory("src/dest"));
- operation_runner()->Move(src_dir, dest_dir, RecordStatusCallback());
+ operation_runner()->Move(src_dir, dest_dir,
+ FileSystemOperation::OPTION_NONE,
+ RecordStatusCallback());
base::RunLoop().RunUntilIdle();
EXPECT_EQ(base::PLATFORM_FILE_ERROR_INVALID_OPERATION, status());
EXPECT_TRUE(change_observer()->HasNoChange());
@@ -318,7 +321,9 @@ TEST_F(FileSystemOperationImplTest, TestMoveFailureSrcDirExistsDestFile) {
FileSystemURL dest_dir(CreateDirectory("dest"));
FileSystemURL dest_file(CreateFile("dest/file"));
- operation_runner()->Move(src_dir, dest_file, RecordStatusCallback());
+ operation_runner()->Move(src_dir, dest_file,
+ FileSystemOperation::OPTION_NONE,
+ RecordStatusCallback());
base::RunLoop().RunUntilIdle();
EXPECT_EQ(base::PLATFORM_FILE_ERROR_INVALID_OPERATION, status());
EXPECT_TRUE(change_observer()->HasNoChange());
@@ -331,7 +336,9 @@ TEST_F(FileSystemOperationImplTest,
FileSystemURL dest_dir(CreateDirectory("dest"));
FileSystemURL dest_file(CreateFile("dest/file"));
- operation_runner()->Move(src_dir, dest_dir, RecordStatusCallback());
+ operation_runner()->Move(src_dir, dest_dir,
+ FileSystemOperation::OPTION_NONE,
+ RecordStatusCallback());
base::RunLoop().RunUntilIdle();
EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_EMPTY, status());
EXPECT_TRUE(change_observer()->HasNoChange());
@@ -343,7 +350,9 @@ TEST_F(FileSystemOperationImplTest, TestMoveFailureSrcFileExistsDestDir) {
FileSystemURL src_file(CreateFile("src/file"));
FileSystemURL dest_dir(CreateDirectory("dest"));
- operation_runner()->Move(src_file, dest_dir, RecordStatusCallback());
+ operation_runner()->Move(src_file, dest_dir,
+ FileSystemOperation::OPTION_NONE,
+ RecordStatusCallback());
base::RunLoop().RunUntilIdle();
EXPECT_EQ(base::PLATFORM_FILE_ERROR_INVALID_OPERATION, status());
EXPECT_TRUE(change_observer()->HasNoChange());
@@ -353,6 +362,7 @@ TEST_F(FileSystemOperationImplTest, TestMoveFailureDestParentDoesntExist) {
// Dest. parent path does not exist.
FileSystemURL src_dir(CreateDirectory("src"));
operation_runner()->Move(src_dir, URLForPath("nonexistent/deset"),
+ FileSystemOperation::OPTION_NONE,
RecordStatusCallback());
base::RunLoop().RunUntilIdle();
EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, status());
@@ -363,7 +373,9 @@ TEST_F(FileSystemOperationImplTest, TestMoveSuccessSrcFileAndOverwrite) {
FileSystemURL src_file(CreateFile("src"));
FileSystemURL dest_file(CreateFile("dest"));
- operation_runner()->Move(src_file, dest_file, RecordStatusCallback());
+ operation_runner()->Move(src_file, dest_file,
+ FileSystemOperation::OPTION_NONE,
+ RecordStatusCallback());
base::RunLoop().RunUntilIdle();
EXPECT_EQ(base::PLATFORM_FILE_OK, status());
EXPECT_TRUE(FileExists("dest"));
@@ -378,7 +390,9 @@ TEST_F(FileSystemOperationImplTest, TestMoveSuccessSrcFileAndOverwrite) {
TEST_F(FileSystemOperationImplTest, TestMoveSuccessSrcFileAndNew) {
FileSystemURL src_file(CreateFile("src"));
- operation_runner()->Move(src_file, URLForPath("new"), RecordStatusCallback());
+ operation_runner()->Move(src_file, URLForPath("new"),
+ FileSystemOperation::OPTION_NONE,
+ RecordStatusCallback());
base::RunLoop().RunUntilIdle();
EXPECT_EQ(base::PLATFORM_FILE_OK, status());
EXPECT_TRUE(FileExists("new"));
@@ -392,7 +406,9 @@ TEST_F(FileSystemOperationImplTest, TestMoveSuccessSrcDirAndOverwrite) {
FileSystemURL src_dir(CreateDirectory("src"));
FileSystemURL dest_dir(CreateDirectory("dest"));
- operation_runner()->Move(src_dir, dest_dir, RecordStatusCallback());
+ operation_runner()->Move(src_dir, dest_dir,
+ FileSystemOperation::OPTION_NONE,
+ RecordStatusCallback());
base::RunLoop().RunUntilIdle();
EXPECT_EQ(base::PLATFORM_FILE_OK, status());
EXPECT_FALSE(DirectoryExists("src"));
@@ -411,6 +427,7 @@ TEST_F(FileSystemOperationImplTest, TestMoveSuccessSrcDirAndNew) {
FileSystemURL dest_dir(CreateDirectory("dest"));
operation_runner()->Move(src_dir, URLForPath("dest/new"),
+ FileSystemOperation::OPTION_NONE,
RecordStatusCallback());
base::RunLoop().RunUntilIdle();
EXPECT_EQ(base::PLATFORM_FILE_OK, status());
@@ -429,7 +446,9 @@ TEST_F(FileSystemOperationImplTest, TestMoveSuccessSrcDirRecursive) {
FileSystemURL dest_dir(CreateDirectory("dest"));
- operation_runner()->Move(src_dir, dest_dir, RecordStatusCallback());
+ operation_runner()->Move(src_dir, dest_dir,
+ FileSystemOperation::OPTION_NONE,
+ RecordStatusCallback());
base::RunLoop().RunUntilIdle();
EXPECT_EQ(base::PLATFORM_FILE_OK, status());
EXPECT_TRUE(DirectoryExists("dest/dir"));
@@ -444,6 +463,7 @@ TEST_F(FileSystemOperationImplTest, TestMoveSuccessSrcDirRecursive) {
TEST_F(FileSystemOperationImplTest, TestCopyFailureSrcDoesntExist) {
operation_runner()->Copy(URLForPath("a"), URLForPath("b"),
+ FileSystemOperation::OPTION_NONE,
FileSystemOperationRunner::CopyProgressCallback(),
RecordStatusCallback());
base::RunLoop().RunUntilIdle();
@@ -456,6 +476,7 @@ TEST_F(FileSystemOperationImplTest, TestCopyFailureContainsPath) {
FileSystemURL dest_dir(CreateDirectory("src/dir"));
operation_runner()->Copy(src_dir, dest_dir,
+ FileSystemOperation::OPTION_NONE,
FileSystemOperationRunner::CopyProgressCallback(),
RecordStatusCallback());
base::RunLoop().RunUntilIdle();
@@ -470,6 +491,7 @@ TEST_F(FileSystemOperationImplTest, TestCopyFailureSrcDirExistsDestFile) {
FileSystemURL dest_file(CreateFile("dest/file"));
operation_runner()->Copy(src_dir, dest_file,
+ FileSystemOperation::OPTION_NONE,
FileSystemOperationRunner::CopyProgressCallback(),
RecordStatusCallback());
base::RunLoop().RunUntilIdle();
@@ -485,6 +507,7 @@ TEST_F(FileSystemOperationImplTest,
FileSystemURL dest_file(CreateFile("dest/file"));
operation_runner()->Copy(src_dir, dest_dir,
+ FileSystemOperation::OPTION_NONE,
FileSystemOperationRunner::CopyProgressCallback(),
RecordStatusCallback());
base::RunLoop().RunUntilIdle();
@@ -498,6 +521,7 @@ TEST_F(FileSystemOperationImplTest, TestCopyFailureSrcFileExistsDestDir) {
FileSystemURL dest_dir(CreateDirectory("dest"));
operation_runner()->Copy(src_file, dest_dir,
+ FileSystemOperation::OPTION_NONE,
FileSystemOperationRunner::CopyProgressCallback(),
RecordStatusCallback());
base::RunLoop().RunUntilIdle();
@@ -510,6 +534,7 @@ TEST_F(FileSystemOperationImplTest, TestCopyFailureDestParentDoesntExist) {
FileSystemURL src_dir(CreateDirectory("src"));
operation_runner()->Copy(src_dir, URLForPath("nonexistent/dest"),
+ FileSystemOperation::OPTION_NONE,
FileSystemOperationRunner::CopyProgressCallback(),
RecordStatusCallback());
base::RunLoop().RunUntilIdle();
@@ -532,6 +557,7 @@ TEST_F(FileSystemOperationImplTest, TestCopyFailureByQuota) {
AddQuota(6 + dest_path_cost - 1);
operation_runner()->Copy(src_file, dest_file,
+ FileSystemOperation::OPTION_NONE,
FileSystemOperationRunner::CopyProgressCallback(),
RecordStatusCallback());
base::RunLoop().RunUntilIdle();
@@ -544,6 +570,7 @@ TEST_F(FileSystemOperationImplTest, TestCopySuccessSrcFileAndOverwrite) {
FileSystemURL dest_file(CreateFile("dest"));
operation_runner()->Copy(src_file, dest_file,
+ FileSystemOperation::OPTION_NONE,
FileSystemOperationRunner::CopyProgressCallback(),
RecordStatusCallback());
base::RunLoop().RunUntilIdle();
@@ -559,6 +586,7 @@ TEST_F(FileSystemOperationImplTest, TestCopySuccessSrcFileAndNew) {
FileSystemURL src_file(CreateFile("src"));
operation_runner()->Copy(src_file, URLForPath("new"),
+ FileSystemOperation::OPTION_NONE,
FileSystemOperationRunner::CopyProgressCallback(),
RecordStatusCallback());
base::RunLoop().RunUntilIdle();
@@ -575,6 +603,7 @@ TEST_F(FileSystemOperationImplTest, TestCopySuccessSrcDirAndOverwrite) {
FileSystemURL dest_dir(CreateDirectory("dest"));
operation_runner()->Copy(src_dir, dest_dir,
+ FileSystemOperation::OPTION_NONE,
FileSystemOperationRunner::CopyProgressCallback(),
RecordStatusCallback());
base::RunLoop().RunUntilIdle();
@@ -595,6 +624,7 @@ TEST_F(FileSystemOperationImplTest, TestCopySuccessSrcDirAndNew) {
FileSystemURL dest_dir_new(URLForPath("dest"));
operation_runner()->Copy(src_dir, dest_dir_new,
+ FileSystemOperation::OPTION_NONE,
FileSystemOperationRunner::CopyProgressCallback(),
RecordStatusCallback());
base::RunLoop().RunUntilIdle();
@@ -614,6 +644,7 @@ TEST_F(FileSystemOperationImplTest, TestCopySuccessSrcDirRecursive) {
FileSystemURL dest_dir(CreateDirectory("dest"));
operation_runner()->Copy(src_dir, dest_dir,
+ FileSystemOperation::OPTION_NONE,
FileSystemOperationRunner::CopyProgressCallback(),
RecordStatusCallback());
base::RunLoop().RunUntilIdle();
@@ -1120,7 +1151,7 @@ TEST_F(FileSystemOperationImplTest,
EXPECT_EQ(all_file_size + total_path_cost, GetUsage());
operation_runner()->Move(
- src, dest,
+ src, dest, FileSystemOperation::OPTION_NONE,
base::Bind(&AssertFileErrorEq, FROM_HERE, base::PLATFORM_FILE_OK));
base::RunLoop().RunUntilIdle();
@@ -1179,7 +1210,7 @@ TEST_F(FileSystemOperationImplTest,
// Copy src to dest1.
operation_runner()->Copy(
- src, dest1,
+ src, dest1, FileSystemOperation::OPTION_NONE,
FileSystemOperationRunner::CopyProgressCallback(),
base::Bind(&AssertFileErrorEq, FROM_HERE, base::PLATFORM_FILE_OK));
base::RunLoop().RunUntilIdle();
@@ -1195,7 +1226,7 @@ TEST_F(FileSystemOperationImplTest,
// Copy src/dir to dest2.
operation_runner()->Copy(
- child_dir, dest2,
+ child_dir, dest2, FileSystemOperation::OPTION_NONE,
FileSystemOperationRunner::CopyProgressCallback(),
base::Bind(&AssertFileErrorEq, FROM_HERE, base::PLATFORM_FILE_OK));
base::RunLoop().RunUntilIdle();
diff --git a/webkit/browser/fileapi/file_system_operation_runner.cc b/webkit/browser/fileapi/file_system_operation_runner.cc
index 5a31ecc..5e45be5 100644
--- a/webkit/browser/fileapi/file_system_operation_runner.cc
+++ b/webkit/browser/fileapi/file_system_operation_runner.cc
@@ -86,6 +86,7 @@ OperationID FileSystemOperationRunner::CreateDirectory(
OperationID FileSystemOperationRunner::Copy(
const FileSystemURL& src_url,
const FileSystemURL& dest_url,
+ CopyOrMoveOption option,
const CopyProgressCallback& progress_callback,
const StatusCallback& callback) {
base::PlatformFileError error = base::PLATFORM_FILE_OK;
@@ -100,7 +101,7 @@ OperationID FileSystemOperationRunner::Copy(
PrepareForWrite(handle.id, dest_url);
PrepareForRead(handle.id, src_url);
operation->Copy(
- src_url, dest_url,
+ src_url, dest_url, option,
progress_callback.is_null() ?
CopyProgressCallback() :
base::Bind(&FileSystemOperationRunner::OnCopyProgress, AsWeakPtr(),
@@ -113,6 +114,7 @@ OperationID FileSystemOperationRunner::Copy(
OperationID FileSystemOperationRunner::Move(
const FileSystemURL& src_url,
const FileSystemURL& dest_url,
+ CopyOrMoveOption option,
const StatusCallback& callback) {
base::PlatformFileError error = base::PLATFORM_FILE_OK;
FileSystemOperation* operation =
@@ -126,7 +128,7 @@ OperationID FileSystemOperationRunner::Move(
PrepareForWrite(handle.id, dest_url);
PrepareForWrite(handle.id, src_url);
operation->Move(
- src_url, dest_url,
+ src_url, dest_url, option,
base::Bind(&FileSystemOperationRunner::DidFinish, AsWeakPtr(),
handle, callback));
return handle.id;
@@ -448,6 +450,7 @@ OperationID FileSystemOperationRunner::RemoveDirectory(
OperationID FileSystemOperationRunner::CopyFileLocal(
const FileSystemURL& src_url,
const FileSystemURL& dest_url,
+ CopyOrMoveOption option,
const CopyFileProgressCallback& progress_callback,
const StatusCallback& callback) {
base::PlatformFileError error = base::PLATFORM_FILE_OK;
@@ -460,7 +463,7 @@ OperationID FileSystemOperationRunner::CopyFileLocal(
return handle.id;
}
operation->CopyFileLocal(
- src_url, dest_url, progress_callback,
+ src_url, dest_url, option, progress_callback,
base::Bind(&FileSystemOperationRunner::DidFinish, AsWeakPtr(),
handle, callback));
return handle.id;
@@ -469,6 +472,7 @@ OperationID FileSystemOperationRunner::CopyFileLocal(
OperationID FileSystemOperationRunner::MoveFileLocal(
const FileSystemURL& src_url,
const FileSystemURL& dest_url,
+ CopyOrMoveOption option,
const StatusCallback& callback) {
base::PlatformFileError error = base::PLATFORM_FILE_OK;
FileSystemOperation* operation =
@@ -480,7 +484,7 @@ OperationID FileSystemOperationRunner::MoveFileLocal(
return handle.id;
}
operation->MoveFileLocal(
- src_url, dest_url,
+ src_url, dest_url, option,
base::Bind(&FileSystemOperationRunner::DidFinish, AsWeakPtr(),
handle, callback));
return handle.id;
diff --git a/webkit/browser/fileapi/file_system_operation_runner.h b/webkit/browser/fileapi/file_system_operation_runner.h
index ea93f38..9ca4725 100644
--- a/webkit/browser/fileapi/file_system_operation_runner.h
+++ b/webkit/browser/fileapi/file_system_operation_runner.h
@@ -44,6 +44,7 @@ class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemOperationRunner
typedef FileSystemOperation::CopyProgressCallback CopyProgressCallback;
typedef FileSystemOperation::CopyFileProgressCallback
CopyFileProgressCallback;
+ typedef FileSystemOperation::CopyOrMoveOption CopyOrMoveOption;
typedef int OperationID;
@@ -67,16 +68,20 @@ class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemOperationRunner
// |src_url| is a directory, the contents of |src_url| are copied to
// |dest_url| recursively. A new file or directory is created at
// |dest_url| as needed.
- // For |progress_callback|, see file_system_operation.h for details.
+ // For |option| and |progress_callback|, see file_system_operation.h for
+ // details.
OperationID Copy(const FileSystemURL& src_url,
const FileSystemURL& dest_url,
+ CopyOrMoveOption option,
const CopyProgressCallback& progress_callback,
const StatusCallback& callback);
// Moves a file or directory from |src_url| to |dest_url|. A new file
// or directory is created at |dest_url| as needed.
+ // For |option|, see file_system_operation.h for details.
OperationID Move(const FileSystemURL& src_url,
const FileSystemURL& dest_url,
+ CopyOrMoveOption option,
const StatusCallback& callback);
// Checks if a directory is present at |url|.
@@ -188,7 +193,8 @@ class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemOperationRunner
// Copies a file from |src_url| to |dest_url|.
// This must be called for files that belong to the same filesystem
// (i.e. type() and origin() of the |src_url| and |dest_url| must match).
- // For |progress_callback|, see file_system_operation.h for details.
+ // For |option| and |progress_callback|, see file_system_operation.h for
+ // details.
//
// This returns:
// - PLATFORM_FILE_ERROR_NOT_FOUND if |src_url|
@@ -201,12 +207,14 @@ class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemOperationRunner
//
OperationID CopyFileLocal(const FileSystemURL& src_url,
const FileSystemURL& dest_url,
+ CopyOrMoveOption option,
const CopyFileProgressCallback& progress_callback,
const StatusCallback& callback);
// Moves a local file from |src_url| to |dest_url|.
// This must be called for files that belong to the same filesystem
// (i.e. type() and origin() of the |src_url| and |dest_url| must match).
+ // For |option|, see file_system_operation.h for details.
//
// This returns:
// - PLATFORM_FILE_ERROR_NOT_FOUND if |src_url|
@@ -219,6 +227,7 @@ class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemOperationRunner
//
OperationID MoveFileLocal(const FileSystemURL& src_url,
const FileSystemURL& dest_url,
+ CopyOrMoveOption option,
const StatusCallback& callback);
// This is called only by pepper plugin as of writing to synchronously get
diff --git a/webkit/browser/fileapi/local_file_util.cc b/webkit/browser/fileapi/local_file_util.cc
index d2d653a..6958f47 100644
--- a/webkit/browser/fileapi/local_file_util.cc
+++ b/webkit/browser/fileapi/local_file_util.cc
@@ -197,6 +197,7 @@ PlatformFileError LocalFileUtil::CopyOrMoveFile(
FileSystemOperationContext* context,
const FileSystemURL& src_url,
const FileSystemURL& dest_url,
+ CopyOrMoveOption option,
bool copy) {
base::FilePath src_file_path;
PlatformFileError error = GetLocalFilePath(context, src_url, &src_file_path);
@@ -208,6 +209,7 @@ PlatformFileError LocalFileUtil::CopyOrMoveFile(
if (error != base::PLATFORM_FILE_OK)
return error;
+ // TODO(hidehiko): Support option.
return NativeFileUtil::CopyOrMoveFile(src_file_path, dest_file_path, copy);
}
diff --git a/webkit/browser/fileapi/local_file_util.h b/webkit/browser/fileapi/local_file_util.h
index 38f285a6..21efc72 100644
--- a/webkit/browser/fileapi/local_file_util.h
+++ b/webkit/browser/fileapi/local_file_util.h
@@ -72,6 +72,7 @@ class WEBKIT_STORAGE_BROWSER_EXPORT LocalFileUtil
FileSystemOperationContext* context,
const FileSystemURL& src_url,
const FileSystemURL& dest_url,
+ CopyOrMoveOption option,
bool copy) OVERRIDE;
virtual base::PlatformFileError CopyInForeignFile(
FileSystemOperationContext* context,
diff --git a/webkit/browser/fileapi/obfuscated_file_util.cc b/webkit/browser/fileapi/obfuscated_file_util.cc
index 341f7d0..221f90d 100644
--- a/webkit/browser/fileapi/obfuscated_file_util.cc
+++ b/webkit/browser/fileapi/obfuscated_file_util.cc
@@ -508,6 +508,7 @@ PlatformFileError ObfuscatedFileUtil::CopyOrMoveFile(
FileSystemOperationContext* context,
const FileSystemURL& src_url,
const FileSystemURL& dest_url,
+ CopyOrMoveOption option,
bool copy) {
// Cross-filesystem copies and moves should be handled via CopyInForeignFile.
DCHECK(src_url.origin() == dest_url.origin());
diff --git a/webkit/browser/fileapi/obfuscated_file_util.h b/webkit/browser/fileapi/obfuscated_file_util.h
index 0d9750d..47b3407 100644
--- a/webkit/browser/fileapi/obfuscated_file_util.h
+++ b/webkit/browser/fileapi/obfuscated_file_util.h
@@ -110,6 +110,7 @@ class WEBKIT_STORAGE_BROWSER_EXPORT_PRIVATE ObfuscatedFileUtil
FileSystemOperationContext* context,
const FileSystemURL& src_url,
const FileSystemURL& dest_url,
+ CopyOrMoveOption option,
bool copy) OVERRIDE;
virtual base::PlatformFileError CopyInForeignFile(
FileSystemOperationContext* context,
diff --git a/webkit/browser/fileapi/obfuscated_file_util_unittest.cc b/webkit/browser/fileapi/obfuscated_file_util_unittest.cc
index c37b17c..80b640d 100644
--- a/webkit/browser/fileapi/obfuscated_file_util_unittest.cc
+++ b/webkit/browser/fileapi/obfuscated_file_util_unittest.cc
@@ -638,6 +638,7 @@ class ObfuscatedFileUtilTest : public testing::Test {
EXPECT_EQ(base::PLATFORM_FILE_OK,
ofu()->CopyOrMoveFile(context.get(),
src_file_url, dest_file_url,
+ FileSystemOperation::OPTION_NONE,
copy));
if (copy)
EXPECT_EQ(base::Time(), GetModifiedTime(src_dir_url));
@@ -1186,13 +1187,15 @@ TEST_F(ObfuscatedFileUtilTest, TestCopyOrMoveFileNotFound) {
bool is_copy_not_move = false;
EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND,
ofu()->CopyOrMoveFile(context.get(), source_url, dest_url,
- is_copy_not_move));
+ FileSystemOperation::OPTION_NONE,
+ is_copy_not_move));
EXPECT_TRUE(change_observer()->HasNoChange());
context.reset(NewContext(NULL));
is_copy_not_move = true;
EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND,
ofu()->CopyOrMoveFile(context.get(), source_url, dest_url,
- is_copy_not_move));
+ FileSystemOperation::OPTION_NONE,
+ is_copy_not_move));
EXPECT_TRUE(change_observer()->HasNoChange());
source_url = CreateURLFromUTF8("dir/dir/file");
bool exclusive = true;
@@ -1206,13 +1209,15 @@ TEST_F(ObfuscatedFileUtilTest, TestCopyOrMoveFileNotFound) {
is_copy_not_move = false;
EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND,
ofu()->CopyOrMoveFile(context.get(), source_url, dest_url,
- is_copy_not_move));
+ FileSystemOperation::OPTION_NONE,
+ is_copy_not_move));
EXPECT_TRUE(change_observer()->HasNoChange());
context.reset(NewContext(NULL));
is_copy_not_move = true;
EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND,
ofu()->CopyOrMoveFile(context.get(), source_url, dest_url,
- is_copy_not_move));
+ FileSystemOperation::OPTION_NONE,
+ is_copy_not_move));
EXPECT_TRUE(change_observer()->HasNoChange());
}
@@ -1270,8 +1275,9 @@ TEST_F(ObfuscatedFileUtilTest, TestCopyOrMoveFileSuccess) {
}
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->CopyOrMoveFile(context.get(),
- source_url, dest_url, test_case.is_copy_not_move));
+ EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->CopyOrMoveFile(
+ context.get(), source_url, dest_url, FileSystemOperation::OPTION_NONE,
+ test_case.is_copy_not_move));
if (test_case.is_copy_not_move) {
base::PlatformFileInfo file_info;
@@ -1313,18 +1319,24 @@ TEST_F(ObfuscatedFileUtilTest, TestCopyPathQuotas) {
context->set_allowed_bytes_growth(
ObfuscatedFileUtil::ComputeFilePathCost(dest_url.path()) - 1);
EXPECT_EQ(base::PLATFORM_FILE_ERROR_NO_SPACE,
- ofu()->CopyOrMoveFile(context.get(), src_url, dest_url, is_copy));
+ ofu()->CopyOrMoveFile(
+ context.get(),
+ src_url, dest_url, FileSystemOperation::OPTION_NONE, is_copy));
context.reset(NewContext(NULL));
context->set_allowed_bytes_growth(
ObfuscatedFileUtil::ComputeFilePathCost(dest_url.path()));
EXPECT_EQ(base::PLATFORM_FILE_OK,
- ofu()->CopyOrMoveFile(context.get(), src_url, dest_url, is_copy));
+ ofu()->CopyOrMoveFile(
+ context.get(),
+ src_url, dest_url, FileSystemOperation::OPTION_NONE, is_copy));
// Copy, with overwrite.
context.reset(NewContext(NULL));
context->set_allowed_bytes_growth(0);
EXPECT_EQ(base::PLATFORM_FILE_OK,
- ofu()->CopyOrMoveFile(context.get(), src_url, dest_url, is_copy));
+ ofu()->CopyOrMoveFile(
+ context.get(),
+ src_url, dest_url, FileSystemOperation::OPTION_NONE, is_copy));
}
TEST_F(ObfuscatedFileUtilTest, TestMovePathQuotasWithRename) {
@@ -1342,13 +1354,17 @@ TEST_F(ObfuscatedFileUtilTest, TestMovePathQuotasWithRename) {
ObfuscatedFileUtil::ComputeFilePathCost(dest_url.path()) -
ObfuscatedFileUtil::ComputeFilePathCost(src_url.path()) - 1);
EXPECT_EQ(base::PLATFORM_FILE_ERROR_NO_SPACE,
- ofu()->CopyOrMoveFile(context.get(), src_url, dest_url, is_copy));
+ ofu()->CopyOrMoveFile(
+ context.get(),
+ src_url, dest_url, FileSystemOperation::OPTION_NONE, is_copy));
context.reset(NewContext(NULL));
context->set_allowed_bytes_growth(
ObfuscatedFileUtil::ComputeFilePathCost(dest_url.path()) -
ObfuscatedFileUtil::ComputeFilePathCost(src_url.path()));
EXPECT_EQ(base::PLATFORM_FILE_OK,
- ofu()->CopyOrMoveFile(context.get(), src_url, dest_url, is_copy));
+ ofu()->CopyOrMoveFile(
+ context.get(),
+ src_url, dest_url, FileSystemOperation::OPTION_NONE, is_copy));
context.reset(NewContext(NULL));
ASSERT_EQ(base::PLATFORM_FILE_OK, ofu()->EnsureFileExists(
@@ -1358,7 +1374,9 @@ TEST_F(ObfuscatedFileUtilTest, TestMovePathQuotasWithRename) {
context.reset(NewContext(NULL));
context->set_allowed_bytes_growth(0);
EXPECT_EQ(base::PLATFORM_FILE_OK,
- ofu()->CopyOrMoveFile(context.get(), src_url, dest_url, is_copy));
+ ofu()->CopyOrMoveFile(
+ context.get(),
+ src_url, dest_url, FileSystemOperation::OPTION_NONE, is_copy));
}
TEST_F(ObfuscatedFileUtilTest, TestMovePathQuotasWithoutRename) {
@@ -1384,7 +1402,9 @@ TEST_F(ObfuscatedFileUtilTest, TestMovePathQuotasWithoutRename) {
context.reset(NewContext(NULL));
context->set_allowed_bytes_growth(allowed_bytes_growth);
EXPECT_EQ(base::PLATFORM_FILE_OK,
- ofu()->CopyOrMoveFile(context.get(), src_url, dest_url, is_copy));
+ ofu()->CopyOrMoveFile(
+ context.get(),
+ src_url, dest_url, FileSystemOperation::OPTION_NONE, is_copy));
EXPECT_EQ(allowed_bytes_growth, context->allowed_bytes_growth());
// Move, no rename, with overwrite.
@@ -1394,7 +1414,9 @@ TEST_F(ObfuscatedFileUtilTest, TestMovePathQuotasWithoutRename) {
context.reset(NewContext(NULL));
context->set_allowed_bytes_growth(allowed_bytes_growth);
EXPECT_EQ(base::PLATFORM_FILE_OK,
- ofu()->CopyOrMoveFile(context.get(), src_url, dest_url, is_copy));
+ ofu()->CopyOrMoveFile(
+ context.get(),
+ src_url, dest_url, FileSystemOperation::OPTION_NONE, is_copy));
EXPECT_EQ(
allowed_bytes_growth +
ObfuscatedFileUtil::ComputeFilePathCost(src_url.path()),
@@ -1630,6 +1652,7 @@ TEST_F(ObfuscatedFileUtilTest, TestInconsistency) {
context.reset(NewContext(NULL));
EXPECT_EQ(base::PLATFORM_FILE_OK,
ofu()->CopyOrMoveFile(context.get(), kPath1, kPath2,
+ FileSystemOperation::OPTION_NONE,
true /* copy */));
ofu()->DestroyDirectoryDatabase(origin(), type());
@@ -1993,14 +2016,17 @@ TEST_F(ObfuscatedFileUtilTest, MAYBE_TestQuotaOnCopyFile) {
ofu()->CopyOrMoveFile(
AllowUsageIncrease(
PathCost(to_file1) + to_file1_size)->context(),
- from_file, to_file1, true /* copy */));
+ from_file, to_file1,
+ FileSystemOperation::OPTION_NONE,
+ true /* copy */));
ASSERT_EQ(expected_total_file_size, ComputeTotalFileSize());
ASSERT_EQ(base::PLATFORM_FILE_ERROR_NO_SPACE,
ofu()->CopyOrMoveFile(
DisallowUsageIncrease(
PathCost(to_file2) + from_file_size)->context(),
- from_file, to_file2, true /* copy */));
+ from_file, to_file2, FileSystemOperation::OPTION_NONE,
+ true /* copy */));
ASSERT_EQ(expected_total_file_size, ComputeTotalFileSize());
int64 old_obstacle_file_size = obstacle_file_size;
@@ -2010,7 +2036,9 @@ TEST_F(ObfuscatedFileUtilTest, MAYBE_TestQuotaOnCopyFile) {
ofu()->CopyOrMoveFile(
AllowUsageIncrease(
obstacle_file_size - old_obstacle_file_size)->context(),
- from_file, obstacle_file, true /* copy */));
+ from_file, obstacle_file,
+ FileSystemOperation::OPTION_NONE,
+ true /* copy */));
ASSERT_EQ(expected_total_file_size, ComputeTotalFileSize());
int64 old_from_file_size = from_file_size;
@@ -2035,7 +2063,9 @@ TEST_F(ObfuscatedFileUtilTest, MAYBE_TestQuotaOnCopyFile) {
ASSERT_EQ(base::PLATFORM_FILE_OK,
ofu()->CopyOrMoveFile(
helper->context(),
- from_file, obstacle_file, true /* copy */));
+ from_file, obstacle_file,
+ FileSystemOperation::OPTION_NONE,
+ true /* copy */));
ASSERT_EQ(expected_total_file_size, ComputeTotalFileSize());
}
}
@@ -2068,7 +2098,9 @@ TEST_F(ObfuscatedFileUtilTest, TestQuotaOnMoveFile) {
ofu()->CopyOrMoveFile(
AllowUsageIncrease(-PathCost(from_file) +
PathCost(to_file))->context(),
- from_file, to_file, false /* move */));
+ from_file, to_file,
+ FileSystemOperation::OPTION_NONE,
+ false /* move */));
ASSERT_EQ(expected_total_file_size, ComputeTotalFileSize());
ASSERT_EQ(base::PLATFORM_FILE_OK,
@@ -2110,6 +2142,7 @@ TEST_F(ObfuscatedFileUtilTest, TestQuotaOnMoveFile) {
AllowUsageIncrease(
-old_obstacle_file_size - PathCost(from_file))->context(),
from_file, obstacle_file,
+ FileSystemOperation::OPTION_NONE,
false /* move */));
ASSERT_EQ(expected_total_file_size, ComputeTotalFileSize());
@@ -2137,7 +2170,9 @@ TEST_F(ObfuscatedFileUtilTest, TestQuotaOnMoveFile) {
LimitedContext(-old_obstacle_file_size - PathCost(from_file) - 1);
ASSERT_EQ(base::PLATFORM_FILE_OK,
ofu()->CopyOrMoveFile(
- context.get(), from_file, obstacle_file, false /* move */));
+ context.get(), from_file, obstacle_file,
+ FileSystemOperation::OPTION_NONE,
+ false /* move */));
ASSERT_EQ(expected_total_file_size, ComputeTotalFileSize());
context.reset();
}