Convert Media Galleries to use base::File
Unfortunately, this brings in changes to webkit/browser/fileapi, and once
that changes, a lot of files have to be updated.
The bright side is that most of the collateral changes are just trivial
renaming of PlatformFileError -> File::Error and PlatformFileInfo ->
File::Info
BUG=322664
Review URL: https://codereview.chromium.org/145303002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@247301 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/base/files/file_util_proxy.cc b/base/files/file_util_proxy.cc
index 8307234..141e4e1 100644
--- a/base/files/file_util_proxy.cc
+++ b/base/files/file_util_proxy.cc
@@ -20,7 +20,7 @@
void CallWithTranslatedParameter(const FileUtilProxy::StatusCallback& callback,
bool value) {
DCHECK(!callback.is_null());
- callback.Run(value ? PLATFORM_FILE_OK : PLATFORM_FILE_ERROR_FAILED);
+ callback.Run(value ? File::FILE_OK : File::FILE_ERROR_FAILED);
}
// Helper classes or routines for individual methods.
@@ -32,7 +32,7 @@
close_task_(close_task),
file_handle_(kInvalidPlatformFileValue),
created_(false),
- error_(PLATFORM_FILE_OK) {}
+ error_(File::FILE_OK) {}
~CreateOrOpenHelper() {
if (file_handle_ != kInvalidPlatformFileValue) {
@@ -56,7 +56,7 @@
FileUtilProxy::CloseTask close_task_;
PlatformFile file_handle_;
bool created_;
- PlatformFileError error_;
+ File::Error error_;
DISALLOW_COPY_AND_ASSIGN(CreateOrOpenHelper);
};
@@ -65,7 +65,7 @@
explicit CreateTemporaryHelper(TaskRunner* task_runner)
: task_runner_(task_runner),
file_handle_(kInvalidPlatformFileValue),
- error_(PLATFORM_FILE_OK) {}
+ error_(File::FILE_OK) {}
~CreateTemporaryHelper() {
if (file_handle_ != kInvalidPlatformFileValue) {
@@ -85,8 +85,11 @@
PLATFORM_FILE_CREATE_ALWAYS |
additional_file_flags;
- error_ = PLATFORM_FILE_OK;
- file_handle_ = CreatePlatformFile(file_path_, file_flags, NULL, &error_);
+ error_ = File::FILE_OK;
+ // TODO(rvargas): Convert this code to use File.
+ file_handle_ =
+ CreatePlatformFile(file_path_, file_flags, NULL,
+ reinterpret_cast<PlatformFileError*>(&error_));
}
void Reply(const FileUtilProxy::CreateTemporaryCallback& callback) {
@@ -98,28 +101,30 @@
scoped_refptr<TaskRunner> task_runner_;
PlatformFile file_handle_;
FilePath file_path_;
- PlatformFileError error_;
+ File::Error error_;
DISALLOW_COPY_AND_ASSIGN(CreateTemporaryHelper);
};
class GetFileInfoHelper {
public:
GetFileInfoHelper()
- : error_(PLATFORM_FILE_OK) {}
+ : error_(File::FILE_OK) {}
void RunWorkForFilePath(const FilePath& file_path) {
if (!PathExists(file_path)) {
- error_ = PLATFORM_FILE_ERROR_NOT_FOUND;
+ error_ = File::FILE_ERROR_NOT_FOUND;
return;
}
// TODO(rvargas): switch this file to base::File.
if (!GetFileInfo(file_path, reinterpret_cast<File::Info*>(&file_info_)))
- error_ = PLATFORM_FILE_ERROR_FAILED;
+ error_ = File::FILE_ERROR_FAILED;
}
void RunWorkForPlatformFile(PlatformFile file) {
- if (!GetPlatformFileInfo(file, &file_info_))
- error_ = PLATFORM_FILE_ERROR_FAILED;
+ if (!GetPlatformFileInfo(
+ file, reinterpret_cast<PlatformFileInfo*>(&file_info_))) {
+ error_ = File::FILE_ERROR_FAILED;
+ }
}
void Reply(const FileUtilProxy::GetFileInfoCallback& callback) {
@@ -129,8 +134,8 @@
}
private:
- PlatformFileError error_;
- PlatformFileInfo file_info_;
+ File::Error error_;
+ File::Info file_info_;
DISALLOW_COPY_AND_ASSIGN(GetFileInfoHelper);
};
@@ -147,8 +152,8 @@
void Reply(const FileUtilProxy::ReadCallback& callback) {
if (!callback.is_null()) {
- PlatformFileError error =
- (bytes_read_ < 0) ? PLATFORM_FILE_ERROR_FAILED : PLATFORM_FILE_OK;
+ File::Error error =
+ (bytes_read_ < 0) ? File::FILE_ERROR_FAILED : File::FILE_OK;
callback.Run(error, buffer_.get(), bytes_read_);
}
}
@@ -176,8 +181,8 @@
void Reply(const FileUtilProxy::WriteCallback& callback) {
if (!callback.is_null()) {
- PlatformFileError error =
- (bytes_written_ < 0) ? PLATFORM_FILE_ERROR_FAILED : PLATFORM_FILE_OK;
+ File::Error error =
+ (bytes_written_ < 0) ? File::FILE_ERROR_FAILED : File::FILE_OK;
callback.Run(error, bytes_written_);
}
}
@@ -189,38 +194,40 @@
DISALLOW_COPY_AND_ASSIGN(WriteHelper);
};
-PlatformFileError CreateOrOpenAdapter(
+File::Error CreateOrOpenAdapter(
const FilePath& file_path, int file_flags,
PlatformFile* file_handle, bool* created) {
DCHECK(file_handle);
DCHECK(created);
if (!DirectoryExists(file_path.DirName())) {
// If its parent does not exist, should return NOT_FOUND error.
- return PLATFORM_FILE_ERROR_NOT_FOUND;
+ return File::FILE_ERROR_NOT_FOUND;
}
- PlatformFileError error = PLATFORM_FILE_OK;
- *file_handle = CreatePlatformFile(file_path, file_flags, created, &error);
+ File::Error error = File::FILE_OK;
+ *file_handle =
+ CreatePlatformFile(file_path, file_flags, created,
+ reinterpret_cast<PlatformFileError*>(&error));
return error;
}
-PlatformFileError CloseAdapter(PlatformFile file_handle) {
+File::Error CloseAdapter(PlatformFile file_handle) {
if (!ClosePlatformFile(file_handle)) {
- return PLATFORM_FILE_ERROR_FAILED;
+ return File::FILE_ERROR_FAILED;
}
- return PLATFORM_FILE_OK;
+ return File::FILE_OK;
}
-PlatformFileError DeleteAdapter(const FilePath& file_path, bool recursive) {
+File::Error DeleteAdapter(const FilePath& file_path, bool recursive) {
if (!PathExists(file_path)) {
- return PLATFORM_FILE_ERROR_NOT_FOUND;
+ return File::FILE_ERROR_NOT_FOUND;
}
if (!base::DeleteFile(file_path, recursive)) {
if (!recursive && !base::IsDirectoryEmpty(file_path)) {
- return PLATFORM_FILE_ERROR_NOT_EMPTY;
+ return File::FILE_ERROR_NOT_EMPTY;
}
- return PLATFORM_FILE_ERROR_FAILED;
+ return File::FILE_ERROR_FAILED;
}
- return PLATFORM_FILE_OK;
+ return File::FILE_OK;
}
} // namespace
diff --git a/base/files/file_util_proxy.h b/base/files/file_util_proxy.h
index bded161..846e8fb 100644
--- a/base/files/file_util_proxy.h
+++ b/base/files/file_util_proxy.h
@@ -7,6 +7,7 @@
#include "base/base_export.h"
#include "base/callback_forward.h"
+#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/memory/ref_counted.h"
#include "base/platform_file.h"
@@ -26,25 +27,25 @@
// This callback is used by methods that report only an error code. It is
// valid to pass a null callback to any function that takes a StatusCallback,
// in which case the operation will complete silently.
- typedef Callback<void(PlatformFileError)> StatusCallback;
+ typedef Callback<void(File::Error)> StatusCallback;
- typedef Callback<void(PlatformFileError,
+ typedef Callback<void(File::Error,
PassPlatformFile,
bool /* created */)> CreateOrOpenCallback;
- typedef Callback<void(PlatformFileError,
+ typedef Callback<void(File::Error,
PassPlatformFile,
const FilePath&)> CreateTemporaryCallback;
- typedef Callback<void(PlatformFileError,
- const PlatformFileInfo&)> GetFileInfoCallback;
- typedef Callback<void(PlatformFileError,
+ typedef Callback<void(File::Error,
+ const File::Info&)> GetFileInfoCallback;
+ typedef Callback<void(File::Error,
const char* /* data */,
int /* bytes read */)> ReadCallback;
- typedef Callback<void(PlatformFileError,
+ typedef Callback<void(File::Error,
int /* bytes written */)> WriteCallback;
- typedef Callback<PlatformFileError(PlatformFile*, bool*)> CreateOrOpenTask;
- typedef Callback<PlatformFileError(PlatformFile)> CloseTask;
- typedef Callback<PlatformFileError(void)> FileTask;
+ typedef Callback<File::Error(PlatformFile*, bool*)> CreateOrOpenTask;
+ typedef Callback<File::Error(PlatformFile)> CloseTask;
+ typedef Callback<File::Error(void)> FileTask;
// Creates or opens a file with the given flags. It is invalid to pass a null
// callback. If PLATFORM_FILE_CREATE is set in |file_flags| it always tries to
diff --git a/base/files/file_util_proxy_unittest.cc b/base/files/file_util_proxy_unittest.cc
index d01d56d..30c77d3 100644
--- a/base/files/file_util_proxy_unittest.cc
+++ b/base/files/file_util_proxy_unittest.cc
@@ -22,7 +22,7 @@
public:
FileUtilProxyTest()
: file_thread_("FileUtilProxyTestFileThread"),
- error_(PLATFORM_FILE_OK),
+ error_(File::FILE_OK),
created_(false),
file_(kInvalidPlatformFileValue),
bytes_written_(-1),
@@ -38,12 +38,12 @@
ClosePlatformFile(file_);
}
- void DidFinish(PlatformFileError error) {
+ void DidFinish(File::Error error) {
error_ = error;
MessageLoop::current()->QuitWhenIdle();
}
- void DidCreateOrOpen(PlatformFileError error,
+ void DidCreateOrOpen(File::Error error,
PassPlatformFile file,
bool created) {
error_ = error;
@@ -52,7 +52,7 @@
MessageLoop::current()->QuitWhenIdle();
}
- void DidCreateTemporary(PlatformFileError error,
+ void DidCreateTemporary(File::Error error,
PassPlatformFile file,
const FilePath& path) {
error_ = error;
@@ -61,14 +61,14 @@
MessageLoop::current()->QuitWhenIdle();
}
- void DidGetFileInfo(PlatformFileError error,
- const PlatformFileInfo& file_info) {
+ void DidGetFileInfo(File::Error error,
+ const File::Info& file_info) {
error_ = error;
file_info_ = file_info;
MessageLoop::current()->QuitWhenIdle();
}
- void DidRead(PlatformFileError error,
+ void DidRead(File::Error error,
const char* data,
int bytes_read) {
error_ = error;
@@ -77,7 +77,7 @@
MessageLoop::current()->QuitWhenIdle();
}
- void DidWrite(PlatformFileError error,
+ void DidWrite(File::Error error,
int bytes_written) {
error_ = error;
bytes_written_ = bytes_written;
@@ -106,11 +106,11 @@
Thread file_thread_;
ScopedTempDir dir_;
- PlatformFileError error_;
+ File::Error error_;
bool created_;
PlatformFile file_;
FilePath path_;
- PlatformFileInfo file_info_;
+ File::Info file_info_;
std::vector<char> buffer_;
int bytes_written_;
WeakPtrFactory<FileUtilProxyTest> weak_factory_;
@@ -124,7 +124,7 @@
Bind(&FileUtilProxyTest::DidCreateOrOpen, weak_factory_.GetWeakPtr()));
MessageLoop::current()->Run();
- EXPECT_EQ(PLATFORM_FILE_OK, error_);
+ EXPECT_EQ(File::FILE_OK, error_);
EXPECT_TRUE(created_);
EXPECT_NE(kInvalidPlatformFileValue, file_);
EXPECT_TRUE(PathExists(test_path()));
@@ -143,7 +143,7 @@
Bind(&FileUtilProxyTest::DidCreateOrOpen, weak_factory_.GetWeakPtr()));
MessageLoop::current()->Run();
- EXPECT_EQ(PLATFORM_FILE_OK, error_);
+ EXPECT_EQ(File::FILE_OK, error_);
EXPECT_FALSE(created_);
EXPECT_NE(kInvalidPlatformFileValue, file_);
}
@@ -155,7 +155,7 @@
PLATFORM_FILE_OPEN | PLATFORM_FILE_READ,
Bind(&FileUtilProxyTest::DidCreateOrOpen, weak_factory_.GetWeakPtr()));
MessageLoop::current()->Run();
- EXPECT_EQ(PLATFORM_FILE_ERROR_NOT_FOUND, error_);
+ EXPECT_EQ(File::FILE_ERROR_NOT_FOUND, error_);
EXPECT_FALSE(created_);
EXPECT_EQ(kInvalidPlatformFileValue, file_);
EXPECT_FALSE(PathExists(test_path()));
@@ -177,7 +177,7 @@
file,
Bind(&FileUtilProxyTest::DidFinish, weak_factory_.GetWeakPtr()));
MessageLoop::current()->Run();
- EXPECT_EQ(PLATFORM_FILE_OK, error_);
+ EXPECT_EQ(File::FILE_OK, error_);
// Now it should pass on all platforms.
EXPECT_TRUE(base::Move(test_path(), test_dir_path().AppendASCII("new")));
@@ -188,7 +188,7 @@
file_task_runner(), 0 /* additional_file_flags */,
Bind(&FileUtilProxyTest::DidCreateTemporary, weak_factory_.GetWeakPtr()));
MessageLoop::current()->Run();
- EXPECT_EQ(PLATFORM_FILE_OK, error_);
+ EXPECT_EQ(File::FILE_OK, error_);
EXPECT_TRUE(PathExists(path_));
EXPECT_NE(kInvalidPlatformFileValue, file_);
@@ -235,7 +235,7 @@
MessageLoop::current()->Run();
// Verify.
- EXPECT_EQ(PLATFORM_FILE_OK, error_);
+ EXPECT_EQ(File::FILE_OK, error_);
EXPECT_EQ(expected_info.size, file_info_.size);
EXPECT_EQ(expected_info.is_directory, file_info_.is_directory);
EXPECT_EQ(expected_info.is_symbolic_link, file_info_.is_symbolic_link);
@@ -258,7 +258,7 @@
MessageLoop::current()->Run();
// Verify.
- EXPECT_EQ(PLATFORM_FILE_OK, error_);
+ EXPECT_EQ(File::FILE_OK, error_);
EXPECT_EQ(expected_info.size, file_info_.size);
EXPECT_EQ(expected_info.is_directory, file_info_.is_directory);
EXPECT_EQ(expected_info.is_symbolic_link, file_info_.is_symbolic_link);
@@ -284,7 +284,7 @@
MessageLoop::current()->Run();
// Verify.
- EXPECT_EQ(PLATFORM_FILE_OK, error_);
+ EXPECT_EQ(File::FILE_OK, error_);
EXPECT_EQ(expected_bytes, static_cast<int>(buffer_.size()));
for (size_t i = 0; i < buffer_.size(); ++i) {
EXPECT_EQ(expected_data[i], buffer_[i]);
@@ -305,7 +305,7 @@
data_bytes,
Bind(&FileUtilProxyTest::DidWrite, weak_factory_.GetWeakPtr()));
MessageLoop::current()->Run();
- EXPECT_EQ(PLATFORM_FILE_OK, error_);
+ EXPECT_EQ(File::FILE_OK, error_);
EXPECT_EQ(data_bytes, bytes_written_);
// Flush the written data. (So that the following read should always
@@ -315,7 +315,7 @@
file,
Bind(&FileUtilProxyTest::DidFinish, weak_factory_.GetWeakPtr()));
MessageLoop::current()->Run();
- EXPECT_EQ(PLATFORM_FILE_OK, error_);
+ EXPECT_EQ(File::FILE_OK, error_);
// Verify the written data.
char buffer[10];
@@ -338,7 +338,7 @@
last_modified_time,
Bind(&FileUtilProxyTest::DidFinish, weak_factory_.GetWeakPtr()));
MessageLoop::current()->Run();
- EXPECT_EQ(PLATFORM_FILE_OK, error_);
+ EXPECT_EQ(File::FILE_OK, error_);
File::Info info;
GetFileInfo(test_path(), &info);
diff --git a/chrome/browser/browsing_data/browsing_data_file_system_helper_unittest.cc b/chrome/browser/browsing_data/browsing_data_file_system_helper_unittest.cc
index 139cbcd..b7081e3 100644
--- a/chrome/browser/browsing_data/browsing_data_file_system_helper_unittest.cc
+++ b/chrome/browser/browsing_data/browsing_data_file_system_helper_unittest.cc
@@ -96,7 +96,7 @@
// fileapi::FileSystemContext::OpenFileSystem.
void OpenFileSystemCallback(const GURL& root,
const std::string& name,
- base::PlatformFileError error) {
+ base::File::Error error) {
open_file_system_result_ = error;
Notify();
}
@@ -111,7 +111,7 @@
&BrowsingDataFileSystemHelperTest::OpenFileSystemCallback,
base::Unretained(this)));
BlockUntilNotified();
- return open_file_system_result_ == base::PLATFORM_FILE_OK;
+ return open_file_system_result_ == base::File::FILE_OK;
}
// Calls fileapi::FileSystemContext::OpenFileSystem with
@@ -176,7 +176,7 @@
fileapi::FileSystemType type) {
OpenFileSystem(origin, type,
fileapi::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT);
- EXPECT_EQ(base::PLATFORM_FILE_OK, open_file_system_result_);
+ EXPECT_EQ(base::File::FILE_OK, open_file_system_result_);
}
// Returns a list of the FileSystemInfo objects gathered in the most recent
@@ -190,7 +190,7 @@
scoped_ptr<TestingProfile> profile_;
// Temporary storage to pass information back from callbacks.
- base::PlatformFileError open_file_system_result_;
+ base::File::Error open_file_system_result_;
ScopedFileSystemInfoList file_system_info_list_;
scoped_refptr<BrowsingDataFileSystemHelper> helper_;
diff --git a/chrome/browser/chromeos/drive/async_file_util.cc b/chrome/browser/chromeos/drive/async_file_util.cc
index 16268093..9349bbf 100644
--- a/chrome/browser/chromeos/drive/async_file_util.cc
+++ b/chrome/browser/chromeos/drive/async_file_util.cc
@@ -49,7 +49,7 @@
const AsyncFileUtil::FileSystemGetter& file_system_getter,
const base::FilePath& file_path,
const AsyncFileUtil::CreateOrOpenCallback& callback,
- base::PlatformFileError error,
+ base::File::Error error,
base::PlatformFile file,
const base::Closure& close_callback_on_ui_thread) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
@@ -67,7 +67,7 @@
// Runs CreateOrOpenFile when the error happens.
void RunCreateOrOpenFileCallbackOnError(
const AsyncFileUtil::CreateOrOpenCallback& callback,
- base::PlatformFileError error) {
+ base::File::Error error) {
// Because the |callback| takes PassPlatformFile as its argument, and
// it is necessary to guarantee the pointer passed to PassPlatformFile is
// alive during the |callback| invocation, here we prepare a thin adapter
@@ -79,15 +79,15 @@
// Runs EnsureFileExistsCallback based on the given |error|.
void RunEnsureFileExistsCallback(
const AsyncFileUtil::EnsureFileExistsCallback& callback,
- base::PlatformFileError error) {
+ base::File::Error error) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
// Remember if the file is actually created or not.
- bool created = (error == base::PLATFORM_FILE_OK);
+ bool created = (error == base::File::FILE_OK);
- // PLATFORM_FILE_ERROR_EXISTS is not an actual error here.
- if (error == base::PLATFORM_FILE_ERROR_EXISTS)
- error = base::PLATFORM_FILE_OK;
+ // File::FILE_ERROR_EXISTS is not an actual error here.
+ if (error == base::File::FILE_ERROR_EXISTS)
+ error = base::File::FILE_OK;
callback.Run(error, created);
}
@@ -95,8 +95,8 @@
// Runs |callback| with the arguments based on the given arguments.
void RunCreateSnapshotFileCallback(
const AsyncFileUtil::CreateSnapshotFileCallback& callback,
- base::PlatformFileError error,
- const base::PlatformFileInfo& file_info,
+ base::File::Error error,
+ const base::File::Info& file_info,
const base::FilePath& local_path,
webkit_blob::ScopedFile::ScopeOutPolicy scope_out_policy) {
// ShareableFileReference is thread *unsafe* class. So it is necessary to
@@ -131,7 +131,7 @@
base::FilePath file_path = util::ExtractDrivePathFromFileSystemUrl(url);
if (file_path.empty()) {
base::PlatformFile platform_file = base::kInvalidPlatformFileValue;
- callback.Run(base::PLATFORM_FILE_ERROR_NOT_FOUND,
+ callback.Run(base::File::FILE_ERROR_NOT_FOUND,
base::PassPlatformFile(&platform_file),
base::Closure());
return;
@@ -145,7 +145,7 @@
base::Bind(&RunCreateOrOpenFileCallback,
file_system_getter_, file_path, callback))),
base::Bind(&RunCreateOrOpenFileCallbackOnError,
- callback, base::PLATFORM_FILE_ERROR_FAILED));
+ callback, base::File::FILE_ERROR_FAILED));
}
void AsyncFileUtil::EnsureFileExists(
@@ -156,7 +156,7 @@
base::FilePath file_path = util::ExtractDrivePathFromFileSystemUrl(url);
if (file_path.empty()) {
- callback.Run(base::PLATFORM_FILE_ERROR_NOT_FOUND, false);
+ callback.Run(base::File::FILE_ERROR_NOT_FOUND, false);
return;
}
@@ -166,7 +166,7 @@
file_path, true /* is_exlusive */,
google_apis::CreateRelayCallback(
base::Bind(&RunEnsureFileExistsCallback, callback))),
- base::Bind(callback, base::PLATFORM_FILE_ERROR_FAILED, false));
+ base::Bind(callback, base::File::FILE_ERROR_FAILED, false));
}
void AsyncFileUtil::CreateDirectory(
@@ -179,7 +179,7 @@
base::FilePath file_path = util::ExtractDrivePathFromFileSystemUrl(url);
if (file_path.empty()) {
- callback.Run(base::PLATFORM_FILE_ERROR_NOT_FOUND);
+ callback.Run(base::File::FILE_ERROR_NOT_FOUND);
return;
}
@@ -188,7 +188,7 @@
base::Bind(&fileapi_internal::CreateDirectory,
file_path, exclusive, recursive,
google_apis::CreateRelayCallback(callback)),
- base::Bind(callback, base::PLATFORM_FILE_ERROR_FAILED));
+ base::Bind(callback, base::File::FILE_ERROR_FAILED));
}
void AsyncFileUtil::GetFileInfo(
@@ -199,7 +199,7 @@
base::FilePath file_path = util::ExtractDrivePathFromFileSystemUrl(url);
if (file_path.empty()) {
- callback.Run(base::PLATFORM_FILE_ERROR_NOT_FOUND, base::PlatformFileInfo());
+ callback.Run(base::File::FILE_ERROR_NOT_FOUND, base::File::Info());
return;
}
@@ -207,8 +207,8 @@
file_system_getter_,
base::Bind(&fileapi_internal::GetFileInfo,
file_path, google_apis::CreateRelayCallback(callback)),
- base::Bind(callback, base::PLATFORM_FILE_ERROR_FAILED,
- base::PlatformFileInfo()));
+ base::Bind(callback, base::File::FILE_ERROR_FAILED,
+ base::File::Info()));
}
void AsyncFileUtil::ReadDirectory(
@@ -219,7 +219,7 @@
base::FilePath file_path = util::ExtractDrivePathFromFileSystemUrl(url);
if (file_path.empty()) {
- callback.Run(base::PLATFORM_FILE_ERROR_NOT_FOUND, EntryList(), false);
+ callback.Run(base::File::FILE_ERROR_NOT_FOUND, EntryList(), false);
return;
}
@@ -227,7 +227,7 @@
file_system_getter_,
base::Bind(&fileapi_internal::ReadDirectory,
file_path, google_apis::CreateRelayCallback(callback)),
- base::Bind(callback, base::PLATFORM_FILE_ERROR_FAILED,
+ base::Bind(callback, base::File::FILE_ERROR_FAILED,
EntryList(), false));
}
@@ -241,7 +241,7 @@
base::FilePath file_path = util::ExtractDrivePathFromFileSystemUrl(url);
if (file_path.empty()) {
- callback.Run(base::PLATFORM_FILE_ERROR_NOT_FOUND);
+ callback.Run(base::File::FILE_ERROR_NOT_FOUND);
return;
}
@@ -250,7 +250,7 @@
base::Bind(&fileapi_internal::TouchFile,
file_path, last_access_time, last_modified_time,
google_apis::CreateRelayCallback(callback)),
- base::Bind(callback, base::PLATFORM_FILE_ERROR_FAILED));
+ base::Bind(callback, base::File::FILE_ERROR_FAILED));
}
void AsyncFileUtil::Truncate(
@@ -262,7 +262,7 @@
base::FilePath file_path = util::ExtractDrivePathFromFileSystemUrl(url);
if (file_path.empty()) {
- callback.Run(base::PLATFORM_FILE_ERROR_NOT_FOUND);
+ callback.Run(base::File::FILE_ERROR_NOT_FOUND);
return;
}
@@ -270,7 +270,7 @@
file_system_getter_,
base::Bind(&fileapi_internal::Truncate,
file_path, length, google_apis::CreateRelayCallback(callback)),
- base::Bind(callback, base::PLATFORM_FILE_ERROR_FAILED));
+ base::Bind(callback, base::File::FILE_ERROR_FAILED));
}
void AsyncFileUtil::CopyFileLocal(
@@ -285,7 +285,7 @@
base::FilePath src_path = util::ExtractDrivePathFromFileSystemUrl(src_url);
base::FilePath dest_path = util::ExtractDrivePathFromFileSystemUrl(dest_url);
if (src_path.empty() || dest_path.empty()) {
- callback.Run(base::PLATFORM_FILE_ERROR_NOT_FOUND);
+ callback.Run(base::File::FILE_ERROR_NOT_FOUND);
return;
}
@@ -296,7 +296,7 @@
src_path, dest_path,
option == fileapi::FileSystemOperation::OPTION_PRESERVE_LAST_MODIFIED,
google_apis::CreateRelayCallback(callback)),
- base::Bind(callback, base::PLATFORM_FILE_ERROR_FAILED));
+ base::Bind(callback, base::File::FILE_ERROR_FAILED));
}
void AsyncFileUtil::MoveFileLocal(
@@ -310,7 +310,7 @@
base::FilePath src_path = util::ExtractDrivePathFromFileSystemUrl(src_url);
base::FilePath dest_path = util::ExtractDrivePathFromFileSystemUrl(dest_url);
if (src_path.empty() || dest_path.empty()) {
- callback.Run(base::PLATFORM_FILE_ERROR_NOT_FOUND);
+ callback.Run(base::File::FILE_ERROR_NOT_FOUND);
return;
}
@@ -321,7 +321,7 @@
src_path, dest_path,
option == fileapi::FileSystemOperation::OPTION_PRESERVE_LAST_MODIFIED,
google_apis::CreateRelayCallback(callback)),
- base::Bind(callback, base::PLATFORM_FILE_ERROR_FAILED));
+ base::Bind(callback, base::File::FILE_ERROR_FAILED));
}
void AsyncFileUtil::CopyInForeignFile(
@@ -333,7 +333,7 @@
base::FilePath dest_path = util::ExtractDrivePathFromFileSystemUrl(dest_url);
if (dest_path.empty()) {
- callback.Run(base::PLATFORM_FILE_ERROR_NOT_FOUND);
+ callback.Run(base::File::FILE_ERROR_NOT_FOUND);
return;
}
@@ -342,7 +342,7 @@
base::Bind(&fileapi_internal::CopyInForeignFile,
src_file_path, dest_path,
google_apis::CreateRelayCallback(callback)),
- base::Bind(callback, base::PLATFORM_FILE_ERROR_FAILED));
+ base::Bind(callback, base::File::FILE_ERROR_FAILED));
}
void AsyncFileUtil::DeleteFile(
@@ -353,7 +353,7 @@
base::FilePath file_path = util::ExtractDrivePathFromFileSystemUrl(url);
if (file_path.empty()) {
- callback.Run(base::PLATFORM_FILE_ERROR_NOT_FOUND);
+ callback.Run(base::File::FILE_ERROR_NOT_FOUND);
return;
}
@@ -362,7 +362,7 @@
base::Bind(&fileapi_internal::Remove,
file_path, false /* not recursive */,
google_apis::CreateRelayCallback(callback)),
- base::Bind(callback, base::PLATFORM_FILE_ERROR_FAILED));
+ base::Bind(callback, base::File::FILE_ERROR_FAILED));
}
void AsyncFileUtil::DeleteDirectory(
@@ -373,7 +373,7 @@
base::FilePath file_path = util::ExtractDrivePathFromFileSystemUrl(url);
if (file_path.empty()) {
- callback.Run(base::PLATFORM_FILE_ERROR_NOT_FOUND);
+ callback.Run(base::File::FILE_ERROR_NOT_FOUND);
return;
}
@@ -382,7 +382,7 @@
base::Bind(&fileapi_internal::Remove,
file_path, false /* not recursive */,
google_apis::CreateRelayCallback(callback)),
- base::Bind(callback, base::PLATFORM_FILE_ERROR_FAILED));
+ base::Bind(callback, base::File::FILE_ERROR_FAILED));
}
void AsyncFileUtil::DeleteRecursively(
@@ -393,7 +393,7 @@
base::FilePath file_path = util::ExtractDrivePathFromFileSystemUrl(url);
if (file_path.empty()) {
- callback.Run(base::PLATFORM_FILE_ERROR_NOT_FOUND);
+ callback.Run(base::File::FILE_ERROR_NOT_FOUND);
return;
}
@@ -402,7 +402,7 @@
base::Bind(&fileapi_internal::Remove,
file_path, true /* recursive */,
google_apis::CreateRelayCallback(callback)),
- base::Bind(callback, base::PLATFORM_FILE_ERROR_FAILED));
+ base::Bind(callback, base::File::FILE_ERROR_FAILED));
}
void AsyncFileUtil::CreateSnapshotFile(
@@ -413,8 +413,8 @@
base::FilePath file_path = util::ExtractDrivePathFromFileSystemUrl(url);
if (file_path.empty()) {
- callback.Run(base::PLATFORM_FILE_ERROR_NOT_FOUND,
- base::PlatformFileInfo(),
+ callback.Run(base::File::FILE_ERROR_NOT_FOUND,
+ base::File::Info(),
base::FilePath(),
scoped_refptr<webkit_blob::ShareableFileReference>());
return;
@@ -427,8 +427,8 @@
google_apis::CreateRelayCallback(
base::Bind(&RunCreateSnapshotFileCallback, callback))),
base::Bind(callback,
- base::PLATFORM_FILE_ERROR_FAILED,
- base::PlatformFileInfo(),
+ base::File::FILE_ERROR_FAILED,
+ base::File::Info(),
base::FilePath(),
scoped_refptr<webkit_blob::ShareableFileReference>()));
}
diff --git a/chrome/browser/chromeos/drive/drive_file_stream_reader.cc b/chrome/browser/chromeos/drive/drive_file_stream_reader.cc
index 2a20c56..e9d97b1 100644
--- a/chrome/browser/chromeos/drive/drive_file_stream_reader.cc
+++ b/chrome/browser/chromeos/drive/drive_file_stream_reader.cc
@@ -26,7 +26,7 @@
// Converts FileError code to net::Error code.
int FileErrorToNetError(FileError error) {
- return net::PlatformFileErrorToNetError(FileErrorToPlatformError(error));
+ return net::FileErrorToNetError(FileErrorToBaseFileError(error));
}
// Runs task on UI thread.
diff --git a/chrome/browser/chromeos/drive/file_errors.cc b/chrome/browser/chromeos/drive/file_errors.cc
index ae8a43e..5533f63 100644
--- a/chrome/browser/chromeos/drive/file_errors.cc
+++ b/chrome/browser/chromeos/drive/file_errors.cc
@@ -72,68 +72,68 @@
return "";
}
-base::PlatformFileError FileErrorToPlatformError(FileError error) {
+base::File::Error FileErrorToBaseFileError(FileError error) {
switch (error) {
case FILE_ERROR_OK:
- return base::PLATFORM_FILE_OK;
+ return base::File::FILE_OK;
case FILE_ERROR_FAILED:
- return base::PLATFORM_FILE_ERROR_FAILED;
+ return base::File::FILE_ERROR_FAILED;
case FILE_ERROR_IN_USE:
- return base::PLATFORM_FILE_ERROR_IN_USE;
+ return base::File::FILE_ERROR_IN_USE;
case FILE_ERROR_EXISTS:
- return base::PLATFORM_FILE_ERROR_EXISTS;
+ return base::File::FILE_ERROR_EXISTS;
case FILE_ERROR_NOT_FOUND:
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ return base::File::FILE_ERROR_NOT_FOUND;
case FILE_ERROR_ACCESS_DENIED:
- return base::PLATFORM_FILE_ERROR_ACCESS_DENIED;
+ return base::File::FILE_ERROR_ACCESS_DENIED;
case FILE_ERROR_TOO_MANY_OPENED:
- return base::PLATFORM_FILE_ERROR_TOO_MANY_OPENED;
+ return base::File::FILE_ERROR_TOO_MANY_OPENED;
case FILE_ERROR_NO_MEMORY:
- return base::PLATFORM_FILE_ERROR_NO_MEMORY;
+ return base::File::FILE_ERROR_NO_MEMORY;
case FILE_ERROR_NO_SERVER_SPACE:
- return base::PLATFORM_FILE_ERROR_NO_SPACE;
+ return base::File::FILE_ERROR_NO_SPACE;
case FILE_ERROR_NOT_A_DIRECTORY:
- return base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY;
+ return base::File::FILE_ERROR_NOT_A_DIRECTORY;
case FILE_ERROR_INVALID_OPERATION:
- return base::PLATFORM_FILE_ERROR_INVALID_OPERATION;
+ return base::File::FILE_ERROR_INVALID_OPERATION;
case FILE_ERROR_SECURITY:
- return base::PLATFORM_FILE_ERROR_SECURITY;
+ return base::File::FILE_ERROR_SECURITY;
case FILE_ERROR_ABORT:
- return base::PLATFORM_FILE_ERROR_ABORT;
+ return base::File::FILE_ERROR_ABORT;
case FILE_ERROR_NOT_A_FILE:
- return base::PLATFORM_FILE_ERROR_NOT_A_FILE;
+ return base::File::FILE_ERROR_NOT_A_FILE;
case FILE_ERROR_NOT_EMPTY:
- return base::PLATFORM_FILE_ERROR_NOT_EMPTY;
+ return base::File::FILE_ERROR_NOT_EMPTY;
case FILE_ERROR_INVALID_URL:
- return base::PLATFORM_FILE_ERROR_INVALID_URL;
+ return base::File::FILE_ERROR_INVALID_URL;
case FILE_ERROR_NO_CONNECTION:
- return base::PLATFORM_FILE_ERROR_FAILED;
+ return base::File::FILE_ERROR_FAILED;
case FILE_ERROR_NO_LOCAL_SPACE:
- return base::PLATFORM_FILE_ERROR_FAILED;
+ return base::File::FILE_ERROR_FAILED;
case FILE_ERROR_SERVICE_UNAVAILABLE:
- return base::PLATFORM_FILE_ERROR_FAILED;
+ return base::File::FILE_ERROR_FAILED;
}
NOTREACHED();
- return base::PLATFORM_FILE_ERROR_FAILED;
+ return base::File::FILE_ERROR_FAILED;
}
FileError GDataToFileError(google_apis::GDataErrorCode status) {
diff --git a/chrome/browser/chromeos/drive/file_errors.h b/chrome/browser/chromeos/drive/file_errors.h
index 87d7f678..d06ff626 100644
--- a/chrome/browser/chromeos/drive/file_errors.h
+++ b/chrome/browser/chromeos/drive/file_errors.h
@@ -6,7 +6,7 @@
#define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_ERRORS_H_
#include "base/callback_forward.h"
-#include "base/platform_file.h"
+#include "base/files/file.h"
#include "google_apis/drive/gdata_errorcode.h"
namespace drive {
@@ -39,8 +39,8 @@
// Returns a string representation of FileError.
std::string FileErrorToString(FileError error);
-// Returns a PlatformFileError that corresponds to the FileError provided.
-base::PlatformFileError FileErrorToPlatformError(FileError error);
+// Returns a base::File::Error that corresponds to the FileError provided.
+base::File::Error FileErrorToBaseFileError(FileError error);
// Converts GData error code into Drive file error code.
FileError GDataToFileError(google_apis::GDataErrorCode status);
diff --git a/chrome/browser/chromeos/drive/file_system.cc b/chrome/browser/chromeos/drive/file_system.cc
index a617b56..d2957c8 100644
--- a/chrome/browser/chromeos/drive/file_system.cc
+++ b/chrome/browser/chromeos/drive/file_system.cc
@@ -74,7 +74,7 @@
return error;
// TODO(rvargas): Convert this code to use base::File::Info.
- base::PlatformFileInfo file_info;
+ base::File::Info file_info;
if (!base::GetFileInfo(local_cache_path,
reinterpret_cast<base::File::Info*>(&file_info))) {
return FILE_ERROR_NOT_FOUND;
diff --git a/chrome/browser/chromeos/drive/file_system/download_operation.cc b/chrome/browser/chromeos/drive/file_system/download_operation.cc
index 5257e82..0df9748 100644
--- a/chrome/browser/chromeos/drive/file_system/download_operation.cc
+++ b/chrome/browser/chromeos/drive/file_system/download_operation.cc
@@ -62,7 +62,7 @@
if (entry->file_specific_info().is_hosted_document()) {
base::FilePath gdoc_file_path;
// TODO(rvargas): Convert this code to use base::File::Info.
- base::PlatformFileInfo file_info;
+ base::File::Info file_info;
if (!base::CreateTemporaryFileInDir(temporary_file_directory,
&gdoc_file_path) ||
!util::CreateGDocFile(gdoc_file_path,
@@ -99,7 +99,7 @@
// drive::FileSystem::CheckLocalModificationAndRun. We should merge them once
// the drive::FS side is also converted to run fully on blocking pool.
if (cache_entry.is_dirty()) {
- base::PlatformFileInfo file_info;
+ base::File::Info file_info;
if (base::GetFileInfo(*cache_file_path,
reinterpret_cast<base::File::Info*>(&file_info)))
SetPlatformFileInfoToResourceEntry(file_info, entry);
diff --git a/chrome/browser/chromeos/drive/fileapi_worker.cc b/chrome/browser/chromeos/drive/fileapi_worker.cc
index 77a8ca9..54c1a829 100644
--- a/chrome/browser/chromeos/drive/fileapi_worker.cc
+++ b/chrome/browser/chromeos/drive/fileapi_worker.cc
@@ -44,10 +44,10 @@
return OPEN_OR_CREATE_FILE;
}
-// Runs |callback| with the PlatformFileError converted from |error|.
+// Runs |callback| with the File::Error converted from |error|.
void RunStatusCallbackByFileError(const StatusCallback& callback,
FileError error) {
- callback.Run(FileErrorToPlatformError(error));
+ callback.Run(FileErrorToBaseFileError(error));
}
// Runs |callback| with arguments converted from |error| and |entry|.
@@ -55,14 +55,14 @@
FileError error,
scoped_ptr<ResourceEntry> entry) {
if (error != FILE_ERROR_OK) {
- callback.Run(FileErrorToPlatformError(error), base::PlatformFileInfo());
+ callback.Run(FileErrorToBaseFileError(error), base::File::Info());
return;
}
DCHECK(entry);
- base::PlatformFileInfo file_info;
- ConvertResourceEntryToPlatformFileInfo(*entry, &file_info);
- callback.Run(base::PLATFORM_FILE_OK, file_info);
+ base::File::Info file_info;
+ ConvertResourceEntryToFileInfo(*entry, &file_info);
+ callback.Run(base::File::FILE_OK, file_info);
}
// Runs |callback| with arguments converted from |error| and |resource_entries|.
@@ -71,7 +71,7 @@
FileError error,
scoped_ptr<ResourceEntryVector> resource_entries) {
if (error != FILE_ERROR_OK) {
- callback.Run(FileErrorToPlatformError(error),
+ callback.Run(FileErrorToBaseFileError(error),
std::vector<fileapi::DirectoryEntry>(), false);
return;
}
@@ -94,7 +94,7 @@
entries.push_back(entry);
}
- callback.Run(base::PLATFORM_FILE_OK, entries, false);
+ callback.Run(base::File::FILE_OK, entries, false);
}
// Runs |callback| with arguments based on |error|, |local_path| and |entry|.
@@ -104,8 +104,8 @@
scoped_ptr<ResourceEntry> entry) {
if (error != FILE_ERROR_OK) {
callback.Run(
- FileErrorToPlatformError(error),
- base::PlatformFileInfo(), base::FilePath(),
+ FileErrorToBaseFileError(error),
+ base::File::Info(), base::FilePath(),
webkit_blob::ScopedFile::ScopeOutPolicy());
return;
}
@@ -118,8 +118,8 @@
// drive server vs. last modification time of the local, downloaded file), so
// we have to opt out from this check. We do this by unsetting last_modified
// value in the file info passed to the CreateSnapshot caller.
- base::PlatformFileInfo file_info;
- ConvertResourceEntryToPlatformFileInfo(*entry, &file_info);
+ base::File::Info file_info;
+ ConvertResourceEntryToFileInfo(*entry, &file_info);
file_info.last_modified = base::Time();
// If the file is a hosted document, a temporary JSON file is created to
@@ -130,7 +130,7 @@
webkit_blob::ScopedFile::DELETE_ON_SCOPE_OUT :
webkit_blob::ScopedFile::DONT_DELETE_ON_SCOPE_OUT;
- callback.Run(base::PLATFORM_FILE_OK, file_info, local_path, scope_out_policy);
+ callback.Run(base::File::FILE_OK, file_info, local_path, scope_out_policy);
}
// Runs |callback| with arguments converted from |error| and |local_path|.
@@ -140,13 +140,13 @@
const base::FilePath& local_path,
const base::Closure& close_callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- callback.Run(FileErrorToPlatformError(error), local_path, close_callback);
+ callback.Run(FileErrorToBaseFileError(error), local_path, close_callback);
}
// Runs |callback| with |error| and |platform_file|.
void RunOpenFileCallback(const OpenFileCallback& callback,
const base::Closure& close_callback,
- base::PlatformFileError* error,
+ base::File::Error* error,
base::PlatformFile platform_file) {
callback.Run(*error, platform_file, close_callback);
}
@@ -160,7 +160,7 @@
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
if (error != FILE_ERROR_OK) {
- callback.Run(FileErrorToPlatformError(error),
+ callback.Run(FileErrorToBaseFileError(error),
base::kInvalidPlatformFileValue,
base::Closure());
return;
@@ -182,12 +182,14 @@
}
// Cache file prepared for modification is available. Open it locally.
- base::PlatformFileError* result =
- new base::PlatformFileError(base::PLATFORM_FILE_ERROR_FAILED);
+ // TODO(rvargas): Convert this to base::File.
+ base::File::Error* result =
+ new base::File::Error(base::File::FILE_ERROR_FAILED);
bool posted = base::PostTaskAndReplyWithResult(
BrowserThread::GetBlockingPool(), FROM_HERE,
base::Bind(&base::CreatePlatformFile,
- local_path, file_flags, static_cast<bool*>(NULL), result),
+ local_path, file_flags, static_cast<bool*>(NULL),
+ reinterpret_cast<base::PlatformFileError*>(result)),
base::Bind(&RunOpenFileCallback,
callback, close_callback, base::Owned(result)));
DCHECK(posted);
@@ -337,7 +339,7 @@
base::MessageLoopProxy::current()->PostTask(
FROM_HERE,
base::Bind(callback,
- base::PLATFORM_FILE_ERROR_FAILED,
+ base::File::FILE_ERROR_FAILED,
base::kInvalidPlatformFileValue,
base::Closure()));
return;
diff --git a/chrome/browser/chromeos/drive/fileapi_worker.h b/chrome/browser/chromeos/drive/fileapi_worker.h
index b45250a..da400e1 100644
--- a/chrome/browser/chromeos/drive/fileapi_worker.h
+++ b/chrome/browser/chromeos/drive/fileapi_worker.h
@@ -45,27 +45,27 @@
typedef base::Callback<FileSystemInterface*()> FileSystemGetter;
typedef base::Callback<
- void(base::PlatformFileError result)> StatusCallback;
+ void(base::File::Error result)> StatusCallback;
typedef base::Callback<
- void(base::PlatformFileError result,
- const base::PlatformFileInfo& file_info)> GetFileInfoCallback;
+ void(base::File::Error result,
+ const base::File::Info& file_info)> GetFileInfoCallback;
typedef base::Callback<
- void(base::PlatformFileError result,
+ void(base::File::Error result,
const std::vector<fileapi::DirectoryEntry>& file_list,
bool has_more)> ReadDirectoryCallback;
typedef base::Callback<
- void(base::PlatformFileError result,
- const base::PlatformFileInfo& file_info,
+ void(base::File::Error result,
+ const base::File::Info& file_info,
const base::FilePath& snapshot_file_path,
webkit_blob::ScopedFile::ScopeOutPolicy scope_out_policy)>
CreateSnapshotFileCallback;
typedef base::Callback<
- void(base::PlatformFileError result,
+ void(base::File::Error result,
const base::FilePath& snapshot_file_path,
const base::Closure& close_callback)>
CreateWritableSnapshotFileCallback;
typedef base::Callback<
- void(base::PlatformFileError result,
+ void(base::File::Error result,
base::PlatformFile platform_file,
const base::Closure& close_callback)> OpenFileCallback;
diff --git a/chrome/browser/chromeos/drive/fileapi_worker_unittest.cc b/chrome/browser/chromeos/drive/fileapi_worker_unittest.cc
index dbe9b482..fea892d 100644
--- a/chrome/browser/chromeos/drive/fileapi_worker_unittest.cc
+++ b/chrome/browser/chromeos/drive/fileapi_worker_unittest.cc
@@ -70,11 +70,11 @@
int64 expected_size,
const base::FilePath& expected_written_path,
const std::string& write_data,
- base::PlatformFileError result,
+ base::File::Error result,
base::PlatformFile platform_file,
const base::Closure& close_callback) {
// Check that the file is properly opened.
- EXPECT_EQ(base::PLATFORM_FILE_OK, result);
+ EXPECT_EQ(base::File::FILE_OK, result);
EXPECT_NE(base::kInvalidPlatformFileValue, platform_file);
EXPECT_FALSE(close_callback.is_null());
@@ -104,11 +104,11 @@
// Helper function of testing OpenFile() for read access. It checks that the
// file is readable and contains |expected_data|.
void VerifyRead(const std::string& expected_data,
- base::PlatformFileError result,
+ base::File::Error result,
base::PlatformFile platform_file,
const base::Closure& close_callback) {
// Check that the file is properly opened.
- EXPECT_EQ(base::PLATFORM_FILE_OK, result);
+ EXPECT_EQ(base::File::FILE_OK, result);
EXPECT_NE(base::kInvalidPlatformFileValue, platform_file);
EXPECT_FALSE(close_callback.is_null());
diff --git a/chrome/browser/chromeos/drive/local_file_reader.cc b/chrome/browser/chromeos/drive/local_file_reader.cc
index 5b9b016..f7cf425a 100644
--- a/chrome/browser/chromeos/drive/local_file_reader.cc
+++ b/chrome/browser/chromeos/drive/local_file_reader.cc
@@ -41,7 +41,7 @@
base::CreatePlatformFile(file_path, open_flags, NULL, &error);
if (file == base::kInvalidPlatformFileValue) {
DCHECK_NE(base::PLATFORM_FILE_OK, error);
- return net::PlatformFileErrorToNetError(error);
+ return net::FileErrorToNetError(static_cast<base::File::Error>(error));
}
// If succeeded, seek to the |offset| from begin.
diff --git a/chrome/browser/chromeos/drive/resource_entry_conversion.cc b/chrome/browser/chromeos/drive/resource_entry_conversion.cc
index 8ab9458f..1f479b6 100644
--- a/chrome/browser/chromeos/drive/resource_entry_conversion.cc
+++ b/chrome/browser/chromeos/drive/resource_entry_conversion.cc
@@ -133,8 +133,8 @@
return true;
}
-void ConvertResourceEntryToPlatformFileInfo(const ResourceEntry& entry,
- base::PlatformFileInfo* file_info) {
+void ConvertResourceEntryToFileInfo(const ResourceEntry& entry,
+ base::File::Info* file_info) {
file_info->size = entry.file_info().size();
file_info->is_directory = entry.file_info().is_directory();
file_info->is_symbolic_link = entry.file_info().is_symbolic_link();
@@ -146,7 +146,7 @@
entry.file_info().creation_time());
}
-void SetPlatformFileInfoToResourceEntry(const base::PlatformFileInfo& file_info,
+void SetPlatformFileInfoToResourceEntry(const base::File::Info& file_info,
ResourceEntry* entry) {
PlatformFileInfoProto* entry_file_info = entry->mutable_file_info();
entry_file_info->set_size(file_info.size);
diff --git a/chrome/browser/chromeos/drive/resource_entry_conversion.h b/chrome/browser/chromeos/drive/resource_entry_conversion.h
index 56607b99..73fe53cd 100644
--- a/chrome/browser/chromeos/drive/resource_entry_conversion.h
+++ b/chrome/browser/chromeos/drive/resource_entry_conversion.h
@@ -7,9 +7,7 @@
#include <string>
-namespace base {
-struct PlatformFileInfo;
-}
+#include "base/files/file.h"
namespace google_apis {
class ResourceEntry;
@@ -38,12 +36,12 @@
std::string* out_parent_resource_id);
// Converts the resource entry to the platform file info.
-void ConvertResourceEntryToPlatformFileInfo(const ResourceEntry& entry,
- base::PlatformFileInfo* file_info);
+void ConvertResourceEntryToFileInfo(const ResourceEntry& entry,
+ base::File::Info* file_info);
// Converts the platform file info and sets it to the .file_info field of
// the resource entry.
-void SetPlatformFileInfoToResourceEntry(const base::PlatformFileInfo& file_info,
+void SetPlatformFileInfoToResourceEntry(const base::File::Info& file_info,
ResourceEntry* entry);
} // namespace drive
diff --git a/chrome/browser/chromeos/drive/resource_entry_conversion_unittest.cc b/chrome/browser/chromeos/drive/resource_entry_conversion_unittest.cc
index bc13e76..0b7081ce 100644
--- a/chrome/browser/chromeos/drive/resource_entry_conversion_unittest.cc
+++ b/chrome/browser/chromeos/drive/resource_entry_conversion_unittest.cc
@@ -349,8 +349,8 @@
entry.mutable_file_info()->set_last_modified(123456789);
entry.mutable_file_info()->set_last_accessed(987654321);
- base::PlatformFileInfo file_info;
- ConvertResourceEntryToPlatformFileInfo(entry, &file_info);
+ base::File::Info file_info;
+ ConvertResourceEntryToFileInfo(entry, &file_info);
EXPECT_EQ(entry.file_info().size(), file_info.size);
EXPECT_EQ(entry.file_info().is_directory(), file_info.is_directory);
EXPECT_EQ(entry.file_info().is_symbolic_link(), file_info.is_symbolic_link);
@@ -363,7 +363,7 @@
}
TEST(ResourceEntryConversionTest, FromPlatformFileInfo) {
- base::PlatformFileInfo file_info;
+ base::File::Info file_info;
file_info.size = 12345;
file_info.is_directory = true;
file_info.is_symbolic_link = true;
diff --git a/chrome/browser/chromeos/drive/webkit_file_stream_writer_impl.cc b/chrome/browser/chromeos/drive/webkit_file_stream_writer_impl.cc
index 3e9397c..007ec9d 100644
--- a/chrome/browser/chromeos/drive/webkit_file_stream_writer_impl.cc
+++ b/chrome/browser/chromeos/drive/webkit_file_stream_writer_impl.cc
@@ -36,7 +36,7 @@
base::Bind(&fileapi_internal::CreateWritableSnapshotFile,
drive_path, google_apis::CreateRelayCallback(callback)),
google_apis::CreateRelayCallback(base::Bind(
- callback, base::PLATFORM_FILE_ERROR_FAILED, base::FilePath(),
+ callback, base::File::FILE_ERROR_FAILED, base::FilePath(),
base::Closure()))));
}
@@ -132,7 +132,7 @@
void WebkitFileStreamWriterImpl::WriteAfterCreateWritableSnapshotFile(
net::IOBuffer* buf,
int buf_len,
- base::PlatformFileError open_result,
+ base::File::Error open_result,
const base::FilePath& local_path,
const base::Closure& close_callback_on_ui_thread) {
DCHECK(!local_file_writer_);
@@ -141,7 +141,7 @@
DCHECK(pending_write_callback_.is_null());
// Cancel() is called during the creation of the snapshot file.
// Don't write to the file.
- if (open_result == base::PLATFORM_FILE_OK) {
+ if (open_result == base::File::FILE_OK) {
// Here the file is internally created. To revert the operation, close
// the file.
DCHECK(!close_callback_on_ui_thread.is_null());
@@ -158,9 +158,10 @@
const net::CompletionCallback callback =
base::ResetAndReturn(&pending_write_callback_);
- if (open_result != base::PLATFORM_FILE_OK) {
+ if (open_result != base::File::FILE_OK) {
DCHECK(close_callback_on_ui_thread.is_null());
- callback.Run(net::PlatformFileErrorToNetError(open_result));
+ callback.Run(
+ net::FileErrorToNetError(open_result));
return;
}
diff --git a/chrome/browser/chromeos/drive/webkit_file_stream_writer_impl.h b/chrome/browser/chromeos/drive/webkit_file_stream_writer_impl.h
index e72a692..05ef360e 100644
--- a/chrome/browser/chromeos/drive/webkit_file_stream_writer_impl.h
+++ b/chrome/browser/chromeos/drive/webkit_file_stream_writer_impl.h
@@ -7,9 +7,9 @@
#include "base/basictypes.h"
#include "base/callback.h"
+#include "base/files/file.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
-#include "base/platform_file.h"
#include "webkit/browser/fileapi/file_stream_writer.h"
namespace base {
@@ -57,7 +57,7 @@
void WriteAfterCreateWritableSnapshotFile(
net::IOBuffer* buf,
int buf_len,
- base::PlatformFileError open_result,
+ base::File::Error open_result,
const base::FilePath& local_path,
const base::Closure& close_callback_on_ui_thread);
diff --git a/chrome/browser/chromeos/extensions/file_manager/event_router.cc b/chrome/browser/chromeos/extensions/file_manager/event_router.cc
index 1c985f0..a4fef16f 100644
--- a/chrome/browser/chromeos/extensions/file_manager/event_router.cc
+++ b/chrome/browser/chromeos/extensions/file_manager/event_router.cc
@@ -412,11 +412,11 @@
void EventRouter::OnCopyCompleted(int copy_id,
const GURL& source_url,
const GURL& destination_url,
- base::PlatformFileError error) {
+ base::File::Error error) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
file_browser_private::CopyProgressStatus status;
- if (error == base::PLATFORM_FILE_OK) {
+ if (error == base::File::FILE_OK) {
// Send success event.
status.type = file_browser_private::COPY_PROGRESS_STATUS_TYPE_SUCCESS;
status.source_url.reset(new std::string(source_url.spec()));
@@ -425,7 +425,7 @@
// Send error event.
status.type = file_browser_private::COPY_PROGRESS_STATUS_TYPE_ERROR;
status.error.reset(
- new int(fileapi::PlatformFileErrorToWebFileError(error)));
+ new int(fileapi::FileErrorToWebFileError(error)));
}
BroadcastEvent(
diff --git a/chrome/browser/chromeos/extensions/file_manager/event_router.h b/chrome/browser/chromeos/extensions/file_manager/event_router.h
index f683505..30a26ff 100644
--- a/chrome/browser/chromeos/extensions/file_manager/event_router.h
+++ b/chrome/browser/chromeos/extensions/file_manager/event_router.h
@@ -73,7 +73,7 @@
// Called when a copy task is completed.
void OnCopyCompleted(
int copy_id, const GURL& source_url, const GURL& destination_url,
- base::PlatformFileError error);
+ base::File::Error error);
// Called when a copy task progress is updated.
void OnCopyProgress(int copy_id,
diff --git a/chrome/browser/chromeos/extensions/file_manager/private_api_file_system.cc b/chrome/browser/chromeos/extensions/file_manager/private_api_file_system.cc
index 1db6b67..d3729e1 100644
--- a/chrome/browser/chromeos/extensions/file_manager/private_api_file_system.cc
+++ b/chrome/browser/chromeos/extensions/file_manager/private_api_file_system.cc
@@ -153,7 +153,7 @@
fileapi::FileSystemOperationRunner::OperationID operation_id,
const FileSystemURL& source_url,
const FileSystemURL& destination_url,
- base::PlatformFileError error) {
+ base::File::Error error) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
file_manager::EventRouter* event_router =
@@ -171,7 +171,7 @@
fileapi::FileSystemOperationRunner::OperationID* operation_id,
const FileSystemURL& source_url,
const FileSystemURL& destination_url,
- base::PlatformFileError error) {
+ base::File::Error error) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
BrowserThread::PostTask(
@@ -205,12 +205,12 @@
return *operation_id;
}
-void OnCopyCancelled(base::PlatformFileError error) {
+void OnCopyCancelled(base::File::Error error) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
// We just ignore the status if the copy is actually cancelled or not,
// because failing cancellation means the operation is not running now.
- DLOG_IF(WARNING, error != base::PLATFORM_FILE_OK)
+ DLOG_IF(WARNING, error != base::File::FILE_OK)
<< "Failed to cancel copy: " << error;
}
@@ -227,7 +227,7 @@
} // namespace
void FileBrowserPrivateRequestFileSystemFunction::DidFail(
- base::PlatformFileError error_code) {
+ base::File::Error error_code) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
error_ = base::StringPrintf("File error %d", static_cast<int>(error_code));
@@ -293,7 +293,7 @@
if (!SetupFileSystemAccessPermissions(file_system_context,
child_id,
GetExtension())) {
- DidFail(base::PLATFORM_FILE_ERROR_SECURITY);
+ DidFail(base::File::FILE_ERROR_SECURITY);
return false;
}
diff --git a/chrome/browser/chromeos/extensions/file_manager/private_api_file_system.h b/chrome/browser/chromeos/extensions/file_manager/private_api_file_system.h
index 7bbfd43..6090853 100644
--- a/chrome/browser/chromeos/extensions/file_manager/private_api_file_system.h
+++ b/chrome/browser/chromeos/extensions/file_manager/private_api_file_system.h
@@ -41,11 +41,11 @@
private:
void RespondSuccessOnUIThread(const std::string& name,
const GURL& root_url);
- void RespondFailedOnUIThread(base::PlatformFileError error_code);
+ void RespondFailedOnUIThread(base::File::Error error_code);
// Called when something goes wrong. Records the error to |error_| per the
// error code and reports that the private API function failed.
- void DidFail(base::PlatformFileError error_code);
+ void DidFail(base::File::Error error_code);
// Sets up file system access permissions to the extension identified by
// |child_id|.
diff --git a/chrome/browser/chromeos/file_manager/open_util.cc b/chrome/browser/chromeos/file_manager/open_util.cc
index 279186c..8b78185 100644
--- a/chrome/browser/chromeos/file_manager/open_util.cc
+++ b/chrome/browser/chromeos/file_manager/open_util.cc
@@ -174,10 +174,10 @@
// Used to implement OpenItem().
void ContinueOpenItem(Profile* profile,
const base::FilePath& file_path,
- base::PlatformFileError error) {
+ base::File::Error error) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- if (error == base::PLATFORM_FILE_OK) {
+ if (error == base::File::FILE_OK) {
// A directory exists at |file_path|. Open it with the file manager.
OpenFileManagerWithInternalActionId(profile, file_path, "open");
} else {
diff --git a/chrome/browser/chromeos/fileapi/file_system_backend.cc b/chrome/browser/chromeos/fileapi/file_system_backend.cc
index 0a1e531..585de96 100644
--- a/chrome/browser/chromeos/fileapi/file_system_backend.cc
+++ b/chrome/browser/chromeos/fileapi/file_system_backend.cc
@@ -101,7 +101,7 @@
// TODO(nhiroki): Deprecate OpenFileSystem for non-sandboxed filesystem.
// (http://crbug.com/297412)
NOTREACHED();
- callback.Run(GURL(), std::string(), base::PLATFORM_FILE_ERROR_SECURITY);
+ callback.Run(GURL(), std::string(), base::File::FILE_ERROR_SECURITY);
}
fileapi::FileSystemQuotaUtil* FileSystemBackend::GetQuotaUtil() {
@@ -213,20 +213,20 @@
fileapi::CopyOrMoveFileValidatorFactory*
FileSystemBackend::GetCopyOrMoveFileValidatorFactory(
- fileapi::FileSystemType type, base::PlatformFileError* error_code) {
+ fileapi::FileSystemType type, base::File::Error* error_code) {
DCHECK(error_code);
- *error_code = base::PLATFORM_FILE_OK;
+ *error_code = base::File::FILE_OK;
return NULL;
}
fileapi::FileSystemOperation* FileSystemBackend::CreateFileSystemOperation(
const fileapi::FileSystemURL& url,
fileapi::FileSystemContext* context,
- base::PlatformFileError* error_code) const {
+ base::File::Error* error_code) const {
DCHECK(url.is_valid());
if (!IsAccessAllowed(url)) {
- *error_code = base::PLATFORM_FILE_ERROR_SECURITY;
+ *error_code = base::File::FILE_ERROR_SECURITY;
return NULL;
}
diff --git a/chrome/browser/chromeos/fileapi/file_system_backend.h b/chrome/browser/chromeos/fileapi/file_system_backend.h
index 4afbb1a8..83d9051 100644
--- a/chrome/browser/chromeos/fileapi/file_system_backend.h
+++ b/chrome/browser/chromeos/fileapi/file_system_backend.h
@@ -100,11 +100,11 @@
virtual fileapi::CopyOrMoveFileValidatorFactory*
GetCopyOrMoveFileValidatorFactory(
fileapi::FileSystemType type,
- base::PlatformFileError* error_code) OVERRIDE;
+ base::File::Error* error_code) OVERRIDE;
virtual fileapi::FileSystemOperation* CreateFileSystemOperation(
const fileapi::FileSystemURL& url,
fileapi::FileSystemContext* context,
- base::PlatformFileError* error_code) const OVERRIDE;
+ base::File::Error* error_code) const OVERRIDE;
virtual scoped_ptr<webkit_blob::FileStreamReader> CreateFileStreamReader(
const fileapi::FileSystemURL& path,
int64 offset,
diff --git a/chrome/browser/devtools/devtools_file_system_indexer.cc b/chrome/browser/devtools/devtools_file_system_indexer.cc
index b5826e4e..9a281db 100644
--- a/chrome/browser/devtools/devtools_file_system_indexer.cc
+++ b/chrome/browser/devtools/devtools_file_system_indexer.cc
@@ -27,7 +27,6 @@
using base::TimeTicks;
using base::PassPlatformFile;
using base::PlatformFile;
-using base::PlatformFileError;
using content::BrowserThread;
using std::map;
using std::set;
@@ -346,10 +345,10 @@
}
void DevToolsFileSystemIndexer::FileSystemIndexingJob::StartFileIndexing(
- PlatformFileError error,
+ base::File::Error error,
PassPlatformFile pass_file,
bool) {
- if (error != base::PLATFORM_FILE_OK) {
+ if (error != base::File::FILE_OK) {
current_file_ = base::kInvalidPlatformFileValue;
FinishFileIndexing(false);
return;
@@ -375,10 +374,10 @@
}
void DevToolsFileSystemIndexer::FileSystemIndexingJob::OnRead(
- PlatformFileError error,
+ base::File::Error error,
const char* data,
int bytes_read) {
- if (error != base::PLATFORM_FILE_OK) {
+ if (error != base::File::FILE_OK) {
FinishFileIndexing(false);
return;
}
@@ -435,7 +434,7 @@
}
void DevToolsFileSystemIndexer::FileSystemIndexingJob::CloseCallback(
- PlatformFileError error) {}
+ base::File::Error error) {}
void DevToolsFileSystemIndexer::FileSystemIndexingJob::ReportWorked() {
TimeTicks current_time = TimeTicks::Now();
diff --git a/chrome/browser/devtools/devtools_file_system_indexer.h b/chrome/browser/devtools/devtools_file_system_indexer.h
index 5822e582..2f13226 100644
--- a/chrome/browser/devtools/devtools_file_system_indexer.h
+++ b/chrome/browser/devtools/devtools_file_system_indexer.h
@@ -10,6 +10,7 @@
#include <vector>
#include "base/callback.h"
+#include "base/files/file.h"
#include "base/memory/ref_counted.h"
#include "base/platform_file.h"
@@ -51,16 +52,16 @@
void StopOnFileThread();
void CollectFilesToIndex();
void IndexFiles();
- void StartFileIndexing(base::PlatformFileError error,
+ void StartFileIndexing(base::File::Error error,
base::PassPlatformFile pass_file,
bool);
void ReadFromFile();
- void OnRead(base::PlatformFileError error,
+ void OnRead(base::File::Error error,
const char* data,
int bytes_read);
void FinishFileIndexing(bool success);
void CloseFile();
- void CloseCallback(base::PlatformFileError error);
+ void CloseCallback(base::File::Error error);
void ReportWorked();
base::FilePath file_system_path_;
diff --git a/chrome/browser/extensions/api/developer_private/developer_private_api.cc b/chrome/browser/extensions/api/developer_private/developer_private_api.cc
index a8a0eba..7b3a8bb 100644
--- a/chrome/browser/extensions/api/developer_private/developer_private_api.cc
+++ b/chrome/browser/extensions/api/developer_private/developer_private_api.cc
@@ -1054,11 +1054,11 @@
void DeveloperPrivateLoadDirectoryFunction::ReadSyncFileSystemDirectoryCb(
const base::FilePath& project_path,
const base::FilePath& destination_path,
- base::PlatformFileError status,
+ base::File::Error status,
const fileapi::FileSystemOperation::FileEntryList& file_list,
bool has_more) {
- if (status != base::PLATFORM_FILE_OK) {
+ if (status != base::File::FILE_OK) {
DLOG(ERROR) << "Error in copying files from sync filesystem.";
return;
}
@@ -1108,11 +1108,11 @@
void DeveloperPrivateLoadDirectoryFunction::SnapshotFileCallback(
const base::FilePath& target_path,
- base::PlatformFileError result,
- const base::PlatformFileInfo& file_info,
+ base::File::Error result,
+ const base::File::Info& file_info,
const base::FilePath& src_path,
const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref) {
- if (result != base::PLATFORM_FILE_OK) {
+ if (result != base::File::FILE_OK) {
SetError("Error in copying files from sync filesystem.");
success_ = false;
return;
diff --git a/chrome/browser/extensions/api/developer_private/developer_private_api.h b/chrome/browser/extensions/api/developer_private/developer_private_api.h
index 366c98f..ee1b455 100644
--- a/chrome/browser/extensions/api/developer_private/developer_private_api.h
+++ b/chrome/browser/extensions/api/developer_private/developer_private_api.h
@@ -5,7 +5,7 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_DEVELOPER_PRIVATE_DEVELOPER_PRIVATE_API_H_
#define CHROME_BROWSER_EXTENSIONS_API_DEVELOPER_PRIVATE_DEVELOPER_PRIVATE_API_H_
-#include "base/platform_file.h"
+#include "base/files/file.h"
#include "chrome/browser/extensions/api/developer_private/entry_picker.h"
#include "chrome/browser/extensions/api/file_system/file_system_api.h"
#include "chrome/browser/extensions/chrome_extension_function.h"
@@ -388,14 +388,14 @@
void ReadSyncFileSystemDirectoryCb(
const base::FilePath& project_path,
const base::FilePath& destination_path,
- base::PlatformFileError result,
+ base::File::Error result,
const fileapi::FileSystemOperation::FileEntryList& file_list,
bool has_more);
void SnapshotFileCallback(
const base::FilePath& target_path,
- base::PlatformFileError result,
- const base::PlatformFileInfo& file_info,
+ base::File::Error result,
+ const base::File::Info& file_info,
const base::FilePath& platform_path,
const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref);
diff --git a/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc b/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc
index 59f75a4..49f857c 100644
--- a/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc
+++ b/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc
@@ -731,9 +731,9 @@
private:
static void CopyInCompletion(bool* result,
base::WaitableEvent* done_event,
- base::PlatformFileError error) {
+ base::File::Error error) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- *result = error == base::PLATFORM_FILE_OK;
+ *result = error == base::File::FILE_OK;
done_event->Signal();
}
diff --git a/chrome/browser/extensions/api/sync_file_system/sync_file_system_api.cc b/chrome/browser/extensions/api/sync_file_system/sync_file_system_api.cc
index dd1036f..41f0597 100644
--- a/chrome/browser/extensions/api/sync_file_system/sync_file_system_api.cc
+++ b/chrome/browser/extensions/api/sync_file_system/sync_file_system_api.cc
@@ -90,7 +90,7 @@
}
void SyncFileSystemDeleteFileSystemFunction::DidDeleteFileSystem(
- base::PlatformFileError error) {
+ base::File::Error error) {
// Repost to switch from IO thread to UI thread for SendResponse().
if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
@@ -103,9 +103,8 @@
}
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- if (error != base::PLATFORM_FILE_OK) {
- error_ = ErrorToString(
- sync_file_system::PlatformFileErrorToSyncStatusCode(error));
+ if (error != base::File::FILE_OK) {
+ error_ = ErrorToString(sync_file_system::FileErrorToSyncStatusCode(error));
SetResult(new base::FundamentalValue(false));
SendResponse(false);
return;
@@ -145,7 +144,7 @@
void SyncFileSystemRequestFileSystemFunction::DidOpenFileSystem(
const GURL& root_url,
const std::string& file_system_name,
- base::PlatformFileError error) {
+ base::File::Error error) {
// Repost to switch from IO thread to UI thread for SendResponse().
if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
@@ -157,9 +156,8 @@
}
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- if (error != base::PLATFORM_FILE_OK) {
- error_ = ErrorToString(
- sync_file_system::PlatformFileErrorToSyncStatusCode(error));
+ if (error != base::File::FILE_OK) {
+ error_ = ErrorToString(sync_file_system::FileErrorToSyncStatusCode(error));
SendResponse(false);
return;
}
diff --git a/chrome/browser/extensions/api/sync_file_system/sync_file_system_api.h b/chrome/browser/extensions/api/sync_file_system/sync_file_system_api.h
index 92aed63..68c9d78 100644
--- a/chrome/browser/extensions/api/sync_file_system/sync_file_system_api.h
+++ b/chrome/browser/extensions/api/sync_file_system/sync_file_system_api.h
@@ -35,7 +35,7 @@
virtual bool RunImpl() OVERRIDE;
private:
- void DidDeleteFileSystem(base::PlatformFileError error);
+ void DidDeleteFileSystem(base::File::Error error);
};
class SyncFileSystemGetFileStatusFunction
@@ -115,7 +115,7 @@
void DidOpenFileSystem(const GURL& root_url,
const std::string& file_system_name,
- base::PlatformFileError error);
+ base::File::Error error);
};
class SyncFileSystemSetConflictResolutionPolicyFunction
diff --git a/chrome/browser/local_discovery/storage/privet_filesystem_async_util.cc b/chrome/browser/local_discovery/storage/privet_filesystem_async_util.cc
index 8004e38..c010b21 100644
--- a/chrome/browser/local_discovery/storage/privet_filesystem_async_util.cc
+++ b/chrome/browser/local_discovery/storage/privet_filesystem_async_util.cc
@@ -16,7 +16,7 @@
int file_flags,
const CreateOrOpenCallback& callback) {
NOTIMPLEMENTED();
- callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION,
+ callback.Run(base::File::FILE_ERROR_INVALID_OPERATION,
base::PassPlatformFile(NULL),
base::Closure());
}
@@ -26,8 +26,7 @@
const fileapi::FileSystemURL& url,
const EnsureFileExistsCallback& callback) {
NOTIMPLEMENTED();
- callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION,
- false);
+ callback.Run(base::File::FILE_ERROR_INVALID_OPERATION, false);
}
void PrivetFileSystemAsyncUtil::CreateDirectory(
@@ -37,14 +36,14 @@
bool recursive,
const StatusCallback& callback) {
NOTIMPLEMENTED();
- callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION);
+ callback.Run(base::File::FILE_ERROR_INVALID_OPERATION);
}
void PrivetFileSystemAsyncUtil::GetFileInfo(
scoped_ptr<fileapi::FileSystemOperationContext> context,
const fileapi::FileSystemURL& url,
const GetFileInfoCallback& callback) {
- base::PlatformFileInfo file_info;
+ base::File::Info file_info;
if (url.path() == base::FilePath(FILE_PATH_LITERAL("/privet"))) {
file_info.size = 20;
@@ -55,8 +54,7 @@
file_info.is_directory = false;
file_info.is_symbolic_link = false;
}
- callback.Run(base::PLATFORM_FILE_OK,
- file_info);
+ callback.Run(base::File::FILE_OK, file_info);
}
void PrivetFileSystemAsyncUtil::ReadDirectory(
@@ -71,7 +69,7 @@
base::Time());
entry_list.push_back(entry);
- callback.Run(base::PLATFORM_FILE_OK, entry_list, false);
+ callback.Run(base::File::FILE_OK, entry_list, false);
}
void PrivetFileSystemAsyncUtil::Touch(
@@ -81,7 +79,7 @@
const base::Time& last_modified_time,
const StatusCallback& callback) {
NOTIMPLEMENTED();
- callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION);
+ callback.Run(base::File::FILE_ERROR_INVALID_OPERATION);
}
void PrivetFileSystemAsyncUtil::Truncate(
@@ -90,7 +88,7 @@
int64 length,
const StatusCallback& callback) {
NOTIMPLEMENTED();
- callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION);
+ callback.Run(base::File::FILE_ERROR_INVALID_OPERATION);
}
void PrivetFileSystemAsyncUtil::CopyFileLocal(
@@ -101,7 +99,7 @@
const CopyFileProgressCallback& progress_callback,
const StatusCallback& callback) {
NOTIMPLEMENTED();
- callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION);
+ callback.Run(base::File::FILE_ERROR_INVALID_OPERATION);
}
void PrivetFileSystemAsyncUtil::MoveFileLocal(
@@ -111,7 +109,7 @@
CopyOrMoveOption option,
const StatusCallback& callback) {
NOTIMPLEMENTED();
- callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION);
+ callback.Run(base::File::FILE_ERROR_INVALID_OPERATION);
}
void PrivetFileSystemAsyncUtil::CopyInForeignFile(
@@ -120,7 +118,7 @@
const fileapi::FileSystemURL& dest_url,
const StatusCallback& callback) {
NOTIMPLEMENTED();
- callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION);
+ callback.Run(base::File::FILE_ERROR_INVALID_OPERATION);
}
void PrivetFileSystemAsyncUtil::DeleteFile(
@@ -128,7 +126,7 @@
const fileapi::FileSystemURL& url,
const StatusCallback& callback) {
NOTIMPLEMENTED();
- callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION);
+ callback.Run(base::File::FILE_ERROR_INVALID_OPERATION);
}
void PrivetFileSystemAsyncUtil::DeleteDirectory(
@@ -136,7 +134,7 @@
const fileapi::FileSystemURL& url,
const StatusCallback& callback) {
NOTIMPLEMENTED();
- callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION);
+ callback.Run(base::File::FILE_ERROR_INVALID_OPERATION);
}
void PrivetFileSystemAsyncUtil::DeleteRecursively(
@@ -144,7 +142,7 @@
const fileapi::FileSystemURL& url,
const StatusCallback& callback) {
NOTIMPLEMENTED();
- callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION);
+ callback.Run(base::File::FILE_ERROR_INVALID_OPERATION);
}
void PrivetFileSystemAsyncUtil::CreateSnapshotFile(
@@ -152,8 +150,8 @@
const fileapi::FileSystemURL& url,
const CreateSnapshotFileCallback& callback) {
NOTIMPLEMENTED();
- callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION,
- base::PlatformFileInfo(),
+ callback.Run(base::File::FILE_ERROR_INVALID_OPERATION,
+ base::File::Info(),
base::FilePath(),
scoped_refptr<webkit_blob::ShareableFileReference>());
}
diff --git a/chrome/browser/local_discovery/storage/privet_filesystem_backend.cc b/chrome/browser/local_discovery/storage/privet_filesystem_backend.cc
index 00a54f5..390518f 100644
--- a/chrome/browser/local_discovery/storage/privet_filesystem_backend.cc
+++ b/chrome/browser/local_discovery/storage/privet_filesystem_backend.cc
@@ -42,7 +42,7 @@
// Copied from src/chrome/browser/chromeos/fileapi/file_system_backend.cc
// This is deprecated for non-sandboxed filesystems.
NOTREACHED();
- callback.Run(GURL(), std::string(), base::PLATFORM_FILE_ERROR_SECURITY);
+ callback.Run(GURL(), std::string(), base::File::FILE_ERROR_SECURITY);
}
fileapi::FileSystemQuotaUtil* PrivetFileSystemBackend::GetQuotaUtil() {
@@ -57,9 +57,9 @@
fileapi::CopyOrMoveFileValidatorFactory*
PrivetFileSystemBackend::GetCopyOrMoveFileValidatorFactory(
- fileapi::FileSystemType type, base::PlatformFileError* error_code) {
+ fileapi::FileSystemType type, base::File::Error* error_code) {
DCHECK(error_code);
- *error_code = base::PLATFORM_FILE_OK;
+ *error_code = base::File::FILE_OK;
return NULL;
}
@@ -67,7 +67,7 @@
PrivetFileSystemBackend::CreateFileSystemOperation(
const fileapi::FileSystemURL& url,
fileapi::FileSystemContext* context,
- base::PlatformFileError* error_code) const {
+ base::File::Error* error_code) const {
return fileapi::FileSystemOperation::Create(
url, context,
make_scoped_ptr(new fileapi::FileSystemOperationContext(context)));
diff --git a/chrome/browser/local_discovery/storage/privet_filesystem_backend.h b/chrome/browser/local_discovery/storage/privet_filesystem_backend.h
index 3e93684..eb12051 100644
--- a/chrome/browser/local_discovery/storage/privet_filesystem_backend.h
+++ b/chrome/browser/local_discovery/storage/privet_filesystem_backend.h
@@ -38,12 +38,12 @@
virtual fileapi::CopyOrMoveFileValidatorFactory*
GetCopyOrMoveFileValidatorFactory(
fileapi::FileSystemType type,
- base::PlatformFileError* error_code) OVERRIDE;
+ base::File::Error* error_code) OVERRIDE;
virtual fileapi::FileSystemOperation* CreateFileSystemOperation(
const fileapi::FileSystemURL& url,
fileapi::FileSystemContext* context,
- base::PlatformFileError* error_code) const OVERRIDE;
+ base::File::Error* error_code) const OVERRIDE;
virtual scoped_ptr<webkit_blob::FileStreamReader> CreateFileStreamReader(
const fileapi::FileSystemURL& url,
diff --git a/chrome/browser/media_galleries/fileapi/av_scanning_file_validator.cc b/chrome/browser/media_galleries/fileapi/av_scanning_file_validator.cc
index 2541040..6c3100c 100644
--- a/chrome/browser/media_galleries/fileapi/av_scanning_file_validator.cc
+++ b/chrome/browser/media_galleries/fileapi/av_scanning_file_validator.cc
@@ -26,8 +26,7 @@
namespace {
#if defined(OS_WIN)
-base::PlatformFileError ScanFile(
- const base::FilePath& dest_platform_path) {
+base::File::Error ScanFile(const base::FilePath& dest_platform_path) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
base::win::ScopedComPtr<IAttachmentExecute> attachment_services;
@@ -36,20 +35,20 @@
if (FAILED(hr)) {
// The thread must have COM initialized.
DCHECK_NE(CO_E_NOTINITIALIZED, hr);
- return base::PLATFORM_FILE_ERROR_SECURITY;
+ return base::File::FILE_ERROR_SECURITY;
}
hr = attachment_services->SetLocalPath(dest_platform_path.value().c_str());
if (FAILED(hr))
- return base::PLATFORM_FILE_ERROR_SECURITY;
+ return base::File::FILE_ERROR_SECURITY;
// A failure in the Save() call below could result in the downloaded file
// being deleted.
HRESULT scan_result = attachment_services->Save();
if (scan_result == S_OK)
- return base::PLATFORM_FILE_OK;
+ return base::File::FILE_OK;
- return base::PLATFORM_FILE_ERROR_SECURITY;
+ return base::File::FILE_ERROR_SECURITY;
}
#endif
@@ -69,7 +68,7 @@
base::Bind(&ScanFile, dest_platform_path),
result_callback);
#else
- result_callback.Run(base::PLATFORM_FILE_OK);
+ result_callback.Run(base::File::FILE_OK);
#endif
}
diff --git a/chrome/browser/media_galleries/fileapi/device_media_async_file_util.cc b/chrome/browser/media_galleries/fileapi/device_media_async_file_util.cc
index cd49d9f..e28e3f3d5 100644
--- a/chrome/browser/media_galleries/fileapi/device_media_async_file_util.cc
+++ b/chrome/browser/media_galleries/fileapi/device_media_async_file_util.cc
@@ -79,7 +79,7 @@
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
NOTIMPLEMENTED();
base::PlatformFile invalid_file = base::kInvalidPlatformFileValue;
- callback.Run(base::PLATFORM_FILE_ERROR_SECURITY,
+ callback.Run(base::File::FILE_ERROR_SECURITY,
base::PassPlatformFile(&invalid_file),
base::Closure());
}
@@ -90,7 +90,7 @@
const EnsureFileExistsCallback& callback) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
NOTIMPLEMENTED();
- callback.Run(base::PLATFORM_FILE_ERROR_SECURITY, false);
+ callback.Run(base::File::FILE_ERROR_SECURITY, false);
}
void DeviceMediaAsyncFileUtil::CreateDirectory(
@@ -101,7 +101,7 @@
const StatusCallback& callback) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
NOTIMPLEMENTED();
- callback.Run(base::PLATFORM_FILE_ERROR_SECURITY);
+ callback.Run(base::File::FILE_ERROR_SECURITY);
}
void DeviceMediaAsyncFileUtil::GetFileInfo(
@@ -111,7 +111,7 @@
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
MTPDeviceAsyncDelegate* delegate = GetMTPDeviceDelegate(url);
if (!delegate) {
- OnGetFileInfoError(callback, base::PLATFORM_FILE_ERROR_NOT_FOUND);
+ OnGetFileInfoError(callback, base::File::FILE_ERROR_NOT_FOUND);
return;
}
delegate->GetFileInfo(
@@ -131,7 +131,7 @@
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
MTPDeviceAsyncDelegate* delegate = GetMTPDeviceDelegate(url);
if (!delegate) {
- OnReadDirectoryError(callback, base::PLATFORM_FILE_ERROR_NOT_FOUND);
+ OnReadDirectoryError(callback, base::File::FILE_ERROR_NOT_FOUND);
return;
}
delegate->ReadDirectory(
@@ -152,7 +152,7 @@
const StatusCallback& callback) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
NOTIMPLEMENTED();
- callback.Run(base::PLATFORM_FILE_ERROR_SECURITY);
+ callback.Run(base::File::FILE_ERROR_SECURITY);
}
void DeviceMediaAsyncFileUtil::Truncate(
@@ -162,7 +162,7 @@
const StatusCallback& callback) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
NOTIMPLEMENTED();
- callback.Run(base::PLATFORM_FILE_ERROR_SECURITY);
+ callback.Run(base::File::FILE_ERROR_SECURITY);
}
void DeviceMediaAsyncFileUtil::CopyFileLocal(
@@ -174,7 +174,7 @@
const StatusCallback& callback) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
NOTIMPLEMENTED();
- callback.Run(base::PLATFORM_FILE_ERROR_SECURITY);
+ callback.Run(base::File::FILE_ERROR_SECURITY);
}
void DeviceMediaAsyncFileUtil::MoveFileLocal(
@@ -185,7 +185,7 @@
const StatusCallback& callback) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
NOTIMPLEMENTED();
- callback.Run(base::PLATFORM_FILE_ERROR_SECURITY);
+ callback.Run(base::File::FILE_ERROR_SECURITY);
}
void DeviceMediaAsyncFileUtil::CopyInForeignFile(
@@ -195,7 +195,7 @@
const StatusCallback& callback) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
NOTIMPLEMENTED();
- callback.Run(base::PLATFORM_FILE_ERROR_SECURITY);
+ callback.Run(base::File::FILE_ERROR_SECURITY);
}
void DeviceMediaAsyncFileUtil::DeleteFile(
@@ -204,7 +204,7 @@
const StatusCallback& callback) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
NOTIMPLEMENTED();
- callback.Run(base::PLATFORM_FILE_ERROR_SECURITY);
+ callback.Run(base::File::FILE_ERROR_SECURITY);
}
void DeviceMediaAsyncFileUtil::DeleteDirectory(
@@ -213,7 +213,7 @@
const StatusCallback& callback) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
NOTIMPLEMENTED();
- callback.Run(base::PLATFORM_FILE_ERROR_SECURITY);
+ callback.Run(base::File::FILE_ERROR_SECURITY);
}
void DeviceMediaAsyncFileUtil::DeleteRecursively(
@@ -221,7 +221,7 @@
const FileSystemURL& url,
const StatusCallback& callback) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
- callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION);
+ callback.Run(base::File::FILE_ERROR_INVALID_OPERATION);
}
void DeviceMediaAsyncFileUtil::CreateSnapshotFile(
@@ -231,7 +231,7 @@
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
MTPDeviceAsyncDelegate* delegate = GetMTPDeviceDelegate(url);
if (!delegate) {
- OnCreateSnapshotFileError(callback, base::PLATFORM_FILE_ERROR_NOT_FOUND);
+ OnCreateSnapshotFileError(callback, base::File::FILE_ERROR_NOT_FOUND);
return;
}
@@ -285,33 +285,33 @@
void DeviceMediaAsyncFileUtil::OnDidGetFileInfo(
const AsyncFileUtil::GetFileInfoCallback& callback,
- const base::PlatformFileInfo& file_info) {
- callback.Run(base::PLATFORM_FILE_OK, file_info);
+ const base::File::Info& file_info) {
+ callback.Run(base::File::FILE_OK, file_info);
}
void DeviceMediaAsyncFileUtil::OnGetFileInfoError(
const AsyncFileUtil::GetFileInfoCallback& callback,
- base::PlatformFileError error) {
- callback.Run(error, base::PlatformFileInfo());
+ base::File::Error error) {
+ callback.Run(error, base::File::Info());
}
void DeviceMediaAsyncFileUtil::OnDidReadDirectory(
const AsyncFileUtil::ReadDirectoryCallback& callback,
const AsyncFileUtil::EntryList& file_list,
bool has_more) {
- callback.Run(base::PLATFORM_FILE_OK, file_list, has_more);
+ callback.Run(base::File::FILE_OK, file_list, has_more);
}
void DeviceMediaAsyncFileUtil::OnReadDirectoryError(
const AsyncFileUtil::ReadDirectoryCallback& callback,
- base::PlatformFileError error) {
+ base::File::Error error) {
callback.Run(error, AsyncFileUtil::EntryList(), false /*no more*/);
}
void DeviceMediaAsyncFileUtil::OnDidCreateSnapshotFile(
const AsyncFileUtil::CreateSnapshotFileCallback& callback,
base::SequencedTaskRunner* media_task_runner,
- const base::PlatformFileInfo& file_info,
+ const base::File::Info& file_info,
const base::FilePath& platform_path) {
base::PostTaskAndReplyWithResult(
media_task_runner,
@@ -329,11 +329,11 @@
void DeviceMediaAsyncFileUtil::OnDidCheckMedia(
const AsyncFileUtil::CreateSnapshotFileCallback& callback,
- const base::PlatformFileInfo& file_info,
+ const base::File::Info& file_info,
scoped_refptr<webkit_blob::ShareableFileReference> platform_file,
- base::PlatformFileError error) {
+ base::File::Error error) {
base::FilePath platform_path(platform_file.get()->path());
- if (error != base::PLATFORM_FILE_OK)
+ if (error != base::File::FILE_OK)
platform_file = NULL;
callback.Run(error, file_info, platform_path, platform_file);
}
@@ -342,11 +342,11 @@
const fileapi::FileSystemURL& url,
base::SequencedTaskRunner* media_task_runner,
const AsyncFileUtil::CreateSnapshotFileCallback& callback,
- base::PlatformFileError error,
- const base::PlatformFileInfo& file_info) {
+ base::File::Error error,
+ const base::File::Info& file_info) {
MTPDeviceAsyncDelegate* delegate = GetMTPDeviceDelegate(url);
if (!delegate) {
- OnCreateSnapshotFileError(callback, base::PLATFORM_FILE_ERROR_NOT_FOUND);
+ OnCreateSnapshotFileError(callback, base::File::FILE_ERROR_NOT_FOUND);
return;
}
@@ -368,23 +368,23 @@
const fileapi::FileSystemURL& url,
base::SequencedTaskRunner* media_task_runner,
const AsyncFileUtil::CreateSnapshotFileCallback& callback,
- const base::PlatformFileInfo& file_info,
+ const base::File::Info& file_info,
net::IOBuffer* buffer,
int buffer_size) {
- base::PlatformFileError error =
+ base::File::Error error =
NativeMediaFileUtil::BufferIsMediaHeader(buffer, buffer_size);
- if (error != base::PLATFORM_FILE_OK) {
+ if (error != base::File::FILE_OK) {
OnCreateSnapshotFileError(callback, error);
return;
}
- callback.Run(base::PLATFORM_FILE_OK, file_info, base::FilePath(),
+ callback.Run(base::File::FILE_OK, file_info, base::FilePath(),
scoped_refptr<ShareableFileReference>());
}
void DeviceMediaAsyncFileUtil::OnCreateSnapshotFileError(
const AsyncFileUtil::CreateSnapshotFileCallback& callback,
- base::PlatformFileError error) {
- callback.Run(error, base::PlatformFileInfo(), base::FilePath(),
+ base::File::Error error) {
+ callback.Run(error, base::File::Info(), base::FilePath(),
scoped_refptr<ShareableFileReference>());
}
@@ -395,12 +395,12 @@
base::FilePath* snapshot_file_path) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
if (!snapshot_file_path || snapshot_file_path->empty()) {
- OnCreateSnapshotFileError(callback, base::PLATFORM_FILE_ERROR_FAILED);
+ OnCreateSnapshotFileError(callback, base::File::FILE_ERROR_FAILED);
return;
}
MTPDeviceAsyncDelegate* delegate = GetMTPDeviceDelegate(url);
if (!delegate) {
- OnCreateSnapshotFileError(callback, base::PLATFORM_FILE_ERROR_NOT_FOUND);
+ OnCreateSnapshotFileError(callback, base::File::FILE_ERROR_NOT_FOUND);
return;
}
delegate->CreateSnapshotFile(
diff --git a/chrome/browser/media_galleries/fileapi/device_media_async_file_util.h b/chrome/browser/media_galleries/fileapi/device_media_async_file_util.h
index 979965e..9b45756 100644
--- a/chrome/browser/media_galleries/fileapi/device_media_async_file_util.h
+++ b/chrome/browser/media_galleries/fileapi/device_media_async_file_util.h
@@ -5,10 +5,10 @@
#ifndef CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_DEVICE_MEDIA_ASYNC_FILE_UTIL_H_
#define CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_DEVICE_MEDIA_ASYNC_FILE_UTIL_H_
+#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
-#include "base/platform_file.h"
#include "webkit/browser/fileapi/async_file_util.h"
#include "webkit/common/blob/shareable_file_reference.h"
@@ -129,14 +129,14 @@
// GetFileInfo request.
void OnDidGetFileInfo(
const AsyncFileUtil::GetFileInfoCallback& callback,
- const base::PlatformFileInfo& file_info);
+ const base::File::Info& file_info);
// Called when GetFileInfo method call failed to get the details of file
// specified by the requested url. |callback| is invoked to notify the
// caller about the platform file |error|.
void OnGetFileInfoError(
const AsyncFileUtil::GetFileInfoCallback& callback,
- base::PlatformFileError error);
+ base::File::Error error);
// Called when ReadDirectory method call succeeds. |callback| is invoked to
// complete the ReadDirectory request.
@@ -159,7 +159,7 @@
// that occured while reading the directory objects.
void OnReadDirectoryError(
const AsyncFileUtil::ReadDirectoryCallback& callback,
- base::PlatformFileError error);
+ base::File::Error error);
// Called when the snapshot file specified by the |platform_path| is
// successfully created. |file_info| contains the device media file details
@@ -167,16 +167,16 @@
void OnDidCreateSnapshotFile(
const AsyncFileUtil::CreateSnapshotFileCallback& callback,
base::SequencedTaskRunner* media_task_runner,
- const base::PlatformFileInfo& file_info,
+ const base::File::Info& file_info,
const base::FilePath& platform_path);
// Called after OnDidCreateSnapshotFile finishes media check.
// |callback| is invoked to complete the CreateSnapshotFile request.
void OnDidCheckMedia(
const AsyncFileUtil::CreateSnapshotFileCallback& callback,
- const base::PlatformFileInfo& file_info,
+ const base::File::Info& file_info,
scoped_refptr<webkit_blob::ShareableFileReference> platform_file,
- base::PlatformFileError error);
+ base::File::Error error);
// The following three functions are called in sequence when we have a
// streaming MTP implementation and don't need a local snapshot file to be
@@ -185,13 +185,13 @@
const fileapi::FileSystemURL& url,
base::SequencedTaskRunner* media_task_runner,
const AsyncFileUtil::CreateSnapshotFileCallback& callback,
- base::PlatformFileError error,
- const base::PlatformFileInfo& file_info);
+ base::File::Error error,
+ const base::File::Info& file_info);
void FinishStreamingSnapshotFile(
const fileapi::FileSystemURL& url,
base::SequencedTaskRunner* media_task_runner,
const AsyncFileUtil::CreateSnapshotFileCallback& callback,
- const base::PlatformFileInfo& file_info,
+ const base::File::Info& file_info,
net::IOBuffer* buffer,
int buffer_size);
@@ -199,7 +199,7 @@
// notify the caller about the |error|.
void OnCreateSnapshotFileError(
const AsyncFileUtil::CreateSnapshotFileCallback& callback,
- base::PlatformFileError error);
+ base::File::Error error);
// Called when the snapshot file specified by the |snapshot_file_path| is
// created to hold the contents of the url.path(). If the snapshot
diff --git a/chrome/browser/media_galleries/fileapi/iphoto_file_util.cc b/chrome/browser/media_galleries/fileapi/iphoto_file_util.cc
index 765fba1..f355957 100644
--- a/chrome/browser/media_galleries/fileapi/iphoto_file_util.cc
+++ b/chrome/browser/media_galleries/fileapi/iphoto_file_util.cc
@@ -29,12 +29,11 @@
namespace {
-base::PlatformFileError MakeDirectoryFileInfo(
- base::PlatformFileInfo* file_info) {
- base::PlatformFileInfo result;
+base::File::Error MakeDirectoryFileInfo(base::File::Info* file_info) {
+ base::File::Info result;
result.is_directory = true;
*file_info = result;
- return base::PLATFORM_FILE_OK;
+ return base::File::FILE_OK;
}
template <typename T>
@@ -102,8 +101,7 @@
content::BrowserThread::PostTask(
content::BrowserThread::IO,
FROM_HERE,
- base::Bind(callback, base::PLATFORM_FILE_ERROR_IO,
- base::PlatformFileInfo()));
+ base::Bind(callback, base::File::FILE_ERROR_IO, base::File::Info()));
}
return;
}
@@ -121,8 +119,7 @@
content::BrowserThread::PostTask(
content::BrowserThread::IO,
FROM_HERE,
- base::Bind(callback, base::PLATFORM_FILE_ERROR_IO, EntryList(),
- false));
+ base::Bind(callback, base::File::FILE_ERROR_IO, EntryList(), false));
}
return;
}
@@ -137,13 +134,13 @@
bool valid_parse) {
if (!valid_parse) {
if (!callback.is_null()) {
- base::PlatformFileInfo file_info;
+ base::File::Info file_info;
base::FilePath platform_path;
scoped_refptr<webkit_blob::ShareableFileReference> file_ref;
content::BrowserThread::PostTask(
content::BrowserThread::IO,
FROM_HERE,
- base::Bind(callback, base::PLATFORM_FILE_ERROR_IO, file_info,
+ base::Bind(callback, base::File::FILE_ERROR_IO, file_info,
platform_path, file_ref));
}
return;
@@ -154,10 +151,10 @@
// Begin actual implementation.
-base::PlatformFileError IPhotoFileUtil::GetFileInfoSync(
+base::File::Error IPhotoFileUtil::GetFileInfoSync(
fileapi::FileSystemOperationContext* context,
const fileapi::FileSystemURL& url,
- base::PlatformFileInfo* file_info,
+ base::File::Info* file_info,
base::FilePath* platform_path) {
std::vector<std::string> components;
fileapi::VirtualPath::GetComponentsUTF8Unsafe(url.path(), &components);
@@ -180,7 +177,7 @@
if (GetDataProvider()->HasOriginals(components[1]))
return MakeDirectoryFileInfo(file_info);
else
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ return base::File::FILE_ERROR_NOT_FOUND;
}
base::FilePath location = GetDataProvider()->GetPhotoLocationInAlbum(
@@ -201,10 +198,10 @@
}
}
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ return base::File::FILE_ERROR_NOT_FOUND;
}
-base::PlatformFileError IPhotoFileUtil::ReadDirectorySync(
+base::File::Error IPhotoFileUtil::ReadDirectorySync(
fileapi::FileSystemOperationContext* context,
const fileapi::FileSystemURL& url,
EntryList* file_list) {
@@ -217,7 +214,7 @@
file_list->push_back(DirectoryEntry(kIPhotoAlbumsDir,
DirectoryEntry::DIRECTORY,
0, base::Time()));
- return base::PLATFORM_FILE_OK;
+ return base::File::FILE_OK;
}
if (components[0] == kIPhotoAlbumsDir) {
@@ -230,12 +227,12 @@
file_list->push_back(DirectoryEntry(*it, DirectoryEntry::DIRECTORY,
0, base::Time()));
}
- return base::PLATFORM_FILE_OK;
+ return base::File::FILE_OK;
} else if (components.size() == 2) {
std::vector<std::string> albums =
GetDataProvider()->GetAlbumNames();
if (!ContainsElement(albums, components[1]))
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ return base::File::FILE_ERROR_NOT_FOUND;
// Album dirs contain all photos in them.
if (GetDataProvider()->HasOriginals(components[1])) {
@@ -250,11 +247,11 @@
it != locations.end(); it++) {
base::File::Info info;
if (!base::GetFileInfo(it->second, &info))
- return base::PLATFORM_FILE_ERROR_IO;
+ return base::File::FILE_ERROR_IO;
file_list->push_back(DirectoryEntry(it->first, DirectoryEntry::FILE,
info.size, info.last_modified));
}
- return base::PLATFORM_FILE_OK;
+ return base::File::FILE_OK;
} else if (components.size() == 3 &&
components[2] == kIPhotoOriginalsDir &&
GetDataProvider()->HasOriginals(components[1])) {
@@ -265,31 +262,31 @@
it != originals.end(); it++) {
base::File::Info info;
if (!base::GetFileInfo(it->second, &info))
- return base::PLATFORM_FILE_ERROR_IO;
+ return base::File::FILE_ERROR_IO;
file_list->push_back(DirectoryEntry(it->first, DirectoryEntry::FILE,
info.size, info.last_modified));
}
- return base::PLATFORM_FILE_OK;
+ return base::File::FILE_OK;
}
}
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ return base::File::FILE_ERROR_NOT_FOUND;
}
-base::PlatformFileError IPhotoFileUtil::DeleteDirectorySync(
+base::File::Error IPhotoFileUtil::DeleteDirectorySync(
fileapi::FileSystemOperationContext* context,
const fileapi::FileSystemURL& url) {
- return base::PLATFORM_FILE_ERROR_SECURITY;
+ return base::File::FILE_ERROR_SECURITY;
}
-base::PlatformFileError IPhotoFileUtil::DeleteFileSync(
+base::File::Error IPhotoFileUtil::DeleteFileSync(
fileapi::FileSystemOperationContext* context,
const fileapi::FileSystemURL& url) {
- return base::PLATFORM_FILE_ERROR_SECURITY;
+ return base::File::FILE_ERROR_SECURITY;
}
-base::PlatformFileError IPhotoFileUtil::GetLocalFilePath(
+base::File::Error IPhotoFileUtil::GetLocalFilePath(
fileapi::FileSystemOperationContext* context,
const fileapi::FileSystemURL& url,
base::FilePath* local_file_path) {
@@ -301,7 +298,7 @@
components[1], components[2]);
if (!location.empty()) {
*local_file_path = location;
- return base::PLATFORM_FILE_OK;
+ return base::File::FILE_OK;
}
}
@@ -312,11 +309,11 @@
components[1], components[3]);
if (!location.empty()) {
*local_file_path = location;
- return base::PLATFORM_FILE_OK;
+ return base::File::FILE_OK;
}
}
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ return base::File::FILE_ERROR_NOT_FOUND;
}
IPhotoDataProvider* IPhotoFileUtil::GetDataProvider() {
diff --git a/chrome/browser/media_galleries/fileapi/iphoto_file_util.h b/chrome/browser/media_galleries/fileapi/iphoto_file_util.h
index 75de389c..421373ff 100644
--- a/chrome/browser/media_galleries/fileapi/iphoto_file_util.h
+++ b/chrome/browser/media_galleries/fileapi/iphoto_file_util.h
@@ -48,22 +48,22 @@
scoped_ptr<fileapi::FileSystemOperationContext> context,
const fileapi::FileSystemURL& url,
const CreateSnapshotFileCallback& callback) OVERRIDE;
- virtual base::PlatformFileError GetFileInfoSync(
+ virtual base::File::Error GetFileInfoSync(
fileapi::FileSystemOperationContext* context,
const fileapi::FileSystemURL& url,
- base::PlatformFileInfo* file_info,
+ base::File::Info* file_info,
base::FilePath* platform_path) OVERRIDE;
- virtual base::PlatformFileError ReadDirectorySync(
+ virtual base::File::Error ReadDirectorySync(
fileapi::FileSystemOperationContext* context,
const fileapi::FileSystemURL& url,
EntryList* file_list) OVERRIDE;
- virtual base::PlatformFileError DeleteDirectorySync(
+ virtual base::File::Error DeleteDirectorySync(
fileapi::FileSystemOperationContext* context,
const fileapi::FileSystemURL& url) OVERRIDE;
- virtual base::PlatformFileError DeleteFileSync(
+ virtual base::File::Error DeleteFileSync(
fileapi::FileSystemOperationContext* context,
const fileapi::FileSystemURL& url) OVERRIDE;
- virtual base::PlatformFileError GetLocalFilePath(
+ virtual base::File::Error GetLocalFilePath(
fileapi::FileSystemOperationContext* context,
const fileapi::FileSystemURL& url,
base::FilePath* local_file_path) OVERRIDE;
diff --git a/chrome/browser/media_galleries/fileapi/iphoto_file_util_unittest.cc b/chrome/browser/media_galleries/fileapi/iphoto_file_util_unittest.cc
index 1233aaf..1ea2eda 100644
--- a/chrome/browser/media_galleries/fileapi/iphoto_file_util_unittest.cc
+++ b/chrome/browser/media_galleries/fileapi/iphoto_file_util_unittest.cc
@@ -41,11 +41,11 @@
base::RunLoop* run_loop,
FileSystemOperation::FileEntryList* contents,
bool* completed,
- base::PlatformFileError error,
+ base::File::Error error,
const FileSystemOperation::FileEntryList& file_list,
bool has_more) {
DCHECK(!*completed);
- *completed = !has_more && error == base::PLATFORM_FILE_OK;
+ *completed = !has_more && error == base::File::FILE_OK;
*contents = file_list;
run_loop->Quit();
}
diff --git a/chrome/browser/media_galleries/fileapi/itunes_file_util.cc b/chrome/browser/media_galleries/fileapi/itunes_file_util.cc
index b8c45c8..07371f5 100644
--- a/chrome/browser/media_galleries/fileapi/itunes_file_util.cc
+++ b/chrome/browser/media_galleries/fileapi/itunes_file_util.cc
@@ -27,12 +27,11 @@
namespace {
-base::PlatformFileError MakeDirectoryFileInfo(
- base::PlatformFileInfo* file_info) {
- base::PlatformFileInfo result;
+base::File::Error MakeDirectoryFileInfo(base::File::Info* file_info) {
+ base::File::Info result;
result.is_directory = true;
*file_info = result;
- return base::PLATFORM_FILE_OK;
+ return base::File::FILE_OK;
}
} // namespace
@@ -87,10 +86,10 @@
// /iTunes Media/Automatically Add to iTunes - auto-import directory
// /iTunes Media/Music/<Artist>/<Album>/<Track> - tracks
//
-base::PlatformFileError ITunesFileUtil::GetFileInfoSync(
+base::File::Error ITunesFileUtil::GetFileInfoSync(
fileapi::FileSystemOperationContext* context,
const fileapi::FileSystemURL& url,
- base::PlatformFileInfo* file_info,
+ base::File::Info* file_info,
base::FilePath* platform_path) {
std::vector<std::string> components;
fileapi::VirtualPath::GetComponentsUTF8Unsafe(url.path(), &components);
@@ -109,11 +108,11 @@
}
if (components[0] != kITunesMediaDir)
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ return base::File::FILE_ERROR_NOT_FOUND;
if (components[1] == kITunesAutoAddDir) {
if (GetDataProvider()->auto_add_path().empty())
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ return base::File::FILE_ERROR_NOT_FOUND;
return NativeMediaFileUtil::GetFileInfoSync(context, url, file_info,
platform_path);
}
@@ -146,10 +145,10 @@
}
}
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ return base::File::FILE_ERROR_NOT_FOUND;
}
-base::PlatformFileError ITunesFileUtil::ReadDirectorySync(
+base::File::Error ITunesFileUtil::ReadDirectorySync(
fileapi::FileSystemOperationContext* context,
const fileapi::FileSystemURL& url,
EntryList* file_list) {
@@ -160,21 +159,21 @@
if (components.size() == 0) {
base::File::Info xml_info;
if (!base::GetFileInfo(GetDataProvider()->library_path(), &xml_info))
- return base::PLATFORM_FILE_ERROR_IO;
+ return base::File::FILE_ERROR_IO;
file_list->push_back(DirectoryEntry(kITunesLibraryXML,
DirectoryEntry::FILE,
xml_info.size, xml_info.last_modified));
file_list->push_back(DirectoryEntry(kITunesMediaDir,
DirectoryEntry::DIRECTORY,
0, base::Time()));
- return base::PLATFORM_FILE_OK;
+ return base::File::FILE_OK;
}
if (components.size() == 1 && components[0] == kITunesLibraryXML)
- return base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY;
+ return base::File::FILE_ERROR_NOT_A_DIRECTORY;
if (components[0] != kITunesMediaDir || components.size() > 5)
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ return base::File::FILE_ERROR_NOT_FOUND;
if (components.size() == 1) {
if (!GetDataProvider()->auto_add_path().empty()) {
@@ -185,7 +184,7 @@
file_list->push_back(DirectoryEntry(kITunesMusicDir,
DirectoryEntry::DIRECTORY,
0, base::Time()));
- return base::PLATFORM_FILE_OK;
+ return base::File::FILE_OK;
}
if (components[1] == kITunesAutoAddDir &&
@@ -194,7 +193,7 @@
}
if (components[1] != kITunesMusicDir)
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ return base::File::FILE_ERROR_NOT_FOUND;
if (components.size() == 2) {
std::set<ITunesDataProvider::ArtistName> artists =
@@ -203,26 +202,26 @@
for (it = artists.begin(); it != artists.end(); ++it)
file_list->push_back(DirectoryEntry(*it, DirectoryEntry::DIRECTORY,
0, base::Time()));
- return base::PLATFORM_FILE_OK;
+ return base::File::FILE_OK;
}
if (components.size() == 3) {
std::set<ITunesDataProvider::AlbumName> albums =
GetDataProvider()->GetAlbumNames(components[2]);
if (albums.size() == 0)
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ return base::File::FILE_ERROR_NOT_FOUND;
std::set<ITunesDataProvider::AlbumName>::const_iterator it;
for (it = albums.begin(); it != albums.end(); ++it)
file_list->push_back(DirectoryEntry(*it, DirectoryEntry::DIRECTORY,
0, base::Time()));
- return base::PLATFORM_FILE_OK;
+ return base::File::FILE_OK;
}
if (components.size() == 4) {
ITunesDataProvider::Album album =
GetDataProvider()->GetAlbum(components[2], components[3]);
if (album.size() == 0)
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ return base::File::FILE_ERROR_NOT_FOUND;
ITunesDataProvider::Album::const_iterator it;
for (it = album.begin(); it != album.end(); ++it) {
base::File::Info file_info;
@@ -233,7 +232,7 @@
file_info.last_modified));
}
}
- return base::PLATFORM_FILE_OK;
+ return base::File::FILE_OK;
}
// At this point, the only choice is one of two errors, but figuring out
@@ -243,26 +242,26 @@
location = GetDataProvider()->GetTrackLocation(components[1], components[2],
components[3]);
if (!location.empty())
- return base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY;
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ return base::File::FILE_ERROR_NOT_A_DIRECTORY;
+ return base::File::FILE_ERROR_NOT_FOUND;
}
-base::PlatformFileError ITunesFileUtil::DeleteDirectorySync(
+base::File::Error ITunesFileUtil::DeleteDirectorySync(
fileapi::FileSystemOperationContext* context,
const fileapi::FileSystemURL& url) {
- return base::PLATFORM_FILE_ERROR_SECURITY;
+ return base::File::FILE_ERROR_SECURITY;
}
-base::PlatformFileError ITunesFileUtil::DeleteFileSync(
+base::File::Error ITunesFileUtil::DeleteFileSync(
fileapi::FileSystemOperationContext* context,
const fileapi::FileSystemURL& url) {
- return base::PLATFORM_FILE_ERROR_SECURITY;
+ return base::File::FILE_ERROR_SECURITY;
}
-base::PlatformFileError ITunesFileUtil::CreateSnapshotFileSync(
+base::File::Error ITunesFileUtil::CreateSnapshotFileSync(
fileapi::FileSystemOperationContext* context,
const fileapi::FileSystemURL& url,
- base::PlatformFileInfo* file_info,
+ base::File::Info* file_info,
base::FilePath* platform_path,
scoped_refptr<webkit_blob::ShareableFileReference>* file_ref) {
DCHECK(!url.path().IsAbsolute());
@@ -281,7 +280,7 @@
return GetFileInfoSync(context, url, file_info, platform_path);
}
-base::PlatformFileError ITunesFileUtil::GetLocalFilePath(
+base::File::Error ITunesFileUtil::GetLocalFilePath(
fileapi::FileSystemOperationContext* context,
const fileapi::FileSystemURL& url,
base::FilePath* local_file_path) {
@@ -290,35 +289,35 @@
if (components.size() == 1 && components[0] == kITunesLibraryXML) {
*local_file_path = GetDataProvider()->library_path();
- return base::PLATFORM_FILE_OK;
+ return base::File::FILE_OK;
}
if (components.size() >= 2 && components[0] == kITunesMediaDir &&
components[1] == kITunesAutoAddDir) {
*local_file_path = GetDataProvider()->auto_add_path();
if (local_file_path->empty())
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ return base::File::FILE_ERROR_NOT_FOUND;
for (size_t i = 2; i < components.size(); ++i) {
*local_file_path = local_file_path->Append(
base::FilePath::FromUTF8Unsafe(components[i]));
}
- return base::PLATFORM_FILE_OK;
+ return base::File::FILE_OK;
}
// Should only get here for files, i.e. the xml file and tracks.
if (components[0] != kITunesMediaDir || components[1] != kITunesMusicDir||
components.size() != 5) {
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ return base::File::FILE_ERROR_NOT_FOUND;
}
*local_file_path = GetDataProvider()->GetTrackLocation(components[2],
components[3],
components[4]);
if (!local_file_path->empty())
- return base::PLATFORM_FILE_OK;
+ return base::File::FILE_OK;
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ return base::File::FILE_ERROR_NOT_FOUND;
}
void ITunesFileUtil::GetFileInfoWithFreshDataProvider(
@@ -331,8 +330,8 @@
content::BrowserThread::PostTask(
content::BrowserThread::IO,
FROM_HERE,
- base::Bind(callback, base::PLATFORM_FILE_ERROR_IO,
- base::PlatformFileInfo()));
+ base::Bind(callback, base::File::FILE_ERROR_IO,
+ base::File::Info()));
}
return;
}
@@ -350,8 +349,7 @@
content::BrowserThread::PostTask(
content::BrowserThread::IO,
FROM_HERE,
- base::Bind(callback, base::PLATFORM_FILE_ERROR_IO, EntryList(),
- false));
+ base::Bind(callback, base::File::FILE_ERROR_IO, EntryList(), false));
}
return;
}
@@ -366,13 +364,13 @@
bool valid_parse) {
if (!valid_parse) {
if (!callback.is_null()) {
- base::PlatformFileInfo file_info;
+ base::File::Info file_info;
base::FilePath platform_path;
scoped_refptr<webkit_blob::ShareableFileReference> file_ref;
content::BrowserThread::PostTask(
content::BrowserThread::IO,
FROM_HERE,
- base::Bind(callback, base::PLATFORM_FILE_ERROR_IO, file_info,
+ base::Bind(callback, base::File::FILE_ERROR_IO, file_info,
platform_path, file_ref));
}
return;
diff --git a/chrome/browser/media_galleries/fileapi/itunes_file_util.h b/chrome/browser/media_galleries/fileapi/itunes_file_util.h
index 883fafc..77b6cdb5 100644
--- a/chrome/browser/media_galleries/fileapi/itunes_file_util.h
+++ b/chrome/browser/media_galleries/fileapi/itunes_file_util.h
@@ -39,28 +39,28 @@
scoped_ptr<fileapi::FileSystemOperationContext> context,
const fileapi::FileSystemURL& url,
const CreateSnapshotFileCallback& callback) OVERRIDE;
- virtual base::PlatformFileError GetFileInfoSync(
+ virtual base::File::Error GetFileInfoSync(
fileapi::FileSystemOperationContext* context,
const fileapi::FileSystemURL& url,
- base::PlatformFileInfo* file_info,
+ base::File::Info* file_info,
base::FilePath* platform_path) OVERRIDE;
- virtual base::PlatformFileError ReadDirectorySync(
+ virtual base::File::Error ReadDirectorySync(
fileapi::FileSystemOperationContext* context,
const fileapi::FileSystemURL& url,
EntryList* file_list) OVERRIDE;
- virtual base::PlatformFileError DeleteDirectorySync(
+ virtual base::File::Error DeleteDirectorySync(
fileapi::FileSystemOperationContext* context,
const fileapi::FileSystemURL& url) OVERRIDE;
- virtual base::PlatformFileError DeleteFileSync(
+ virtual base::File::Error DeleteFileSync(
fileapi::FileSystemOperationContext* context,
const fileapi::FileSystemURL& url) OVERRIDE;
- virtual base::PlatformFileError CreateSnapshotFileSync(
+ virtual base::File::Error CreateSnapshotFileSync(
fileapi::FileSystemOperationContext* context,
const fileapi::FileSystemURL& url,
- base::PlatformFileInfo* file_info,
+ base::File::Info* file_info,
base::FilePath* platform_path,
scoped_refptr<webkit_blob::ShareableFileReference>* file_ref) OVERRIDE;
- virtual base::PlatformFileError GetLocalFilePath(
+ virtual base::File::Error GetLocalFilePath(
fileapi::FileSystemOperationContext* context,
const fileapi::FileSystemURL& url,
base::FilePath* local_file_path) OVERRIDE;
diff --git a/chrome/browser/media_galleries/fileapi/itunes_file_util_unittest.cc b/chrome/browser/media_galleries/fileapi/itunes_file_util_unittest.cc
index 0193fa4..4209613 100644
--- a/chrome/browser/media_galleries/fileapi/itunes_file_util_unittest.cc
+++ b/chrome/browser/media_galleries/fileapi/itunes_file_util_unittest.cc
@@ -39,11 +39,11 @@
void ReadDirectoryTestHelperCallback(
base::RunLoop* run_loop,
FileSystemOperation::FileEntryList* contents,
- bool* completed, base::PlatformFileError error,
+ bool* completed, base::File::Error error,
const FileSystemOperation::FileEntryList& file_list,
bool has_more) {
DCHECK(!*completed);
- *completed = !has_more && error == base::PLATFORM_FILE_OK;
+ *completed = (!has_more && error == base::File::FILE_OK);
*contents = file_list;
run_loop->Quit();
}
diff --git a/chrome/browser/media_galleries/fileapi/media_file_system_backend.cc b/chrome/browser/media_galleries/fileapi/media_file_system_backend.cc
index bb626cc0..3452654 100644
--- a/chrome/browser/media_galleries/fileapi/media_file_system_backend.cc
+++ b/chrome/browser/media_galleries/fileapi/media_file_system_backend.cc
@@ -119,7 +119,7 @@
base::Bind(callback,
GetFileSystemRootURI(origin_url, type),
GetFileSystemName(origin_url, type),
- base::PLATFORM_FILE_ERROR_SECURITY));
+ base::File::FILE_ERROR_SECURITY));
}
fileapi::AsyncFileUtil* MediaFileSystemBackend::GetAsyncFileUtil(
@@ -147,16 +147,16 @@
fileapi::CopyOrMoveFileValidatorFactory*
MediaFileSystemBackend::GetCopyOrMoveFileValidatorFactory(
- fileapi::FileSystemType type, base::PlatformFileError* error_code) {
+ fileapi::FileSystemType type, base::File::Error* error_code) {
DCHECK(error_code);
- *error_code = base::PLATFORM_FILE_OK;
+ *error_code = base::File::FILE_OK;
switch (type) {
case fileapi::kFileSystemTypeNativeMedia:
case fileapi::kFileSystemTypeDeviceMedia:
case fileapi::kFileSystemTypeIphoto:
case fileapi::kFileSystemTypeItunes:
if (!media_copy_or_move_file_validator_factory_) {
- *error_code = base::PLATFORM_FILE_ERROR_SECURITY;
+ *error_code = base::File::FILE_ERROR_SECURITY;
return NULL;
}
return media_copy_or_move_file_validator_factory_.get();
@@ -170,7 +170,7 @@
MediaFileSystemBackend::CreateFileSystemOperation(
const FileSystemURL& url,
FileSystemContext* context,
- base::PlatformFileError* error_code) const {
+ base::File::Error* error_code) const {
scoped_ptr<fileapi::FileSystemOperationContext> operation_context(
new fileapi::FileSystemOperationContext(
context, media_task_runner_.get()));
diff --git a/chrome/browser/media_galleries/fileapi/media_file_system_backend.h b/chrome/browser/media_galleries/fileapi/media_file_system_backend.h
index 95f8f2c7..92e5079 100644
--- a/chrome/browser/media_galleries/fileapi/media_file_system_backend.h
+++ b/chrome/browser/media_galleries/fileapi/media_file_system_backend.h
@@ -42,11 +42,11 @@
virtual fileapi::CopyOrMoveFileValidatorFactory*
GetCopyOrMoveFileValidatorFactory(
fileapi::FileSystemType type,
- base::PlatformFileError* error_code) OVERRIDE;
+ base::File::Error* error_code) OVERRIDE;
virtual fileapi::FileSystemOperation* CreateFileSystemOperation(
const fileapi::FileSystemURL& url,
fileapi::FileSystemContext* context,
- base::PlatformFileError* error_code) const OVERRIDE;
+ base::File::Error* error_code) const OVERRIDE;
virtual scoped_ptr<webkit_blob::FileStreamReader> CreateFileStreamReader(
const fileapi::FileSystemURL& url,
int64 offset,
diff --git a/chrome/browser/media_galleries/fileapi/media_file_validator_browsertest.cc b/chrome/browser/media_galleries/fileapi/media_file_validator_browsertest.cc
index b591076..cd4e89b 100644
--- a/chrome/browser/media_galleries/fileapi/media_file_validator_browsertest.cc
+++ b/chrome/browser/media_galleries/fileapi/media_file_validator_browsertest.cc
@@ -39,9 +39,9 @@
void HandleCheckFileResult(int64 expected_size,
const base::Callback<void(bool success)>& callback,
- base::PlatformFileError result,
- const base::PlatformFileInfo& file_info) {
- if (result == base::PLATFORM_FILE_OK) {
+ base::File::Error result,
+ const base::File::Info& file_info) {
+ if (result == base::File::FILE_OK) {
if (!file_info.is_directory && expected_size != kNoFileSize &&
file_info.size == expected_size) {
callback.Run(true);
@@ -203,11 +203,11 @@
// Check that the move succeeded/failed based on expectation and then
// check that the right file exists.
- void OnMoveResult(bool expected_result, base::PlatformFileError result) {
+ void OnMoveResult(bool expected_result, base::File::Error result) {
if (expected_result)
- EXPECT_EQ(base::PLATFORM_FILE_OK, result);
+ EXPECT_EQ(base::File::FILE_OK, result);
else
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_SECURITY, result);
+ EXPECT_EQ(base::File::FILE_ERROR_SECURITY, result);
CheckFiles(!expected_result,
base::Bind(&MediaFileValidatorTest::OnTestFilesCheckResult,
base::Unretained(this)));
diff --git a/chrome/browser/media_galleries/fileapi/media_file_validator_factory.cc b/chrome/browser/media_galleries/fileapi/media_file_validator_factory.cc
index f7e9434..aa1559b 100644
--- a/chrome/browser/media_galleries/fileapi/media_file_validator_factory.cc
+++ b/chrome/browser/media_galleries/fileapi/media_file_validator_factory.cc
@@ -19,14 +19,14 @@
virtual void StartPreWriteValidation(
const fileapi::CopyOrMoveFileValidator::ResultCallback&
result_callback) OVERRIDE {
- result_callback.Run(base::PLATFORM_FILE_ERROR_SECURITY);
+ result_callback.Run(base::File::FILE_ERROR_SECURITY);
}
virtual void StartPostWriteValidation(
const base::FilePath& dest_platform_path,
const fileapi::CopyOrMoveFileValidator::ResultCallback&
result_callback) OVERRIDE {
- result_callback.Run(base::PLATFORM_FILE_ERROR_SECURITY);
+ result_callback.Run(base::File::FILE_ERROR_SECURITY);
}
private:
diff --git a/chrome/browser/media_galleries/fileapi/mtp_device_async_delegate.h b/chrome/browser/media_galleries/fileapi/mtp_device_async_delegate.h
index d9ffe84..9ac5f7b 100644
--- a/chrome/browser/media_galleries/fileapi/mtp_device_async_delegate.h
+++ b/chrome/browser/media_galleries/fileapi/mtp_device_async_delegate.h
@@ -6,8 +6,8 @@
#define CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_MTP_DEVICE_ASYNC_DELEGATE_H_
#include "base/callback.h"
+#include "base/files/file.h"
#include "base/memory/ref_counted.h"
-#include "base/platform_file.h"
#include "webkit/browser/fileapi/async_file_util.h"
namespace base {
@@ -27,7 +27,7 @@
public:
// A callback to be called when GetFileInfo method call succeeds.
typedef base::Callback<
- void(const base::PlatformFileInfo& file_info)> GetFileInfoSuccessCallback;
+ void(const base::File::Info& file_info)> GetFileInfoSuccessCallback;
// A callback to be called when ReadDirectory method call succeeds.
typedef base::Callback<
@@ -36,12 +36,11 @@
// A callback to be called when GetFileInfo/ReadDirectory/CreateSnapshot
// method call fails.
- typedef base::Callback<
- void(base::PlatformFileError error)> ErrorCallback;
+ typedef base::Callback<void(base::File::Error error)> ErrorCallback;
// A callback to be called when CreateSnapshotFile method call succeeds.
typedef base::Callback<
- void(const base::PlatformFileInfo& file_info,
+ void(const base::File::Info& file_info,
const base::FilePath& local_path)> CreateSnapshotFileSuccessCallback;
// A callback to be called when ReadBytes method call succeeds.
diff --git a/chrome/browser/media_galleries/fileapi/mtp_file_stream_reader.cc b/chrome/browser/media_galleries/fileapi/mtp_file_stream_reader.cc
index c1bd017f..77babee 100644
--- a/chrome/browser/media_galleries/fileapi/mtp_file_stream_reader.cc
+++ b/chrome/browser/media_galleries/fileapi/mtp_file_stream_reader.cc
@@ -27,14 +27,14 @@
void CallCompletionCallbackWithPlatformFileError(
const net::CompletionCallback& callback,
- base::PlatformFileError platform_file_error) {
- callback.Run(net::PlatformFileErrorToNetError(platform_file_error));
+ base::File::Error file_error) {
+ callback.Run(net::FileErrorToNetError(file_error));
}
void CallInt64CompletionCallbackWithPlatformFileError(
const net::Int64CompletionCallback& callback,
- base::PlatformFileError platform_file_error) {
- callback.Run(net::PlatformFileErrorToNetError(platform_file_error));
+ base::File::Error file_error) {
+ callback.Run(net::FileErrorToNetError(file_error));
}
} // namespace
@@ -94,7 +94,7 @@
net::IOBuffer* buf,
int buf_len,
const net::CompletionCallback& callback,
- const base::PlatformFileInfo& file_info) {
+ const base::File::Info& file_info) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
if (!VerifySnapshotTime(expected_modification_time_, file_info)) {
@@ -134,7 +134,7 @@
void MTPFileStreamReader::FinishGetLength(
const net::Int64CompletionCallback& callback,
- const base::PlatformFileInfo& file_info) {
+ const base::File::Info& file_info) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
if (!VerifySnapshotTime(expected_modification_time_, file_info)) {
diff --git a/chrome/browser/media_galleries/fileapi/mtp_file_stream_reader.h b/chrome/browser/media_galleries/fileapi/mtp_file_stream_reader.h
index 397c3e3c..cc5d910 100644
--- a/chrome/browser/media_galleries/fileapi/mtp_file_stream_reader.h
+++ b/chrome/browser/media_galleries/fileapi/mtp_file_stream_reader.h
@@ -6,6 +6,7 @@
#define CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_MTP_FILE_STREAM_READER_H_
#include "base/bind.h"
+#include "base/files/file.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "webkit/browser/blob/file_stream_reader.h"
@@ -14,7 +15,6 @@
namespace base {
class FilePath;
-struct PlatformFileInfo;
}
namespace fileapi {
@@ -40,13 +40,13 @@
private:
void OnFileInfoForRead(net::IOBuffer* buf, int buf_len,
const net::CompletionCallback& callback,
- const base::PlatformFileInfo& file_info);
+ const base::File::Info& file_info);
void FinishRead(const net::CompletionCallback& callback,
int bytes_read);
void FinishGetLength(const net::Int64CompletionCallback& callback,
- const base::PlatformFileInfo& file_info);
+ const base::File::Info& file_info);
scoped_refptr<fileapi::FileSystemContext> file_system_context_;
fileapi::FileSystemURL url_;
diff --git a/chrome/browser/media_galleries/fileapi/native_media_file_util.cc b/chrome/browser/media_galleries/fileapi/native_media_file_util.cc
index 06a54d39..ef97712 100644
--- a/chrome/browser/media_galleries/fileapi/native_media_file_util.cc
+++ b/chrome/browser/media_galleries/fileapi/native_media_file_util.cc
@@ -74,21 +74,21 @@
return context->task_runner()->RunsTasksOnCurrentThread();
}
-base::PlatformFileError IsMediaHeader(const char* buf, size_t length) {
+base::File::Error IsMediaHeader(const char* buf, size_t length) {
if (length == 0)
- return base::PLATFORM_FILE_ERROR_SECURITY;
+ return base::File::FILE_ERROR_SECURITY;
std::string mime_type;
if (!net::SniffMimeTypeFromLocalData(buf, length, &mime_type))
- return base::PLATFORM_FILE_ERROR_SECURITY;
+ return base::File::FILE_ERROR_SECURITY;
if (StartsWithASCII(mime_type, "image/", true) ||
StartsWithASCII(mime_type, "audio/", true) ||
StartsWithASCII(mime_type, "video/", true) ||
mime_type == "application/x-shockwave-flash") {
- return base::PLATFORM_FILE_OK;
+ return base::File::FILE_OK;
}
- return base::PLATFORM_FILE_ERROR_SECURITY;
+ return base::File::FILE_ERROR_SECURITY;
}
} // namespace
@@ -102,13 +102,13 @@
}
// static
-base::PlatformFileError NativeMediaFileUtil::IsMediaFile(
+base::File::Error NativeMediaFileUtil::IsMediaFile(
const base::FilePath& path) {
base::PlatformFile file_handle;
const int flags = base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ;
- base::PlatformFileError error =
+ base::File::Error error =
fileapi::NativeFileUtil::CreateOrOpen(path, flags, &file_handle, NULL);
- if (error != base::PLATFORM_FILE_OK)
+ if (error != base::File::FILE_OK)
return error;
base::ScopedPlatformFileCloser scoped_platform_file(&file_handle);
@@ -118,13 +118,13 @@
int64 len =
base::ReadPlatformFile(file_handle, 0, buffer, net::kMaxBytesToSniff);
if (len < 0)
- return base::PLATFORM_FILE_ERROR_FAILED;
+ return base::File::FILE_ERROR_FAILED;
return IsMediaHeader(buffer, len);
}
// static
-base::PlatformFileError NativeMediaFileUtil::BufferIsMediaHeader(
+base::File::Error NativeMediaFileUtil::BufferIsMediaHeader(
net::IOBuffer* buf, size_t length) {
return IsMediaHeader(buf->data(), length);
}
@@ -137,7 +137,7 @@
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
// Only called by NaCl, which should not have access to media file systems.
base::PlatformFile invalid_file(base::kInvalidPlatformFileValue);
- callback.Run(base::PLATFORM_FILE_ERROR_SECURITY,
+ callback.Run(base::File::FILE_ERROR_SECURITY,
base::PassPlatformFile(&invalid_file),
base::Closure());
}
@@ -147,7 +147,7 @@
const fileapi::FileSystemURL& url,
const EnsureFileExistsCallback& callback) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
- callback.Run(base::PLATFORM_FILE_ERROR_SECURITY, false);
+ callback.Run(base::File::FILE_ERROR_SECURITY, false);
}
void NativeMediaFileUtil::CreateDirectory(
@@ -201,7 +201,7 @@
const base::Time& last_modified_time,
const StatusCallback& callback) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
- callback.Run(base::PLATFORM_FILE_ERROR_SECURITY);
+ callback.Run(base::File::FILE_ERROR_SECURITY);
}
void NativeMediaFileUtil::Truncate(
@@ -210,7 +210,7 @@
int64 length,
const StatusCallback& callback) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
- callback.Run(base::PLATFORM_FILE_ERROR_SECURITY);
+ callback.Run(base::File::FILE_ERROR_SECURITY);
}
void NativeMediaFileUtil::CopyFileLocal(
@@ -295,7 +295,7 @@
const fileapi::FileSystemURL& url,
const StatusCallback& callback) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
- callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION);
+ callback.Run(base::File::FILE_ERROR_INVALID_OPERATION);
}
void NativeMediaFileUtil::CreateSnapshotFile(
@@ -319,7 +319,7 @@
bool recursive,
const StatusCallback& callback) {
DCHECK(IsOnTaskRunnerThread(context.get()));
- base::PlatformFileError error =
+ base::File::Error error =
CreateDirectorySync(context.get(), url, exclusive, recursive);
content::BrowserThread::PostTask(
content::BrowserThread::IO,
@@ -332,8 +332,8 @@
const fileapi::FileSystemURL& url,
const GetFileInfoCallback& callback) {
DCHECK(IsOnTaskRunnerThread(context.get()));
- base::PlatformFileInfo file_info;
- base::PlatformFileError error =
+ base::File::Info file_info;
+ base::File::Error error =
GetFileInfoSync(context.get(), url, &file_info, NULL);
content::BrowserThread::PostTask(
content::BrowserThread::IO,
@@ -347,7 +347,7 @@
const ReadDirectoryCallback& callback) {
DCHECK(IsOnTaskRunnerThread(context.get()));
EntryList entry_list;
- base::PlatformFileError error =
+ base::File::Error error =
ReadDirectorySync(context.get(), url, &entry_list);
content::BrowserThread::PostTask(
content::BrowserThread::IO,
@@ -363,7 +363,7 @@
bool copy,
const StatusCallback& callback) {
DCHECK(IsOnTaskRunnerThread(context.get()));
- base::PlatformFileError error =
+ base::File::Error error =
CopyOrMoveFileSync(context.get(), src_url, dest_url, option, copy);
content::BrowserThread::PostTask(
content::BrowserThread::IO,
@@ -377,7 +377,7 @@
const fileapi::FileSystemURL& dest_url,
const StatusCallback& callback) {
DCHECK(IsOnTaskRunnerThread(context.get()));
- base::PlatformFileError error =
+ base::File::Error error =
CopyInForeignFileSync(context.get(), src_file_path, dest_url);
content::BrowserThread::PostTask(
content::BrowserThread::IO,
@@ -390,7 +390,7 @@
const fileapi::FileSystemURL& url,
const StatusCallback& callback) {
DCHECK(IsOnTaskRunnerThread(context.get()));
- base::PlatformFileError error = DeleteFileSync(context.get(), url);
+ base::File::Error error = DeleteFileSync(context.get(), url);
content::BrowserThread::PostTask(
content::BrowserThread::IO,
FROM_HERE,
@@ -402,7 +402,7 @@
const fileapi::FileSystemURL& url,
const StatusCallback& callback) {
DCHECK(IsOnTaskRunnerThread(context.get()));
- base::PlatformFileError error = DeleteDirectorySync(context.get(), url);
+ base::File::Error error = DeleteDirectorySync(context.get(), url);
content::BrowserThread::PostTask(
content::BrowserThread::IO,
FROM_HERE,
@@ -414,10 +414,10 @@
const fileapi::FileSystemURL& url,
const CreateSnapshotFileCallback& callback) {
DCHECK(IsOnTaskRunnerThread(context.get()));
- base::PlatformFileInfo file_info;
+ base::File::Info file_info;
base::FilePath platform_path;
scoped_refptr<webkit_blob::ShareableFileReference> file_ref;
- base::PlatformFileError error =
+ base::File::Error error =
CreateSnapshotFileSync(context.get(), url, &file_info, &platform_path,
&file_ref);
content::BrowserThread::PostTask(
@@ -426,20 +426,20 @@
base::Bind(callback, error, file_info, platform_path, file_ref));
}
-base::PlatformFileError NativeMediaFileUtil::CreateDirectorySync(
+base::File::Error NativeMediaFileUtil::CreateDirectorySync(
fileapi::FileSystemOperationContext* context,
const fileapi::FileSystemURL& url,
bool exclusive,
bool recursive) {
base::FilePath file_path;
- base::PlatformFileError error = GetLocalFilePath(context, url, &file_path);
- if (error != base::PLATFORM_FILE_OK)
+ base::File::Error error = GetLocalFilePath(context, url, &file_path);
+ if (error != base::File::FILE_OK)
return error;
return fileapi::NativeFileUtil::CreateDirectory(file_path, exclusive,
recursive);
}
-base::PlatformFileError NativeMediaFileUtil::CopyOrMoveFileSync(
+base::File::Error NativeMediaFileUtil::CopyOrMoveFileSync(
fileapi::FileSystemOperationContext* context,
const fileapi::FileSystemURL& src_url,
const fileapi::FileSystemURL& dest_url,
@@ -447,47 +447,48 @@
bool copy) {
DCHECK(IsOnTaskRunnerThread(context));
base::FilePath src_file_path;
- base::PlatformFileError error =
+ base::File::Error error =
GetFilteredLocalFilePathForExistingFileOrDirectory(
context, src_url,
- base::PLATFORM_FILE_ERROR_NOT_FOUND,
+ base::File::FILE_ERROR_NOT_FOUND,
&src_file_path);
- if (error != base::PLATFORM_FILE_OK)
+ if (error != base::File::FILE_OK)
return error;
if (fileapi::NativeFileUtil::DirectoryExists(src_file_path))
- return base::PLATFORM_FILE_ERROR_NOT_A_FILE;
+ return base::File::FILE_ERROR_NOT_A_FILE;
base::FilePath dest_file_path;
error = GetLocalFilePath(context, dest_url, &dest_file_path);
- if (error != base::PLATFORM_FILE_OK)
+ if (error != base::File::FILE_OK)
return error;
- base::PlatformFileInfo file_info;
+ base::File::Info file_info;
error = fileapi::NativeFileUtil::GetFileInfo(dest_file_path, &file_info);
- if (error != base::PLATFORM_FILE_OK &&
- error != base::PLATFORM_FILE_ERROR_NOT_FOUND)
+ if (error != base::File::FILE_OK &&
+ error != base::File::FILE_ERROR_NOT_FOUND) {
return error;
- if (error == base::PLATFORM_FILE_OK && file_info.is_directory)
- return base::PLATFORM_FILE_ERROR_INVALID_OPERATION;
+ }
+ if (error == base::File::FILE_OK && file_info.is_directory)
+ return base::File::FILE_ERROR_INVALID_OPERATION;
if (!media_path_filter_->Match(dest_file_path))
- return base::PLATFORM_FILE_ERROR_SECURITY;
+ return base::File::FILE_ERROR_SECURITY;
return fileapi::NativeFileUtil::CopyOrMoveFile(
src_file_path, dest_file_path, option,
fileapi::NativeFileUtil::CopyOrMoveModeForDestination(dest_url, copy));
}
-base::PlatformFileError NativeMediaFileUtil::CopyInForeignFileSync(
+base::File::Error NativeMediaFileUtil::CopyInForeignFileSync(
fileapi::FileSystemOperationContext* context,
const base::FilePath& src_file_path,
const fileapi::FileSystemURL& dest_url) {
DCHECK(IsOnTaskRunnerThread(context));
if (src_file_path.empty())
- return base::PLATFORM_FILE_ERROR_INVALID_OPERATION;
+ return base::File::FILE_ERROR_INVALID_OPERATION;
base::FilePath dest_file_path;
- base::PlatformFileError error =
+ base::File::Error error =
GetFilteredLocalFilePath(context, dest_url, &dest_file_path);
- if (error != base::PLATFORM_FILE_OK)
+ if (error != base::File::FILE_OK)
return error;
return fileapi::NativeFileUtil::CopyOrMoveFile(
src_file_path, dest_file_path,
@@ -496,35 +497,35 @@
true /* copy */));
}
-base::PlatformFileError NativeMediaFileUtil::GetFileInfoSync(
+base::File::Error NativeMediaFileUtil::GetFileInfoSync(
fileapi::FileSystemOperationContext* context,
const fileapi::FileSystemURL& url,
- base::PlatformFileInfo* file_info,
+ base::File::Info* file_info,
base::FilePath* platform_path) {
DCHECK(context);
DCHECK(IsOnTaskRunnerThread(context));
DCHECK(file_info);
base::FilePath file_path;
- base::PlatformFileError error = GetLocalFilePath(context, url, &file_path);
- if (error != base::PLATFORM_FILE_OK)
+ base::File::Error error = GetLocalFilePath(context, url, &file_path);
+ if (error != base::File::FILE_OK)
return error;
if (base::IsLink(file_path))
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ return base::File::FILE_ERROR_NOT_FOUND;
error = fileapi::NativeFileUtil::GetFileInfo(file_path, file_info);
- if (error != base::PLATFORM_FILE_OK)
+ if (error != base::File::FILE_OK)
return error;
if (platform_path)
*platform_path = file_path;
if (file_info->is_directory ||
media_path_filter_->Match(file_path)) {
- return base::PLATFORM_FILE_OK;
+ return base::File::FILE_OK;
}
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ return base::File::FILE_ERROR_NOT_FOUND;
}
-base::PlatformFileError NativeMediaFileUtil::GetLocalFilePath(
+base::File::Error NativeMediaFileUtil::GetLocalFilePath(
fileapi::FileSystemOperationContext* context,
const fileapi::FileSystemURL& url,
base::FilePath* local_file_path) {
@@ -532,29 +533,29 @@
DCHECK(url.is_valid());
if (url.path().empty()) {
// Root direcory case, which should not be accessed.
- return base::PLATFORM_FILE_ERROR_ACCESS_DENIED;
+ return base::File::FILE_ERROR_ACCESS_DENIED;
}
*local_file_path = url.path();
- return base::PLATFORM_FILE_OK;
+ return base::File::FILE_OK;
}
-base::PlatformFileError NativeMediaFileUtil::ReadDirectorySync(
+base::File::Error NativeMediaFileUtil::ReadDirectorySync(
fileapi::FileSystemOperationContext* context,
const fileapi::FileSystemURL& url,
EntryList* file_list) {
DCHECK(IsOnTaskRunnerThread(context));
DCHECK(file_list);
DCHECK(file_list->empty());
- base::PlatformFileInfo file_info;
+ base::File::Info file_info;
base::FilePath dir_path;
- base::PlatformFileError error =
+ base::File::Error error =
GetFileInfoSync(context, url, &file_info, &dir_path);
- if (error != base::PLATFORM_FILE_OK)
+ if (error != base::File::FILE_OK)
return error;
if (!file_info.is_directory)
- return base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY;
+ return base::File::FILE_ERROR_NOT_A_DIRECTORY;
base::FileEnumerator file_enum(
dir_path,
@@ -584,47 +585,47 @@
file_list->push_back(entry);
}
- return base::PLATFORM_FILE_OK;
+ return base::File::FILE_OK;
}
-base::PlatformFileError NativeMediaFileUtil::DeleteFileSync(
+base::File::Error NativeMediaFileUtil::DeleteFileSync(
fileapi::FileSystemOperationContext* context,
const fileapi::FileSystemURL& url) {
DCHECK(IsOnTaskRunnerThread(context));
- base::PlatformFileInfo file_info;
+ base::File::Info file_info;
base::FilePath file_path;
- base::PlatformFileError error =
+ base::File::Error error =
GetFileInfoSync(context, url, &file_info, &file_path);
- if (error != base::PLATFORM_FILE_OK)
+ if (error != base::File::FILE_OK)
return error;
if (file_info.is_directory)
- return base::PLATFORM_FILE_ERROR_NOT_A_FILE;
+ return base::File::FILE_ERROR_NOT_A_FILE;
return fileapi::NativeFileUtil::DeleteFile(file_path);
}
-base::PlatformFileError NativeMediaFileUtil::DeleteDirectorySync(
+base::File::Error NativeMediaFileUtil::DeleteDirectorySync(
fileapi::FileSystemOperationContext* context,
const fileapi::FileSystemURL& url) {
DCHECK(IsOnTaskRunnerThread(context));
base::FilePath file_path;
- base::PlatformFileError error = GetLocalFilePath(context, url, &file_path);
- if (error != base::PLATFORM_FILE_OK)
+ base::File::Error error = GetLocalFilePath(context, url, &file_path);
+ if (error != base::File::FILE_OK)
return error;
return fileapi::NativeFileUtil::DeleteDirectory(file_path);
}
-base::PlatformFileError NativeMediaFileUtil::CreateSnapshotFileSync(
+base::File::Error NativeMediaFileUtil::CreateSnapshotFileSync(
fileapi::FileSystemOperationContext* context,
const fileapi::FileSystemURL& url,
- base::PlatformFileInfo* file_info,
+ base::File::Info* file_info,
base::FilePath* platform_path,
scoped_refptr<webkit_blob::ShareableFileReference>* file_ref) {
DCHECK(IsOnTaskRunnerThread(context));
- base::PlatformFileError error =
+ base::File::Error error =
GetFileInfoSync(context, url, file_info, platform_path);
- if (error == base::PLATFORM_FILE_OK && file_info->is_directory)
- error = base::PLATFORM_FILE_ERROR_NOT_A_FILE;
- if (error == base::PLATFORM_FILE_OK)
+ if (error == base::File::FILE_OK && file_info->is_directory)
+ error = base::File::FILE_ERROR_NOT_A_FILE;
+ if (error == base::File::FILE_OK)
error = NativeMediaFileUtil::IsMediaFile(*platform_path);
// We're just returning the local file information.
@@ -633,41 +634,41 @@
return error;
}
-base::PlatformFileError NativeMediaFileUtil::GetFilteredLocalFilePath(
+base::File::Error NativeMediaFileUtil::GetFilteredLocalFilePath(
fileapi::FileSystemOperationContext* context,
const fileapi::FileSystemURL& file_system_url,
base::FilePath* local_file_path) {
DCHECK(IsOnTaskRunnerThread(context));
base::FilePath file_path;
- base::PlatformFileError error =
+ base::File::Error error =
GetLocalFilePath(context, file_system_url, &file_path);
- if (error != base::PLATFORM_FILE_OK)
+ if (error != base::File::FILE_OK)
return error;
if (!media_path_filter_->Match(file_path))
- return base::PLATFORM_FILE_ERROR_SECURITY;
+ return base::File::FILE_ERROR_SECURITY;
*local_file_path = file_path;
- return base::PLATFORM_FILE_OK;
+ return base::File::FILE_OK;
}
-base::PlatformFileError
+base::File::Error
NativeMediaFileUtil::GetFilteredLocalFilePathForExistingFileOrDirectory(
fileapi::FileSystemOperationContext* context,
const fileapi::FileSystemURL& file_system_url,
- base::PlatformFileError failure_error,
+ base::File::Error failure_error,
base::FilePath* local_file_path) {
DCHECK(IsOnTaskRunnerThread(context));
base::FilePath file_path;
- base::PlatformFileError error =
+ base::File::Error error =
GetLocalFilePath(context, file_system_url, &file_path);
- if (error != base::PLATFORM_FILE_OK)
+ if (error != base::File::FILE_OK)
return error;
if (!base::PathExists(file_path))
return failure_error;
base::File::Info file_info;
if (!base::GetFileInfo(file_path, &file_info))
- return base::PLATFORM_FILE_ERROR_FAILED;
+ return base::File::FILE_ERROR_FAILED;
if (!file_info.is_directory &&
!media_path_filter_->Match(file_path)) {
@@ -675,5 +676,5 @@
}
*local_file_path = file_path;
- return base::PLATFORM_FILE_OK;
+ return base::File::FILE_OK;
}
diff --git a/chrome/browser/media_galleries/fileapi/native_media_file_util.h b/chrome/browser/media_galleries/fileapi/native_media_file_util.h
index a6c8ddcc..382bedf 100644
--- a/chrome/browser/media_galleries/fileapi/native_media_file_util.h
+++ b/chrome/browser/media_galleries/fileapi/native_media_file_util.h
@@ -26,8 +26,8 @@
// Uses the MIME sniffer code, which actually looks into the file,
// to determine if it is really a media file (to avoid exposing
// non-media files with a media file extension.)
- static base::PlatformFileError IsMediaFile(const base::FilePath& path);
- static base::PlatformFileError BufferIsMediaHeader(net::IOBuffer* buf,
+ static base::File::Error IsMediaFile(const base::FilePath& path);
+ static base::File::Error BufferIsMediaHeader(net::IOBuffer* buf,
size_t length);
// AsyncFileUtil overrides.
@@ -143,47 +143,47 @@
// The following methods should only be called on the task runner thread.
// Necessary for copy/move to succeed.
- virtual base::PlatformFileError CreateDirectorySync(
+ virtual base::File::Error CreateDirectorySync(
fileapi::FileSystemOperationContext* context,
const fileapi::FileSystemURL& url,
bool exclusive,
bool recursive);
- virtual base::PlatformFileError CopyOrMoveFileSync(
+ virtual base::File::Error CopyOrMoveFileSync(
fileapi::FileSystemOperationContext* context,
const fileapi::FileSystemURL& src_url,
const fileapi::FileSystemURL& dest_url,
CopyOrMoveOption option,
bool copy);
- virtual base::PlatformFileError CopyInForeignFileSync(
+ virtual base::File::Error CopyInForeignFileSync(
fileapi::FileSystemOperationContext* context,
const base::FilePath& src_file_path,
const fileapi::FileSystemURL& dest_url);
- virtual base::PlatformFileError GetFileInfoSync(
+ virtual base::File::Error GetFileInfoSync(
fileapi::FileSystemOperationContext* context,
const fileapi::FileSystemURL& url,
- base::PlatformFileInfo* file_info,
+ base::File::Info* file_info,
base::FilePath* platform_path);
// Called by GetFileInfoSync. Meant to be overridden by subclasses that
// have special mappings from URLs to platform paths (virtual filesystems).
- virtual base::PlatformFileError GetLocalFilePath(
+ virtual base::File::Error GetLocalFilePath(
fileapi::FileSystemOperationContext* context,
const fileapi::FileSystemURL& file_system_url,
base::FilePath* local_file_path);
- virtual base::PlatformFileError ReadDirectorySync(
+ virtual base::File::Error ReadDirectorySync(
fileapi::FileSystemOperationContext* context,
const fileapi::FileSystemURL& url,
EntryList* file_list);
- virtual base::PlatformFileError DeleteFileSync(
+ virtual base::File::Error DeleteFileSync(
fileapi::FileSystemOperationContext* context,
const fileapi::FileSystemURL& url);
// Necessary for move to succeed.
- virtual base::PlatformFileError DeleteDirectorySync(
+ virtual base::File::Error DeleteDirectorySync(
fileapi::FileSystemOperationContext* context,
const fileapi::FileSystemURL& url);
- virtual base::PlatformFileError CreateSnapshotFileSync(
+ virtual base::File::Error CreateSnapshotFileSync(
fileapi::FileSystemOperationContext* context,
const fileapi::FileSystemURL& url,
- base::PlatformFileInfo* file_info,
+ base::File::Info* file_info,
base::FilePath* platform_path,
scoped_refptr<webkit_blob::ShareableFileReference>* file_ref);
@@ -196,7 +196,7 @@
// Like GetLocalFilePath(), but always take media_path_filter() into
// consideration. If the media_path_filter() check fails, return
// PLATFORM_FILE_ERROR_SECURITY. |local_file_path| does not have to exist.
- base::PlatformFileError GetFilteredLocalFilePath(
+ base::File::Error GetFilteredLocalFilePath(
fileapi::FileSystemOperationContext* context,
const fileapi::FileSystemURL& file_system_url,
base::FilePath* local_file_path);
@@ -207,10 +207,10 @@
// consideration.
// If the media_path_filter() check fails, return |failure_error|.
// If |local_file_path| is a directory, return PLATFORM_FILE_OK.
- base::PlatformFileError GetFilteredLocalFilePathForExistingFileOrDirectory(
+ base::File::Error GetFilteredLocalFilePathForExistingFileOrDirectory(
fileapi::FileSystemOperationContext* context,
const fileapi::FileSystemURL& file_system_url,
- base::PlatformFileError failure_error,
+ base::File::Error failure_error,
base::FilePath* local_file_path);
diff --git a/chrome/browser/media_galleries/fileapi/native_media_file_util_unittest.cc b/chrome/browser/media_galleries/fileapi/native_media_file_util_unittest.cc
index b877d89..a835678 100644
--- a/chrome/browser/media_galleries/fileapi/native_media_file_util_unittest.cc
+++ b/chrome/browser/media_galleries/fileapi/native_media_file_util_unittest.cc
@@ -65,24 +65,24 @@
};
void ExpectEqHelper(const std::string& test_name,
- base::PlatformFileError expected,
- base::PlatformFileError actual) {
+ base::File::Error expected,
+ base::File::Error actual) {
EXPECT_EQ(expected, actual) << test_name;
}
void ExpectMetadataEqHelper(const std::string& test_name,
- base::PlatformFileError expected,
+ base::File::Error expected,
bool expected_is_directory,
- base::PlatformFileError actual,
- const base::PlatformFileInfo& file_info) {
+ base::File::Error actual,
+ const base::File::Info& file_info) {
EXPECT_EQ(expected, actual) << test_name;
- if (actual == base::PLATFORM_FILE_OK)
+ if (actual == base::File::FILE_OK)
EXPECT_EQ(expected_is_directory, file_info.is_directory) << test_name;
}
void DidReadDirectory(std::set<base::FilePath::StringType>* content,
bool* completed,
- base::PlatformFileError error,
+ base::File::Error error,
const FileEntryList& file_list,
bool has_more) {
EXPECT_TRUE(!*completed);
@@ -206,10 +206,10 @@
for (size_t i = 0; i < arraysize(kFilteringTestCases); ++i) {
FileSystemURL url = CreateURL(kFilteringTestCases[i].path);
- base::PlatformFileError expectation =
+ base::File::Error expectation =
kFilteringTestCases[i].visible ?
- base::PLATFORM_FILE_OK :
- base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ base::File::FILE_OK :
+ base::File::FILE_ERROR_NOT_FOUND;
std::string test_name =
base::StringPrintf("DirectoryExistsAndFileExistsFiltering %" PRIuS, i);
@@ -259,10 +259,10 @@
std::string test_name = base::StringPrintf(
"CreateFileAndCreateDirectoryFiltering run %d, test %" PRIuS,
loop_count, i);
- base::PlatformFileError expectation =
+ base::File::Error expectation =
kFilteringTestCases[i].visible ?
- base::PLATFORM_FILE_OK :
- base::PLATFORM_FILE_ERROR_SECURITY;
+ base::File::FILE_OK :
+ base::File::FILE_ERROR_SECURITY;
operation_runner()->CreateDirectory(
url, false, false,
base::Bind(&ExpectEqHelper, test_name, expectation));
@@ -294,13 +294,13 @@
std::string test_name = base::StringPrintf(
"CopySourceFiltering run %d test %" PRIuS, loop_count, i);
- base::PlatformFileError expectation = base::PLATFORM_FILE_OK;
+ base::File::Error expectation = base::File::FILE_OK;
if (loop_count == 0 || !kFilteringTestCases[i].visible) {
// If the source does not exist or is not visible.
- expectation = base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ expectation = base::File::FILE_ERROR_NOT_FOUND;
} else if (!kFilteringTestCases[i].is_directory) {
// Cannot copy a visible file to a directory.
- expectation = base::PLATFORM_FILE_ERROR_INVALID_OPERATION;
+ expectation = base::File::FILE_ERROR_INVALID_OPERATION;
}
operation_runner()->Copy(
url, dest_url,
@@ -343,7 +343,7 @@
std::string test_name = base::StringPrintf(
"CopyDestFiltering run %d test %" PRIuS, loop_count, i);
- base::PlatformFileError expectation;
+ base::File::Error expectation;
if (loop_count == 0) {
// The destination path is a file here. The directory case has been
// handled above.
@@ -351,20 +351,20 @@
// creating it would be a security violation.
expectation =
kFilteringTestCases[i].visible ?
- base::PLATFORM_FILE_OK :
- base::PLATFORM_FILE_ERROR_SECURITY;
+ base::File::FILE_OK :
+ base::File::FILE_ERROR_SECURITY;
} else {
if (!kFilteringTestCases[i].visible) {
// If the destination path exist and is not visible, then to the copy
// operation, it looks like the file needs to be created, which is a
// security violation.
- expectation = base::PLATFORM_FILE_ERROR_SECURITY;
+ expectation = base::File::FILE_ERROR_SECURITY;
} else if (kFilteringTestCases[i].is_directory) {
// Cannot copy a file to a directory.
- expectation = base::PLATFORM_FILE_ERROR_INVALID_OPERATION;
+ expectation = base::File::FILE_ERROR_INVALID_OPERATION;
} else {
// Copying from a file to a visible file that exists is ok.
- expectation = base::PLATFORM_FILE_OK;
+ expectation = base::File::FILE_OK;
}
}
operation_runner()->Copy(
@@ -399,13 +399,13 @@
std::string test_name = base::StringPrintf(
"MoveSourceFiltering run %d test %" PRIuS, loop_count, i);
- base::PlatformFileError expectation = base::PLATFORM_FILE_OK;
+ base::File::Error expectation = base::File::FILE_OK;
if (loop_count == 0 || !kFilteringTestCases[i].visible) {
// If the source does not exist or is not visible.
- expectation = base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ expectation = base::File::FILE_ERROR_NOT_FOUND;
} else if (!kFilteringTestCases[i].is_directory) {
// Cannot move a visible file to a directory.
- expectation = base::PLATFORM_FILE_ERROR_INVALID_OPERATION;
+ expectation = base::File::FILE_ERROR_INVALID_OPERATION;
}
operation_runner()->Move(
url, dest_url, fileapi::FileSystemOperation::OPTION_NONE,
@@ -448,7 +448,7 @@
std::string test_name = base::StringPrintf(
"MoveDestFiltering run %d test %" PRIuS, loop_count, i);
- base::PlatformFileError expectation;
+ base::File::Error expectation;
if (loop_count == 0) {
// The destination path is a file here. The directory case has been
// handled above.
@@ -456,20 +456,20 @@
// creating it would be a security violation.
expectation =
kFilteringTestCases[i].visible ?
- base::PLATFORM_FILE_OK :
- base::PLATFORM_FILE_ERROR_SECURITY;
+ base::File::FILE_OK :
+ base::File::FILE_ERROR_SECURITY;
} else {
if (!kFilteringTestCases[i].visible) {
// If the destination path exist and is not visible, then to the move
// operation, it looks like the file needs to be created, which is a
// security violation.
- expectation = base::PLATFORM_FILE_ERROR_SECURITY;
+ expectation = base::File::FILE_ERROR_SECURITY;
} else if (kFilteringTestCases[i].is_directory) {
// Cannot move a file to a directory.
- expectation = base::PLATFORM_FILE_ERROR_INVALID_OPERATION;
+ expectation = base::File::FILE_ERROR_INVALID_OPERATION;
} else {
// Moving from a file to a visible file that exists is ok.
- expectation = base::PLATFORM_FILE_OK;
+ expectation = base::File::FILE_OK;
}
}
operation_runner()->Move(
@@ -494,10 +494,10 @@
std::string test_name = base::StringPrintf(
"GetMetadataFiltering run %d test %" PRIuS, loop_count, i);
- base::PlatformFileError expectation = base::PLATFORM_FILE_OK;
+ base::File::Error expectation = base::File::FILE_OK;
if (loop_count == 0 || !kFilteringTestCases[i].visible) {
// Cannot get metadata from files that do not exist or are not visible.
- expectation = base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ expectation = base::File::FILE_ERROR_NOT_FOUND;
}
operation_runner()->GetMetadata(
url,
@@ -524,12 +524,12 @@
std::string test_name = base::StringPrintf(
"RemoveFiltering run %d test %" PRIuS, loop_count, i);
- base::PlatformFileError expectation = base::PLATFORM_FILE_OK;
+ base::File::Error expectation = base::File::FILE_OK;
if (loop_count == 0 || !kFilteringTestCases[i].visible) {
// Cannot remove files that do not exist or are not visible.
- expectation = base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ expectation = base::File::FILE_ERROR_NOT_FOUND;
} else if (kFilteringTestCases[i].is_directory) {
- expectation = base::PLATFORM_FILE_ERROR_NOT_A_FILE;
+ expectation = base::File::FILE_ERROR_NOT_A_FILE;
}
operation_runner()->RemoveFile(
url, base::Bind(&ExpectEqHelper, test_name, expectation));
@@ -538,8 +538,10 @@
}
}
-void CreateSnapshotCallback(base::PlatformFileError* error,
- base::PlatformFileError result, const base::PlatformFileInfo&,
+void CreateSnapshotCallback(
+ base::File::Error* error,
+ base::File::Error result,
+ const base::File::Info&,
const base::FilePath&,
const scoped_refptr<webkit_blob::ShareableFileReference>&) {
*error = result;
@@ -556,12 +558,12 @@
}
FileSystemURL root_url = CreateURL(FPL(""));
FileSystemURL url = CreateURL(kFilteringTestCases[i].path);
- base::PlatformFileError expected_error, error;
+ base::File::Error expected_error, error;
if (kFilteringTestCases[i].media_file)
- expected_error = base::PLATFORM_FILE_OK;
+ expected_error = base::File::FILE_OK;
else
- expected_error = base::PLATFORM_FILE_ERROR_SECURITY;
- error = base::PLATFORM_FILE_ERROR_FAILED;
+ expected_error = base::File::FILE_ERROR_SECURITY;
+ error = base::File::FILE_ERROR_FAILED;
operation_runner()->CreateSnapshotFile(url,
base::Bind(CreateSnapshotCallback, &error));
base::MessageLoop::current()->RunUntilIdle();
diff --git a/chrome/browser/media_galleries/fileapi/picasa_data_provider.cc b/chrome/browser/media_galleries/fileapi/picasa_data_provider.cc
index 0633362..060ba47 100644
--- a/chrome/browser/media_galleries/fileapi/picasa_data_provider.cc
+++ b/chrome/browser/media_galleries/fileapi/picasa_data_provider.cc
@@ -97,7 +97,7 @@
scoped_ptr<AlbumImages> PicasaDataProvider::FindAlbumImages(
const std::string& key,
- base::PlatformFileError* error) {
+ base::File::Error* error) {
DCHECK(MediaFileSystemBackend::CurrentlyOnMediaTaskRunnerThread());
DCHECK(state_ == ALBUMS_IMAGES_FRESH_STATE);
DCHECK(error);
@@ -105,11 +105,11 @@
AlbumImagesMap::const_iterator it = albums_images_.find(key);
if (it == albums_images_.end()) {
- *error = base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ *error = base::File::FILE_ERROR_NOT_FOUND;
return scoped_ptr<AlbumImages>();
}
- *error = base::PLATFORM_FILE_OK;
+ *error = base::File::FILE_OK;
return make_scoped_ptr(new AlbumImages(it->second));
}
diff --git a/chrome/browser/media_galleries/fileapi/picasa_data_provider.h b/chrome/browser/media_galleries/fileapi/picasa_data_provider.h
index c075f67..8da1ae4 100644
--- a/chrome/browser/media_galleries/fileapi/picasa_data_provider.h
+++ b/chrome/browser/media_galleries/fileapi/picasa_data_provider.h
@@ -11,6 +11,7 @@
#include "base/basictypes.h"
#include "base/callback_forward.h"
+#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/files/file_path_watcher.h"
#include "base/memory/ref_counted.h"
@@ -47,7 +48,7 @@
scoped_ptr<AlbumMap> GetFolders();
// |error| must be non-NULL.
scoped_ptr<AlbumImages> FindAlbumImages(const std::string& key,
- base::PlatformFileError* error);
+ base::File::Error* error);
protected:
// Notifies data provider that any currently cached data is stale.
diff --git a/chrome/browser/media_galleries/fileapi/picasa_data_provider_browsertest.cc b/chrome/browser/media_galleries/fileapi/picasa_data_provider_browsertest.cc
index bced3c2..061aa6db 100644
--- a/chrome/browser/media_galleries/fileapi/picasa_data_provider_browsertest.cc
+++ b/chrome/browser/media_galleries/fileapi/picasa_data_provider_browsertest.cc
@@ -66,11 +66,11 @@
void VerifyTestAlbumsImagesIndex(PicasaDataProvider* data_provider,
base::FilePath test_folder_1_path,
base::FilePath test_folder_2_path) {
- base::PlatformFileError error;
+ base::File::Error error;
scoped_ptr<AlbumImages> album_1_images =
data_provider->FindAlbumImages("uid3", &error);
ASSERT_TRUE(album_1_images);
- EXPECT_EQ(base::PLATFORM_FILE_OK, error);
+ EXPECT_EQ(base::File::FILE_OK, error);
EXPECT_EQ(2u, album_1_images->size());
EXPECT_NE(album_1_images->end(), album_1_images->find("InBoth.jpg"));
EXPECT_EQ(test_folder_1_path.AppendASCII("InBoth.jpg"),
@@ -83,7 +83,7 @@
scoped_ptr<AlbumImages> album_2_images =
data_provider->FindAlbumImages("uid5", &error);
ASSERT_TRUE(album_2_images);
- EXPECT_EQ(base::PLATFORM_FILE_OK, error);
+ EXPECT_EQ(base::File::FILE_OK, error);
EXPECT_EQ(2u, album_2_images->size());
EXPECT_NE(album_2_images->end(), album_2_images->find("InBoth.jpg"));
EXPECT_EQ(test_folder_1_path.AppendASCII("InBoth.jpg"),
diff --git a/chrome/browser/media_galleries/fileapi/picasa_file_util.cc b/chrome/browser/media_galleries/fileapi/picasa_file_util.cc
index 2eb10f1..646f9548 100644
--- a/chrome/browser/media_galleries/fileapi/picasa_file_util.cc
+++ b/chrome/browser/media_galleries/fileapi/picasa_file_util.cc
@@ -32,21 +32,21 @@
namespace {
-base::PlatformFileError FindAlbumInfo(const std::string& key,
- const AlbumMap* map,
- AlbumInfo* album_info) {
+base::File::Error FindAlbumInfo(const std::string& key,
+ const AlbumMap* map,
+ AlbumInfo* album_info) {
if (!map)
- return base::PLATFORM_FILE_ERROR_FAILED;
+ return base::File::FILE_ERROR_FAILED;
AlbumMap::const_iterator it = map->find(key);
if (it == map->end())
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ return base::File::FILE_ERROR_NOT_FOUND;
if (album_info != NULL)
*album_info = it->second;
- return base::PLATFORM_FILE_OK;
+ return base::File::FILE_OK;
}
PicasaDataProvider::DataType GetDataTypeForURL(
@@ -98,9 +98,9 @@
callback));
}
-base::PlatformFileError PicasaFileUtil::GetFileInfoSync(
+base::File::Error PicasaFileUtil::GetFileInfoSync(
FileSystemOperationContext* context, const FileSystemURL& url,
- base::PlatformFileInfo* file_info, base::FilePath* platform_path) {
+ base::File::Info* file_info, base::FilePath* platform_path) {
DCHECK(context);
DCHECK(file_info);
@@ -114,25 +114,25 @@
case 0:
// Root directory.
file_info->is_directory = true;
- return base::PLATFORM_FILE_OK;
+ return base::File::FILE_OK;
case 1:
if (components[0] == kPicasaDirAlbums ||
components[0] == kPicasaDirFolders) {
file_info->is_directory = true;
- return base::PLATFORM_FILE_OK;
+ return base::File::FILE_OK;
}
break;
case 2:
if (components[0] == kPicasaDirAlbums) {
scoped_ptr<AlbumMap> album_map = GetDataProvider()->GetAlbums();
- base::PlatformFileError error =
+ base::File::Error error =
FindAlbumInfo(components[1], album_map.get(), NULL);
- if (error != base::PLATFORM_FILE_OK)
+ if (error != base::File::FILE_OK)
return error;
file_info->is_directory = true;
- return base::PLATFORM_FILE_OK;
+ return base::File::FILE_OK;
}
if (components[0] == kPicasaDirFolders) {
@@ -144,20 +144,20 @@
// NativeMediaFileUtil::GetInfo calls into virtual function
// PicasaFileUtil::GetLocalFilePath, and that will handle both
// album contents and folder contents.
- base::PlatformFileError result = NativeMediaFileUtil::GetFileInfoSync(
+ base::File::Error result = NativeMediaFileUtil::GetFileInfoSync(
context, url, file_info, platform_path);
DCHECK(components[0] == kPicasaDirAlbums ||
components[0] == kPicasaDirFolders ||
- result == base::PLATFORM_FILE_ERROR_NOT_FOUND);
+ result == base::File::FILE_ERROR_NOT_FOUND);
return result;
}
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ return base::File::FILE_ERROR_NOT_FOUND;
}
-base::PlatformFileError PicasaFileUtil::ReadDirectorySync(
+base::File::Error PicasaFileUtil::ReadDirectorySync(
fileapi::FileSystemOperationContext* context,
const fileapi::FileSystemURL& url,
EntryList* file_list) {
@@ -165,16 +165,16 @@
DCHECK(file_list);
DCHECK(file_list->empty());
- base::PlatformFileInfo file_info;
+ base::File::Info file_info;
base::FilePath platform_directory_path;
- base::PlatformFileError error = GetFileInfoSync(
+ base::File::Error error = GetFileInfoSync(
context, url, &file_info, &platform_directory_path);
- if (error != base::PLATFORM_FILE_OK)
+ if (error != base::File::FILE_OK)
return error;
if (!file_info.is_directory)
- return base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY;
+ return base::File::FILE_ERROR_NOT_A_DIRECTORY;
std::vector<std::string> components;
fileapi::VirtualPath::GetComponentsUTF8Unsafe(url.path(), &components);
@@ -194,7 +194,7 @@
if (components[0] == kPicasaDirAlbums) {
scoped_ptr<AlbumMap> albums = GetDataProvider()->GetAlbums();
if (!albums)
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ return base::File::FILE_ERROR_NOT_FOUND;
for (AlbumMap::const_iterator it = albums->begin();
it != albums->end(); ++it) {
@@ -205,7 +205,7 @@
} else if (components[0] == kPicasaDirFolders) {
scoped_ptr<AlbumMap> folders = GetDataProvider()->GetFolders();
if (!folders)
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ return base::File::FILE_ERROR_NOT_FOUND;
for (AlbumMap::const_iterator it = folders->begin();
it != folders->end(); ++it) {
@@ -219,25 +219,25 @@
if (components[0] == kPicasaDirAlbums) {
scoped_ptr<AlbumMap> album_map = GetDataProvider()->GetAlbums();
AlbumInfo album_info;
- base::PlatformFileError error =
+ base::File::Error error =
FindAlbumInfo(components[1], album_map.get(), &album_info);
- if (error != base::PLATFORM_FILE_OK)
+ if (error != base::File::FILE_OK)
return error;
scoped_ptr<AlbumImages> album_images =
GetDataProvider()->FindAlbumImages(album_info.uid, &error);
- if (error != base::PLATFORM_FILE_OK)
+ if (error != base::File::FILE_OK)
return error;
for (AlbumImages::const_iterator it = album_images->begin();
it != album_images->end();
++it) {
fileapi::DirectoryEntry entry;
- base::PlatformFileInfo info;
+ base::File::Info info;
// Simply skip files that we can't get info on.
if (fileapi::NativeFileUtil::GetFileInfo(it->second, &info) !=
- base::PLATFORM_FILE_OK) {
+ base::File::FILE_OK) {
continue;
}
@@ -248,9 +248,9 @@
if (components[0] == kPicasaDirFolders) {
EntryList super_list;
- base::PlatformFileError error =
+ base::File::Error error =
NativeMediaFileUtil::ReadDirectorySync(context, url, &super_list);
- if (error != base::PLATFORM_FILE_OK)
+ if (error != base::File::FILE_OK)
return error;
for (EntryList::const_iterator it = super_list.begin();
@@ -263,22 +263,22 @@
break;
}
- return base::PLATFORM_FILE_OK;
+ return base::File::FILE_OK;
}
-base::PlatformFileError PicasaFileUtil::DeleteDirectorySync(
+base::File::Error PicasaFileUtil::DeleteDirectorySync(
fileapi::FileSystemOperationContext* context,
const fileapi::FileSystemURL& url) {
- return base::PLATFORM_FILE_ERROR_SECURITY;
+ return base::File::FILE_ERROR_SECURITY;
}
-base::PlatformFileError PicasaFileUtil::DeleteFileSync(
+base::File::Error PicasaFileUtil::DeleteFileSync(
fileapi::FileSystemOperationContext* context,
const fileapi::FileSystemURL& url) {
- return base::PLATFORM_FILE_ERROR_SECURITY;
+ return base::File::FILE_ERROR_SECURITY;
}
-base::PlatformFileError PicasaFileUtil::GetLocalFilePath(
+base::File::Error PicasaFileUtil::GetLocalFilePath(
FileSystemOperationContext* context, const FileSystemURL& url,
base::FilePath* local_file_path) {
DCHECK(local_file_path);
@@ -291,58 +291,58 @@
if (components[0] == kPicasaDirFolders) {
scoped_ptr<AlbumMap> album_map = GetDataProvider()->GetFolders();
AlbumInfo album_info;
- base::PlatformFileError error =
+ base::File::Error error =
FindAlbumInfo(components[1], album_map.get(), &album_info);
- if (error != base::PLATFORM_FILE_OK)
+ if (error != base::File::FILE_OK)
return error;
*local_file_path = album_info.path;
- return base::PLATFORM_FILE_OK;
+ return base::File::FILE_OK;
}
break;
case 3:
if (components[0] == kPicasaDirAlbums) {
scoped_ptr<AlbumMap> album_map = GetDataProvider()->GetAlbums();
AlbumInfo album_info;
- base::PlatformFileError error =
+ base::File::Error error =
FindAlbumInfo(components[1], album_map.get(), &album_info);
- if (error != base::PLATFORM_FILE_OK)
+ if (error != base::File::FILE_OK)
return error;
scoped_ptr<AlbumImages> album_images =
GetDataProvider()->FindAlbumImages(album_info.uid, &error);
- if (error != base::PLATFORM_FILE_OK)
+ if (error != base::File::FILE_OK)
return error;
AlbumImages::const_iterator it = album_images->find(components[2]);
if (it == album_images->end())
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ return base::File::FILE_ERROR_NOT_FOUND;
*local_file_path = it->second;
- return base::PLATFORM_FILE_OK;
+ return base::File::FILE_OK;
}
if (components[0] == kPicasaDirFolders) {
scoped_ptr<AlbumMap> album_map = GetDataProvider()->GetFolders();
AlbumInfo album_info;
- base::PlatformFileError error =
+ base::File::Error error =
FindAlbumInfo(components[1], album_map.get(), &album_info);
- if (error != base::PLATFORM_FILE_OK)
+ if (error != base::File::FILE_OK)
return error;
// Not part of this class's mandate to check that it actually exists.
*local_file_path = album_info.path.Append(url.path().BaseName());
- return base::PLATFORM_FILE_OK;
+ return base::File::FILE_OK;
}
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ return base::File::FILE_ERROR_NOT_FOUND;
break;
}
// All other cases don't have a local path. The valid cases should be
// intercepted by GetFileInfo()/CreateFileEnumerator(). Invalid cases
// return a NOT_FOUND error.
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ return base::File::FILE_ERROR_NOT_FOUND;
}
void PicasaFileUtil::GetFileInfoWithFreshDataProvider(
@@ -354,8 +354,7 @@
content::BrowserThread::PostTask(
content::BrowserThread::IO,
FROM_HERE,
- base::Bind(
- callback, base::PLATFORM_FILE_ERROR_IO, base::PlatformFileInfo()));
+ base::Bind(callback, base::File::FILE_ERROR_IO, base::File::Info()));
return;
}
NativeMediaFileUtil::GetFileInfoOnTaskRunnerThread(
@@ -371,7 +370,7 @@
content::BrowserThread::PostTask(
content::BrowserThread::IO,
FROM_HERE,
- base::Bind(callback, base::PLATFORM_FILE_ERROR_IO, EntryList(), false));
+ base::Bind(callback, base::File::FILE_ERROR_IO, EntryList(), false));
return;
}
NativeMediaFileUtil::ReadDirectoryOnTaskRunnerThread(
diff --git a/chrome/browser/media_galleries/fileapi/picasa_file_util.h b/chrome/browser/media_galleries/fileapi/picasa_file_util.h
index 8ab53d0..4b77c24c 100644
--- a/chrome/browser/media_galleries/fileapi/picasa_file_util.h
+++ b/chrome/browser/media_galleries/fileapi/picasa_file_util.h
@@ -40,22 +40,22 @@
scoped_ptr<fileapi::FileSystemOperationContext> context,
const fileapi::FileSystemURL& url,
const ReadDirectoryCallback& callback) OVERRIDE;
- virtual base::PlatformFileError GetFileInfoSync(
+ virtual base::File::Error GetFileInfoSync(
fileapi::FileSystemOperationContext* context,
const fileapi::FileSystemURL& url,
- base::PlatformFileInfo* file_info,
+ base::File::Info* file_info,
base::FilePath* platform_path) OVERRIDE;
- virtual base::PlatformFileError ReadDirectorySync(
+ virtual base::File::Error ReadDirectorySync(
fileapi::FileSystemOperationContext* context,
const fileapi::FileSystemURL& url,
EntryList* file_list) OVERRIDE;
- virtual base::PlatformFileError DeleteDirectorySync(
+ virtual base::File::Error DeleteDirectorySync(
fileapi::FileSystemOperationContext* context,
const fileapi::FileSystemURL& url) OVERRIDE;
- virtual base::PlatformFileError DeleteFileSync(
+ virtual base::File::Error DeleteFileSync(
fileapi::FileSystemOperationContext* context,
const fileapi::FileSystemURL& url) OVERRIDE;
- virtual base::PlatformFileError GetLocalFilePath(
+ virtual base::File::Error GetLocalFilePath(
fileapi::FileSystemOperationContext* context,
const fileapi::FileSystemURL& url,
base::FilePath* local_file_path) OVERRIDE;
diff --git a/chrome/browser/media_galleries/fileapi/picasa_file_util_unittest.cc b/chrome/browser/media_galleries/fileapi/picasa_file_util_unittest.cc
index bb91cf1..d3d59eb3 100644
--- a/chrome/browser/media_galleries/fileapi/picasa_file_util_unittest.cc
+++ b/chrome/browser/media_galleries/fileapi/picasa_file_util_unittest.cc
@@ -133,11 +133,11 @@
void ReadDirectoryTestHelperCallback(
base::RunLoop* run_loop,
FileSystemOperation::FileEntryList* contents,
- bool* completed, base::PlatformFileError error,
+ bool* completed, base::File::Error error,
const FileSystemOperation::FileEntryList& file_list,
bool has_more) {
DCHECK(!*completed);
- *completed = !has_more && error == base::PLATFORM_FILE_OK;
+ *completed = !has_more && error == base::File::FILE_OK;
*contents = file_list;
run_loop->Quit();
}
@@ -166,10 +166,10 @@
void CreateSnapshotFileTestHelperCallback(
base::RunLoop* run_loop,
- base::PlatformFileError* error,
+ base::File::Error* error,
base::FilePath* platform_path_result,
- base::PlatformFileError result,
- const base::PlatformFileInfo& file_info,
+ base::File::Error result,
+ const base::File::Info& file_info,
const base::FilePath& platform_path,
const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref) {
DCHECK(run_loop);
@@ -577,7 +577,7 @@
// Create a snapshot file to verify the file path.
base::RunLoop loop;
- base::PlatformFileError error;
+ base::File::Error error;
base::FilePath platform_path_result;
fileapi::FileSystemOperationRunner::SnapshotFileCallback snapshot_callback =
base::Bind(&CreateSnapshotFileTestHelperCallback,
@@ -589,7 +589,7 @@
"/albumname 2013-04-16/mapped_name.jpg"),
snapshot_callback);
loop.Run();
- EXPECT_EQ(base::PLATFORM_FILE_OK, error);
+ EXPECT_EQ(base::File::FILE_OK, error);
EXPECT_EQ(image_path, platform_path_result);
}
diff --git a/chrome/browser/media_galleries/fileapi/safe_audio_video_checker.cc b/chrome/browser/media_galleries/fileapi/safe_audio_video_checker.cc
index f6b4f78..add758b 100644
--- a/chrome/browser/media_galleries/fileapi/safe_audio_video_checker.cc
+++ b/chrome/browser/media_galleries/fileapi/safe_audio_video_checker.cc
@@ -34,7 +34,7 @@
DCHECK(file_closer_);
if (*file_closer_.get() == base::kInvalidPlatformFileValue) {
- callback_.Run(base::PLATFORM_FILE_ERROR_SECURITY);
+ callback_.Run(base::File::FILE_ERROR_SECURITY);
state_ = FINISHED_STATE;
return;
}
@@ -69,8 +69,8 @@
return;
state_ = FINISHED_STATE;
- callback_.Run(valid ? base::PLATFORM_FILE_OK
- : base::PLATFORM_FILE_ERROR_SECURITY);
+ callback_.Run(valid ? base::File::FILE_OK :
+ base::File::FILE_ERROR_SECURITY);
}
void SafeAudioVideoChecker::OnProcessCrashed(int exit_code) {
diff --git a/chrome/browser/media_galleries/fileapi/supported_audio_video_checker.cc b/chrome/browser/media_galleries/fileapi/supported_audio_video_checker.cc
index bed3c23..fe2bbdb 100644
--- a/chrome/browser/media_galleries/fileapi/supported_audio_video_checker.cc
+++ b/chrome/browser/media_galleries/fileapi/supported_audio_video_checker.cc
@@ -87,7 +87,7 @@
void SupportedAudioVideoChecker::OnFileOpen(const base::PlatformFile& file) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
if (file == base::kInvalidPlatformFileValue) {
- callback_.Run(base::PLATFORM_FILE_ERROR_SECURITY);
+ callback_.Run(base::File::FILE_ERROR_SECURITY);
return;
}
diff --git a/chrome/browser/media_galleries/fileapi/supported_image_type_validator.cc b/chrome/browser/media_galleries/fileapi/supported_image_type_validator.cc
index 9b2ecacb..b8b7c72 100644
--- a/chrome/browser/media_galleries/fileapi/supported_image_type_validator.cc
+++ b/chrome/browser/media_galleries/fileapi/supported_image_type_validator.cc
@@ -6,7 +6,7 @@
#include "base/bind.h"
#include "base/callback.h"
-#include "base/files/scoped_platform_file_closer.h"
+#include "base/files/file.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
@@ -27,22 +27,20 @@
base::ThreadRestrictions::AssertIOAllowed();
scoped_ptr<std::string> result;
- base::PlatformFile file = base::CreatePlatformFile(
- path, base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ, NULL, NULL);
- if (file == base::kInvalidPlatformFileValue)
+ base::File file(path, base::File::FLAG_OPEN | base::File::FLAG_READ);
+ if (!file.IsValid())
return result.Pass();
- base::ScopedPlatformFileCloser file_closer(&file);
- base::PlatformFileInfo file_info;
- if (!base::GetPlatformFileInfo(file, &file_info) ||
+ base::File::Info file_info;
+ if (!file.GetInfo(&file_info) ||
file_info.size > kMaxImageFileSize) {
return result.Pass();
}
result.reset(new std::string);
result->resize(file_info.size);
- if (base::ReadPlatformFile(file, 0, string_as_array(result.get()),
- file_info.size) != file_info.size) {
+ if (file.Read(0, string_as_array(result.get()), file_info.size) !=
+ file_info.size) {
result.reset();
}
@@ -66,12 +64,12 @@
// ImageDecoder::Delegate methods.
virtual void OnImageDecoded(const ImageDecoder* /*decoder*/,
const SkBitmap& /*decoded_image*/) OVERRIDE {
- callback_.Run(base::PLATFORM_FILE_OK);
+ callback_.Run(base::File::FILE_OK);
delete this;
}
virtual void OnDecodeImageFailed(const ImageDecoder* /*decoder*/) OVERRIDE {
- callback_.Run(base::PLATFORM_FILE_ERROR_SECURITY);
+ callback_.Run(base::File::FILE_ERROR_SECURITY);
delete this;
}
@@ -123,7 +121,7 @@
void SupportedImageTypeValidator::OnFileOpen(scoped_ptr<std::string> data) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
if (!data.get()) {
- callback_.Run(base::PLATFORM_FILE_ERROR_SECURITY);
+ callback_.Run(base::File::FILE_ERROR_SECURITY);
return;
}
diff --git a/chrome/browser/media_galleries/linux/mtp_device_delegate_impl_linux.cc b/chrome/browser/media_galleries/linux/mtp_device_delegate_impl_linux.cc
index 655e17b..50f6291 100644
--- a/chrome/browser/media_galleries/linux/mtp_device_delegate_impl_linux.cc
+++ b/chrome/browser/media_galleries/linux/mtp_device_delegate_impl_linux.cc
@@ -86,7 +86,7 @@
const std::string& root,
const base::Callback<
void(const fileapi::AsyncFileUtil::EntryList&)>& success_callback,
- const base::Callback<void(base::PlatformFileError)>& error_callback) {
+ const base::Callback<void(base::File::Error)>& error_callback) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
MTPDeviceTaskHelper* task_helper =
GetDeviceTaskHelperForStorage(storage_name);
@@ -107,8 +107,8 @@
void GetFileInfoOnUIThread(
const std::string& storage_name,
const std::string& file_path,
- const base::Callback<void(const base::PlatformFileInfo&)>& success_callback,
- const base::Callback<void(base::PlatformFileError)>& error_callback) {
+ const base::Callback<void(const base::File::Info&)>& success_callback,
+ const base::Callback<void(base::File::Error)>& error_callback) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
MTPDeviceTaskHelper* task_helper =
GetDeviceTaskHelperForStorage(storage_name);
@@ -133,7 +133,7 @@
void WriteDataIntoSnapshotFileOnUIThread(
const std::string& storage_name,
const SnapshotRequestInfo& request_info,
- const base::PlatformFileInfo& snapshot_file_info) {
+ const base::File::Info& snapshot_file_info) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
MTPDeviceTaskHelper* task_helper =
GetDeviceTaskHelperForStorage(storage_name);
@@ -341,7 +341,7 @@
}
void MTPDeviceDelegateImplLinux::WriteDataIntoSnapshotFile(
- const base::PlatformFileInfo& file_info) {
+ const base::File::Info& file_info) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
DCHECK(current_snapshot_request_info_.get());
DCHECK_GT(file_info.size, 0);
@@ -388,7 +388,7 @@
void MTPDeviceDelegateImplLinux::OnDidGetFileInfo(
const GetFileInfoSuccessCallback& success_callback,
- const base::PlatformFileInfo& file_info) {
+ const base::File::Info& file_info) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
success_callback.Run(file_info);
task_in_progress_ = false;
@@ -399,12 +399,12 @@
const std::string& root,
const ReadDirectorySuccessCallback& success_callback,
const ErrorCallback& error_callback,
- const base::PlatformFileInfo& file_info) {
+ const base::File::Info& file_info) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
DCHECK(task_in_progress_);
if (!file_info.is_directory) {
return HandleDeviceFileError(error_callback,
- base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY);
+ base::File::FILE_ERROR_NOT_A_DIRECTORY);
}
base::Closure task_closure =
@@ -424,21 +424,21 @@
void MTPDeviceDelegateImplLinux::OnDidGetFileInfoToCreateSnapshotFile(
scoped_ptr<SnapshotRequestInfo> snapshot_request_info,
- const base::PlatformFileInfo& file_info) {
+ const base::File::Info& file_info) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
DCHECK(!current_snapshot_request_info_.get());
DCHECK(snapshot_request_info.get());
DCHECK(task_in_progress_);
- base::PlatformFileError error = base::PLATFORM_FILE_OK;
+ base::File::Error error = base::File::FILE_OK;
if (file_info.is_directory)
- error = base::PLATFORM_FILE_ERROR_NOT_A_FILE;
+ error = base::File::FILE_ERROR_NOT_A_FILE;
else if (file_info.size < 0 || file_info.size > kuint32max)
- error = base::PLATFORM_FILE_ERROR_FAILED;
+ error = base::File::FILE_ERROR_FAILED;
- if (error != base::PLATFORM_FILE_OK)
+ if (error != base::File::FILE_OK)
return HandleDeviceFileError(snapshot_request_info->error_callback, error);
- base::PlatformFileInfo snapshot_file_info(file_info);
+ base::File::Info snapshot_file_info(file_info);
// Modify the last modified time to null. This prevents the time stamp
// verfication in LocalFileStreamReader.
snapshot_file_info.last_modified = base::Time();
@@ -454,18 +454,18 @@
void MTPDeviceDelegateImplLinux::OnDidGetFileInfoToReadBytes(
const ReadBytesRequest& request,
- const base::PlatformFileInfo& file_info) {
+ const base::File::Info& file_info) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
DCHECK(request.buf);
DCHECK(request.buf_len >= 0);
DCHECK(task_in_progress_);
- base::PlatformFileError error = base::PLATFORM_FILE_OK;
+ base::File::Error error = base::File::FILE_OK;
if (file_info.is_directory)
- error = base::PLATFORM_FILE_ERROR_NOT_A_FILE;
+ error = base::File::FILE_ERROR_NOT_A_FILE;
else if (file_info.size < 0 || file_info.size > kuint32max)
- error = base::PLATFORM_FILE_ERROR_FAILED;
+ error = base::File::FILE_ERROR_FAILED;
- if (error != base::PLATFORM_FILE_OK)
+ if (error != base::File::FILE_OK)
return HandleDeviceFileError(request.error_callback, error);
ReadBytesRequest new_request(
@@ -494,7 +494,7 @@
}
void MTPDeviceDelegateImplLinux::OnDidWriteDataIntoSnapshotFile(
- const base::PlatformFileInfo& file_info,
+ const base::File::Info& file_info,
const base::FilePath& snapshot_file_path) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
DCHECK(current_snapshot_request_info_.get());
@@ -507,7 +507,7 @@
}
void MTPDeviceDelegateImplLinux::OnWriteDataIntoSnapshotFileError(
- base::PlatformFileError error) {
+ base::File::Error error) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
DCHECK(current_snapshot_request_info_.get());
DCHECK(task_in_progress_);
@@ -529,7 +529,7 @@
void MTPDeviceDelegateImplLinux::HandleDeviceFileError(
const ErrorCallback& error_callback,
- base::PlatformFileError error) {
+ base::File::Error error) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
DCHECK(task_in_progress_);
error_callback.Run(error);
diff --git a/chrome/browser/media_galleries/linux/mtp_device_delegate_impl_linux.h b/chrome/browser/media_galleries/linux/mtp_device_delegate_impl_linux.h
index 206acbe..1534b0d 100644
--- a/chrome/browser/media_galleries/linux/mtp_device_delegate_impl_linux.h
+++ b/chrome/browser/media_galleries/linux/mtp_device_delegate_impl_linux.h
@@ -94,8 +94,7 @@
// the UI thread.
//
// |snapshot_file_info| specifies the metadata details of the snapshot file.
- void WriteDataIntoSnapshotFile(
- const base::PlatformFileInfo& snapshot_file_info);
+ void WriteDataIntoSnapshotFile(const base::File::Info& snapshot_file_info);
// Processes the next pending request.
void ProcessNextPendingRequest();
@@ -110,7 +109,7 @@
// requested file details. |success_callback| is invoked to notify the caller
// about the requested file details.
void OnDidGetFileInfo(const GetFileInfoSuccessCallback& success_callback,
- const base::PlatformFileInfo& file_info);
+ const base::File::Info& file_info);
// Called when GetFileInfo() succeeds. GetFileInfo() is invoked to
// get the |root| directory metadata details. |file_info| specifies the |root|
@@ -125,7 +124,7 @@
const std::string& root,
const ReadDirectorySuccessCallback& success_callback,
const ErrorCallback& error_callback,
- const base::PlatformFileInfo& file_info);
+ const base::File::Info& file_info);
// Called when GetFileInfo() succeeds. GetFileInfo() is invoked to
// create the snapshot file of |snapshot_request_info.device_file_path|.
@@ -135,11 +134,11 @@
// to the snapshot file.
void OnDidGetFileInfoToCreateSnapshotFile(
scoped_ptr<SnapshotRequestInfo> snapshot_request_info,
- const base::PlatformFileInfo& file_info);
+ const base::File::Info& file_info);
// Called when GetFileInfo() succeeds to read a range of bytes.
void OnDidGetFileInfoToReadBytes(const ReadBytesRequest& request,
- const base::PlatformFileInfo& file_info);
+ const base::File::Info& file_info);
// Called when ReadDirectory() succeeds.
//
@@ -156,7 +155,7 @@
// |current_snapshot_request_info_.success_callback| is invoked to notify the
// caller about |snapshot_file_info|.
void OnDidWriteDataIntoSnapshotFile(
- const base::PlatformFileInfo& snapshot_file_info,
+ const base::File::Info& snapshot_file_info,
const base::FilePath& snapshot_file_path);
// Called when WriteDataIntoSnapshotFile() fails.
@@ -165,7 +164,7 @@
//
// |current_snapshot_request_info_.error_callback| is invoked to notify the
// caller about |error|.
- void OnWriteDataIntoSnapshotFileError(base::PlatformFileError error);
+ void OnWriteDataIntoSnapshotFileError(base::File::Error error);
// Called when ReadBytes() succeeds.
//
@@ -177,7 +176,7 @@
// Handles the device file |error|. |error_callback| is invoked to notify the
// caller about the file error.
void HandleDeviceFileError(const ErrorCallback& error_callback,
- base::PlatformFileError error);
+ base::File::Error error);
// MTP device initialization state.
InitializationState init_state_;
diff --git a/chrome/browser/media_galleries/linux/mtp_device_task_helper.cc b/chrome/browser/media_galleries/linux/mtp_device_task_helper.cc
index e944d8c..8dd1ce15 100644
--- a/chrome/browser/media_galleries/linux/mtp_device_task_helper.cc
+++ b/chrome/browser/media_galleries/linux/mtp_device_task_helper.cc
@@ -65,7 +65,7 @@
const ErrorCallback& error_callback) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
if (device_handle_.empty())
- return HandleDeviceError(error_callback, base::PLATFORM_FILE_ERROR_FAILED);
+ return HandleDeviceError(error_callback, base::File::FILE_ERROR_FAILED);
GetMediaTransferProtocolManager()->GetFileInfoByPath(
device_handle_, file_path,
@@ -81,7 +81,7 @@
const ErrorCallback& error_callback) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
if (device_handle_.empty())
- return HandleDeviceError(error_callback, base::PLATFORM_FILE_ERROR_FAILED);
+ return HandleDeviceError(error_callback, base::File::FILE_ERROR_FAILED);
GetMediaTransferProtocolManager()->ReadDirectoryByPath(
device_handle_, dir_path,
@@ -93,11 +93,11 @@
void MTPDeviceTaskHelper::WriteDataIntoSnapshotFile(
const SnapshotRequestInfo& request_info,
- const base::PlatformFileInfo& snapshot_file_info) {
+ const base::File::Info& snapshot_file_info) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
if (device_handle_.empty()) {
return HandleDeviceError(request_info.error_callback,
- base::PLATFORM_FILE_ERROR_FAILED);
+ base::File::FILE_ERROR_FAILED);
}
if (!read_file_worker_)
@@ -111,7 +111,7 @@
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
if (device_handle_.empty()) {
return HandleDeviceError(request.error_callback,
- base::PLATFORM_FILE_ERROR_FAILED);
+ base::File::FILE_ERROR_FAILED);
}
GetMediaTransferProtocolManager()->ReadFileChunkByPath(
@@ -150,10 +150,10 @@
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
if (error) {
return HandleDeviceError(error_callback,
- base::PLATFORM_FILE_ERROR_NOT_FOUND);
+ base::File::FILE_ERROR_NOT_FOUND);
}
- base::PlatformFileInfo file_entry_info;
+ base::File::Info file_entry_info;
file_entry_info.size = file_entry.file_size();
file_entry_info.is_directory =
file_entry.file_type() == MtpFileEntry::FILE_TYPE_FOLDER;
@@ -175,7 +175,7 @@
bool error) const {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
if (error)
- return HandleDeviceError(error_callback, base::PLATFORM_FILE_ERROR_FAILED);
+ return HandleDeviceError(error_callback, base::File::FILE_ERROR_FAILED);
fileapi::AsyncFileUtil::EntryList entries;
base::FilePath current;
@@ -200,7 +200,7 @@
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
if (error) {
return HandleDeviceError(request.error_callback,
- base::PLATFORM_FILE_ERROR_FAILED);
+ base::File::FILE_ERROR_FAILED);
}
CHECK_LE(base::checked_cast<int>(data.length()), request.buf_len);
@@ -214,7 +214,7 @@
void MTPDeviceTaskHelper::HandleDeviceError(
const ErrorCallback& error_callback,
- base::PlatformFileError error) const {
+ base::File::Error error) const {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
content::BrowserThread::PostTask(content::BrowserThread::IO,
FROM_HERE,
diff --git a/chrome/browser/media_galleries/linux/mtp_device_task_helper.h b/chrome/browser/media_galleries/linux/mtp_device_task_helper.h
index 28bc2f6f..9c1a8f6 100644
--- a/chrome/browser/media_galleries/linux/mtp_device_task_helper.h
+++ b/chrome/browser/media_galleries/linux/mtp_device_task_helper.h
@@ -85,7 +85,7 @@
// |snapshot_file_info| specifies the metadata of the snapshot file.
void WriteDataIntoSnapshotFile(
const SnapshotRequestInfo& request_info,
- const base::PlatformFileInfo& snapshot_file_info);
+ const base::File::Info& snapshot_file_info);
// Dispatches the read bytes request to the MediaTransferProtocolManager.
//
@@ -156,7 +156,7 @@
// Runs |error_callback| on the IO thread to notify the caller about the
// device |error|.
void HandleDeviceError(const ErrorCallback& error_callback,
- base::PlatformFileError error) const;
+ base::File::Error error) const;
// Handle to communicate with the MTP device.
std::string device_handle_;
diff --git a/chrome/browser/media_galleries/linux/mtp_read_file_worker.cc b/chrome/browser/media_galleries/linux/mtp_read_file_worker.cc
index 8c7eddbc..e27113c 100644
--- a/chrome/browser/media_galleries/linux/mtp_read_file_worker.cc
+++ b/chrome/browser/media_galleries/linux/mtp_read_file_worker.cc
@@ -47,7 +47,7 @@
void MTPReadFileWorker::WriteDataIntoSnapshotFile(
const SnapshotRequestInfo& request_info,
- const base::PlatformFileInfo& snapshot_file_info) {
+ const base::File::Info& snapshot_file_info) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
ReadDataChunkFromDeviceFile(
make_scoped_ptr(new SnapshotFileDetails(request_info,
@@ -128,7 +128,7 @@
content::BrowserThread::IO,
FROM_HERE,
base::Bind(snapshot_file_details->error_callback(),
- base::PLATFORM_FILE_ERROR_FAILED));
+ base::File::FILE_ERROR_FAILED));
return;
}
content::BrowserThread::PostTask(
diff --git a/chrome/browser/media_galleries/linux/mtp_read_file_worker.h b/chrome/browser/media_galleries/linux/mtp_read_file_worker.h
index d330d19..0b86e29 100644
--- a/chrome/browser/media_galleries/linux/mtp_read_file_worker.h
+++ b/chrome/browser/media_galleries/linux/mtp_read_file_worker.h
@@ -8,9 +8,9 @@
#include <string>
#include "base/callback.h"
+#include "base/files/file.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
-#include "base/platform_file.h"
namespace base {
class FilePath;
@@ -33,7 +33,7 @@
// |snapshot_file_info| specifies the metadata of the snapshot file.
void WriteDataIntoSnapshotFile(
const SnapshotRequestInfo& request_info,
- const base::PlatformFileInfo& snapshot_file_info);
+ const base::File::Info& snapshot_file_info);
private:
// Called when WriteDataIntoSnapshotFile() completes.
diff --git a/chrome/browser/media_galleries/linux/snapshot_file_details.cc b/chrome/browser/media_galleries/linux/snapshot_file_details.cc
index 00995cac..92997c86 100644
--- a/chrome/browser/media_galleries/linux/snapshot_file_details.cc
+++ b/chrome/browser/media_galleries/linux/snapshot_file_details.cc
@@ -31,7 +31,7 @@
SnapshotFileDetails::SnapshotFileDetails(
const SnapshotRequestInfo& request_info,
- const base::PlatformFileInfo& file_info)
+ const base::File::Info& file_info)
: request_info_(request_info),
file_info_(file_info),
bytes_written_(0),
diff --git a/chrome/browser/media_galleries/linux/snapshot_file_details.h b/chrome/browser/media_galleries/linux/snapshot_file_details.h
index 4d3fc52..c36d6e3 100644
--- a/chrome/browser/media_galleries/linux/snapshot_file_details.h
+++ b/chrome/browser/media_galleries/linux/snapshot_file_details.h
@@ -9,8 +9,8 @@
#include "base/basictypes.h"
#include "base/callback.h"
+#include "base/files/file.h"
#include "base/files/file_path.h"
-#include "base/platform_file.h"
#include "chrome/browser/media_galleries/fileapi/mtp_device_async_delegate.h"
// Used to represent snapshot file request params.
@@ -43,7 +43,7 @@
class SnapshotFileDetails {
public:
SnapshotFileDetails(const SnapshotRequestInfo& request_info,
- const base::PlatformFileInfo& file_info);
+ const base::File::Info& file_info);
~SnapshotFileDetails();
@@ -59,7 +59,7 @@
return bytes_written_;
}
- const base::PlatformFileInfo file_info() const {
+ const base::File::Info file_info() const {
return file_info_;
}
@@ -98,7 +98,7 @@
const SnapshotRequestInfo request_info_;
// Metadata of the snapshot file (such as name, size, type, etc).
- const base::PlatformFileInfo file_info_;
+ const base::File::Info file_info_;
// Number of bytes written into the snapshot file.
uint32 bytes_written_;
diff --git a/chrome/browser/media_galleries/mac/mtp_device_delegate_impl_mac.h b/chrome/browser/media_galleries/mac/mtp_device_delegate_impl_mac.h
index 7e2c905..13e25c2 100644
--- a/chrome/browser/media_galleries/mac/mtp_device_delegate_impl_mac.h
+++ b/chrome/browser/media_galleries/mac/mtp_device_delegate_impl_mac.h
@@ -10,9 +10,9 @@
#include <vector>
#include "base/containers/hash_tables.h"
+#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/memory/weak_ptr.h"
-#include "base/platform_file.h"
#include "chrome/browser/media_galleries/fileapi/mtp_device_async_delegate.h"
// Delegate for presenting an Image Capture device through the filesystem
@@ -60,10 +60,10 @@
// Forward delegates for ImageCaptureDeviceListener. These are
// invoked in callbacks of the ImageCapture library on the UI thread.
virtual void ItemAdded(const std::string& name,
- const base::PlatformFileInfo& info);
+ const base::File::Info& info);
virtual void NoMoreItems();
virtual void DownloadedFile(const std::string& name,
- base::PlatformFileError error);
+ base::File::Error error);
// Scheduled when early directory reads are requested. The
// timeout will signal an ABORT error to the caller if the
@@ -77,8 +77,8 @@
// Delegate for GetFileInfo, called on the UI thread.
void GetFileInfoImpl(const base::FilePath& file_path,
- base::PlatformFileInfo* file_info,
- base::PlatformFileError* error);
+ base::File::Info* file_info,
+ base::File::Error* error);
// Delegate for ReadDirectory, called on the UI thread.
void ReadDirectoryImpl(
@@ -112,7 +112,7 @@
// Stores a map from filename to file metadata received from the camera.
base::hash_map<base::FilePath::StringType,
- base::PlatformFileInfo> file_info_;
+ base::File::Info> file_info_;
// List of filenames received from the camera.
std::vector<base::FilePath> file_paths_;
diff --git a/chrome/browser/media_galleries/mac/mtp_device_delegate_impl_mac.mm b/chrome/browser/media_galleries/mac/mtp_device_delegate_impl_mac.mm
index e76ed477..2daafa8 100644
--- a/chrome/browser/media_galleries/mac/mtp_device_delegate_impl_mac.mm
+++ b/chrome/browser/media_galleries/mac/mtp_device_delegate_impl_mac.mm
@@ -47,10 +47,10 @@
// ImageCaptureDeviceListener
virtual void ItemAdded(const std::string& name,
- const base::PlatformFileInfo& info) OVERRIDE;
+ const base::File::Info& info) OVERRIDE;
virtual void NoMoreItems() OVERRIDE;
virtual void DownloadedFile(const std::string& name,
- base::PlatformFileError error) OVERRIDE;
+ base::File::Error error) OVERRIDE;
virtual void DeviceRemoved() OVERRIDE;
// Used during delegate destruction to ensure there are no more calls
@@ -89,7 +89,7 @@
void MTPDeviceDelegateImplMac::DeviceListener::ItemAdded(
const std::string& name,
- const base::PlatformFileInfo& info) {
+ const base::File::Info& info) {
if (delegate_)
delegate_->ItemAdded(name, info);
}
@@ -101,7 +101,7 @@
void MTPDeviceDelegateImplMac::DeviceListener::DownloadedFile(
const std::string& name,
- base::PlatformFileError error) {
+ base::File::Error error) {
if (delegate_)
delegate_->DownloadedFile(name, error);
}
@@ -126,7 +126,7 @@
weak_factory_(this) {
// Make a synthetic entry for the root of the filesystem.
- base::PlatformFileInfo info;
+ base::File::Info info;
info.is_directory = true;
file_paths_.push_back(root_path_);
file_info_[root_path_.value()] = info;
@@ -144,11 +144,11 @@
namespace {
void ForwardGetFileInfo(
- base::PlatformFileInfo* info,
- base::PlatformFileError* error,
+ base::File::Info* info,
+ base::File::Error* error,
const GetFileInfoSuccessCallback& success_callback,
const ErrorCallback& error_callback) {
- if (*error == base::PLATFORM_FILE_OK)
+ if (*error == base::File::FILE_OK)
success_callback.Run(*info);
else
error_callback.Run(*error);
@@ -160,8 +160,8 @@
const base::FilePath& file_path,
const GetFileInfoSuccessCallback& success_callback,
const ErrorCallback& error_callback) {
- base::PlatformFileInfo* info = new base::PlatformFileInfo;
- base::PlatformFileError* error = new base::PlatformFileError;
+ base::File::Info* info = new base::File::Info;
+ base::File::Error* error = new base::File::Error;
// Note: ownership of these objects passed into the reply callback.
content::BrowserThread::PostTaskAndReply(content::BrowserThread::UI,
FROM_HERE,
@@ -214,18 +214,18 @@
void MTPDeviceDelegateImplMac::GetFileInfoImpl(
const base::FilePath& file_path,
- base::PlatformFileInfo* file_info,
- base::PlatformFileError* error) {
+ base::File::Info* file_info,
+ base::File::Error* error) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
base::hash_map<base::FilePath::StringType,
- base::PlatformFileInfo>::const_iterator i =
+ base::File::Info>::const_iterator i =
file_info_.find(file_path.value());
if (i == file_info_.end()) {
- *error = base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ *error = base::File::FILE_ERROR_NOT_FOUND;
return;
}
*file_info = i->second;
- *error = base::PLATFORM_FILE_OK;
+ *error = base::File::FILE_OK;
}
void MTPDeviceDelegateImplMac::ReadDirectoryImpl(
@@ -261,7 +261,7 @@
iter++;
continue;
}
- iter->error_callback.Run(base::PLATFORM_FILE_ERROR_ABORT);
+ iter->error_callback.Run(base::File::FILE_ERROR_ABORT);
iter = read_dir_transactions_.erase(iter);
}
}
@@ -273,10 +273,10 @@
const ErrorCallback& error_callback) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
- base::PlatformFileError error;
- base::PlatformFileInfo info;
+ base::File::Error error;
+ base::File::Info info;
GetFileInfoImpl(device_file_path, &info, &error);
- if (error != base::PLATFORM_FILE_OK) {
+ if (error != base::File::FILE_OK) {
content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE,
base::Bind(error_callback,
error));
@@ -317,21 +317,21 @@
iter != read_file_transactions_.end(); ++iter) {
content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE,
base::Bind(iter->error_callback,
- base::PLATFORM_FILE_ERROR_ABORT));
+ base::File::FILE_ERROR_ABORT));
}
read_file_transactions_.clear();
for (ReadDirTransactionList::iterator iter = read_dir_transactions_.begin();
iter != read_dir_transactions_.end(); ++iter) {
content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE,
- base::Bind(iter->error_callback, base::PLATFORM_FILE_ERROR_ABORT));
+ base::Bind(iter->error_callback, base::File::FILE_ERROR_ABORT));
}
read_dir_transactions_.clear();
}
// Called on the UI thread by the listener
void MTPDeviceDelegateImplMac::ItemAdded(
- const std::string& name, const base::PlatformFileInfo& info) {
+ const std::string& name, const base::File::Info& info) {
if (received_all_files_)
return;
@@ -386,7 +386,7 @@
base::FilePath relative_path;
read_path.AppendRelativePath(file_paths_[i], &relative_path);
- base::PlatformFileInfo info = file_info_[file_paths_[i].value()];
+ base::File::Info info = file_info_[file_paths_[i].value()];
fileapi::DirectoryEntry entry;
entry.name = relative_path.value();
entry.is_directory = info.is_directory;
@@ -403,7 +403,7 @@
content::BrowserThread::PostTask(content::BrowserThread::IO,
FROM_HERE,
base::Bind(iter->error_callback,
- base::PLATFORM_FILE_ERROR_NOT_FOUND));
+ base::File::FILE_ERROR_NOT_FOUND));
}
}
@@ -412,7 +412,7 @@
// Invoked on UI thread from the listener.
void MTPDeviceDelegateImplMac::DownloadedFile(
- const std::string& name, base::PlatformFileError error) {
+ const std::string& name, base::File::Error error) {
// If we're cancelled and deleting, we may have deleted the camera.
if (!camera_interface_.get())
return;
@@ -428,7 +428,7 @@
if (!found)
return;
- if (error != base::PLATFORM_FILE_OK) {
+ if (error != base::File::FILE_OK) {
content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE,
base::Bind(iter->error_callback, error));
read_file_transactions_.erase(iter);
@@ -445,7 +445,7 @@
item_filename = item_filename.Append(*i);
}
- base::PlatformFileInfo info = file_info_[item_filename.value()];
+ base::File::Info info = file_info_[item_filename.value()];
content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE,
base::Bind(iter->success_callback, info, iter->snapshot_file));
read_file_transactions_.erase(iter);
diff --git a/chrome/browser/media_galleries/mac/mtp_device_delegate_impl_mac_unittest.mm b/chrome/browser/media_galleries/mac/mtp_device_delegate_impl_mac_unittest.mm
index 7dbe116..89b55f9 100644
--- a/chrome/browser/media_galleries/mac/mtp_device_delegate_impl_mac_unittest.mm
+++ b/chrome/browser/media_galleries/mac/mtp_device_delegate_impl_mac_unittest.mm
@@ -6,6 +6,7 @@
#import <ImageCaptureCore/ImageCaptureCore.h>
#include "base/file_util.h"
+#include "base/files/file.h"
#include "base/files/scoped_temp_dir.h"
#include "base/mac/cocoa_protocols.h"
#include "base/mac/foundation_util.h"
@@ -194,20 +195,20 @@
io_thread_->Stop();
}
- void OnError(base::WaitableEvent* event, base::PlatformFileError error) {
+ void OnError(base::WaitableEvent* event, base::File::Error error) {
error_ = error;
event->Signal();
}
void OverlappedOnError(base::WaitableEvent* event,
- base::PlatformFileError error) {
+ base::File::Error error) {
overlapped_error_ = error;
event->Signal();
}
void OnFileInfo(base::WaitableEvent* event,
- const base::PlatformFileInfo& info) {
- error_ = base::PLATFORM_FILE_OK;
+ const base::File::Info& info) {
+ error_ = base::File::FILE_OK;
info_ = info;
event->Signal();
}
@@ -215,7 +216,7 @@
void OnReadDir(base::WaitableEvent* event,
const fileapi::AsyncFileUtil::EntryList& files,
bool has_more) {
- error_ = base::PLATFORM_FILE_OK;
+ error_ = base::File::FILE_OK;
ASSERT_FALSE(has_more);
file_list_ = files;
event->Signal();
@@ -224,21 +225,21 @@
void OverlappedOnReadDir(base::WaitableEvent* event,
const fileapi::AsyncFileUtil::EntryList& files,
bool has_more) {
- overlapped_error_ = base::PLATFORM_FILE_OK;
+ overlapped_error_ = base::File::FILE_OK;
ASSERT_FALSE(has_more);
overlapped_file_list_ = files;
event->Signal();
}
void OnDownload(base::WaitableEvent* event,
- const base::PlatformFileInfo& file_info,
+ const base::File::Info& file_info,
const base::FilePath& local_path) {
- error_ = base::PLATFORM_FILE_OK;
+ error_ = base::File::FILE_OK;
event->Signal();
}
- base::PlatformFileError GetFileInfo(const base::FilePath& path,
- base::PlatformFileInfo* info) {
+ base::File::Error GetFileInfo(const base::FilePath& path,
+ base::File::Info* info) {
base::WaitableEvent wait(true, false);
delegate_->GetFileInfo(
path,
@@ -255,7 +256,7 @@
return error_;
}
- base::PlatformFileError ReadDir(const base::FilePath& path) {
+ base::File::Error ReadDir(const base::FilePath& path) {
base::WaitableEvent wait(true, false);
delegate_->ReadDirectory(
path,
@@ -271,7 +272,7 @@
return error_;
}
- base::PlatformFileError DownloadFile(
+ base::File::Error DownloadFile(
const base::FilePath& path,
const base::FilePath& local_path) {
base::WaitableEvent wait(true, false);
@@ -302,11 +303,11 @@
// This object needs special deletion inside the above |task_runner_|.
MTPDeviceDelegateImplMac* delegate_;
- base::PlatformFileError error_;
- base::PlatformFileInfo info_;
+ base::File::Error error_;
+ base::File::Info info_;
fileapi::AsyncFileUtil::EntryList file_list_;
- base::PlatformFileError overlapped_error_;
+ base::File::Error overlapped_error_;
fileapi::AsyncFileUtil::EntryList overlapped_file_list_;
private:
@@ -314,25 +315,25 @@
};
TEST_F(MTPDeviceDelegateImplMacTest, TestGetRootFileInfo) {
- base::PlatformFileInfo info;
+ base::File::Info info;
// Making a fresh delegate should have a single file entry for the synthetic
// root directory, with the name equal to the device id string.
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
GetFileInfo(base::FilePath(kDevicePath), &info));
EXPECT_TRUE(info.is_directory);
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND,
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND,
GetFileInfo(base::FilePath("/nonexistent"), &info));
// Signal the delegate that no files are coming.
delegate_->NoMoreItems();
- EXPECT_EQ(base::PLATFORM_FILE_OK, ReadDir(base::FilePath(kDevicePath)));
+ EXPECT_EQ(base::File::FILE_OK, ReadDir(base::FilePath(kDevicePath)));
EXPECT_EQ(0U, file_list_.size());
}
TEST_F(MTPDeviceDelegateImplMacTest, TestOverlappedReadDir) {
base::Time time1 = base::Time::Now();
- base::PlatformFileInfo info1;
+ base::File::Info info1;
info1.size = 1;
info1.is_directory = false;
info1.is_symbolic_link = false;
@@ -369,15 +370,15 @@
loop.RunUntilIdle();
wait.Wait();
- EXPECT_EQ(base::PLATFORM_FILE_OK, error_);
+ EXPECT_EQ(base::File::FILE_OK, error_);
EXPECT_EQ(1U, file_list_.size());
- EXPECT_EQ(base::PLATFORM_FILE_OK, overlapped_error_);
+ EXPECT_EQ(base::File::FILE_OK, overlapped_error_);
EXPECT_EQ(1U, overlapped_file_list_.size());
}
TEST_F(MTPDeviceDelegateImplMacTest, TestGetFileInfo) {
base::Time time1 = base::Time::Now();
- base::PlatformFileInfo info1;
+ base::File::Info info1;
info1.size = 1;
info1.is_directory = false;
info1.is_symbolic_link = false;
@@ -386,8 +387,8 @@
info1.creation_time = time1;
delegate_->ItemAdded("name1", info1);
- base::PlatformFileInfo info;
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ base::File::Info info;
+ EXPECT_EQ(base::File::FILE_OK,
GetFileInfo(base::FilePath("/ic:id/name1"), &info));
EXPECT_EQ(info1.size, info.size);
EXPECT_EQ(info1.is_directory, info.is_directory);
@@ -399,11 +400,11 @@
delegate_->ItemAdded("name2", info1);
delegate_->NoMoreItems();
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
GetFileInfo(base::FilePath("/ic:id/name2"), &info));
EXPECT_EQ(info1.size, info.size);
- EXPECT_EQ(base::PLATFORM_FILE_OK, ReadDir(base::FilePath(kDevicePath)));
+ EXPECT_EQ(base::File::FILE_OK, ReadDir(base::FilePath(kDevicePath)));
ASSERT_EQ(2U, file_list_.size());
EXPECT_EQ(time1, file_list_[0].last_modified_time);
@@ -417,7 +418,7 @@
TEST_F(MTPDeviceDelegateImplMacTest, TestDirectoriesAndSorting) {
base::Time time1 = base::Time::Now();
- base::PlatformFileInfo info1;
+ base::File::Info info1;
info1.size = 1;
info1.is_directory = false;
info1.is_symbolic_link = false;
@@ -434,7 +435,7 @@
delegate_->ItemAdded("name1", info1);
delegate_->NoMoreItems();
- EXPECT_EQ(base::PLATFORM_FILE_OK, ReadDir(base::FilePath(kDevicePath)));
+ EXPECT_EQ(base::File::FILE_OK, ReadDir(base::FilePath(kDevicePath)));
ASSERT_EQ(4U, file_list_.size());
EXPECT_EQ("dir1", file_list_[0].name);
@@ -450,7 +451,7 @@
TEST_F(MTPDeviceDelegateImplMacTest, SubDirectories) {
base::Time time1 = base::Time::Now();
- base::PlatformFileInfo info1;
+ base::File::Info info1;
info1.size = 0;
info1.is_directory = true;
info1.is_symbolic_link = false;
@@ -486,7 +487,7 @@
delegate_->NoMoreItems();
- EXPECT_EQ(base::PLATFORM_FILE_OK, ReadDir(base::FilePath(kDevicePath)));
+ EXPECT_EQ(base::File::FILE_OK, ReadDir(base::FilePath(kDevicePath)));
ASSERT_EQ(3U, file_list_.size());
EXPECT_TRUE(file_list_[0].is_directory);
EXPECT_EQ("dir1", file_list_[0].name);
@@ -495,13 +496,13 @@
EXPECT_FALSE(file_list_[2].is_directory);
EXPECT_EQ("name4", file_list_[2].name);
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
ReadDir(base::FilePath(kDevicePath).Append("dir1")));
ASSERT_EQ(1U, file_list_.size());
EXPECT_FALSE(file_list_[0].is_directory);
EXPECT_EQ("name1", file_list_[0].name);
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
ReadDir(base::FilePath(kDevicePath).Append("dir2")));
ASSERT_EQ(2U, file_list_.size());
EXPECT_FALSE(file_list_[0].is_directory);
@@ -509,27 +510,27 @@
EXPECT_TRUE(file_list_[1].is_directory);
EXPECT_EQ("subdir", file_list_[1].name);
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
ReadDir(base::FilePath(kDevicePath)
.Append("dir2").Append("subdir")));
ASSERT_EQ(1U, file_list_.size());
EXPECT_FALSE(file_list_[0].is_directory);
EXPECT_EQ("name3", file_list_[0].name);
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND,
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND,
ReadDir(base::FilePath(kDevicePath)
.Append("dir2").Append("subdir").Append("subdir")));
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND,
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND,
ReadDir(base::FilePath(kDevicePath)
.Append("dir3").Append("subdir")));
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND,
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND,
ReadDir(base::FilePath(kDevicePath).Append("dir3")));
}
TEST_F(MTPDeviceDelegateImplMacTest, TestDownload) {
ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
base::Time t1 = base::Time::Now();
- base::PlatformFileInfo info;
+ base::File::Info info;
info.size = 4;
info.is_directory = false;
info.is_symbolic_link = false;
@@ -544,17 +545,17 @@
delegate_->ItemAdded(kTestFileName, info);
delegate_->NoMoreItems();
- EXPECT_EQ(base::PLATFORM_FILE_OK, ReadDir(base::FilePath(kDevicePath)));
+ EXPECT_EQ(base::File::FILE_OK, ReadDir(base::FilePath(kDevicePath)));
ASSERT_EQ(1U, file_list_.size());
ASSERT_EQ("filename", file_list_[0].name);
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND,
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND,
DownloadFile(base::FilePath("/ic:id/nonexist"),
temp_dir_.path().Append("target")));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
- DownloadFile(base::FilePath("/ic:id/filename"),
- temp_dir_.path().Append("target")));
+ EXPECT_EQ(base::File::FILE_OK,
+ DownloadFile(base::FilePath("/ic:id/filename"),
+ temp_dir_.path().Append("target")));
std::string contents;
EXPECT_TRUE(base::ReadFileToString(temp_dir_.path().Append("target"),
&contents));
diff --git a/chrome/browser/media_galleries/win/mtp_device_delegate_impl_win.cc b/chrome/browser/media_galleries/win/mtp_device_delegate_impl_win.cc
index fc81b28..24880a59 100644
--- a/chrome/browser/media_galleries/win/mtp_device_delegate_impl_win.cc
+++ b/chrome/browser/media_galleries/win/mtp_device_delegate_impl_win.cc
@@ -148,12 +148,12 @@
// Gets the |file_path| details from the MTP device specified by the
// |device_info.registered_device_path|. On success, |error| is set to
-// base::PLATFORM_FILE_OK and fills in |file_info|. On failure, |error| is set
+// base::File::FILE_OK and fills in |file_info|. On failure, |error| is set
// to corresponding platform file error and |file_info| is not set.
-base::PlatformFileError GetFileInfoOnBlockingPoolThread(
+base::File::Error GetFileInfoOnBlockingPoolThread(
const MTPDeviceDelegateImplWin::StorageDeviceInfo& device_info,
const base::FilePath& file_path,
- base::PlatformFileInfo* file_info) {
+ base::File::Info* file_info) {
base::ThreadRestrictions::AssertIOAllowed();
DCHECK(!device_info.registered_device_path.empty());
DCHECK(!file_path.empty());
@@ -162,36 +162,35 @@
PortableDeviceMapService::GetInstance()->GetPortableDevice(
device_info.registered_device_path);
if (!device)
- return base::PLATFORM_FILE_ERROR_FAILED;
+ return base::File::FILE_ERROR_FAILED;
base::string16 object_id =
GetFileObjectIdFromPathOnBlockingPoolThread(device_info, file_path);
if (object_id.empty())
- return base::PLATFORM_FILE_ERROR_FAILED;
+ return base::File::FILE_ERROR_FAILED;
return media_transfer_protocol::GetFileEntryInfo(device, object_id,
file_info);
}
// Reads the |root| directory file entries on a blocking pool thread. On
-// success, |error| is set to base::PLATFORM_FILE_OK and |entries| contains the
+// success, |error| is set to base::File::FILE_OK and |entries| contains the
// directory file entries. On failure, |error| is set to platform file error
// and |entries| is not set.
-base::PlatformFileError ReadDirectoryOnBlockingPoolThread(
+base::File::Error ReadDirectoryOnBlockingPoolThread(
const MTPDeviceDelegateImplWin::StorageDeviceInfo& device_info,
const base::FilePath& root,
fileapi::AsyncFileUtil::EntryList* entries) {
base::ThreadRestrictions::AssertIOAllowed();
DCHECK(!root.empty());
DCHECK(entries);
- base::PlatformFileInfo file_info;
- base::PlatformFileError error = GetFileInfoOnBlockingPoolThread(device_info,
- root,
- &file_info);
- if (error != base::PLATFORM_FILE_OK)
+ base::File::Info file_info;
+ base::File::Error error = GetFileInfoOnBlockingPoolThread(device_info, root,
+ &file_info);
+ if (error != base::File::FILE_OK)
return error;
if (!file_info.is_directory)
- return base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY;
+ return base::File::FILE_ERROR_NOT_A_DIRECTORY;
base::FilePath current;
scoped_ptr<MTPDeviceObjectEnumerator> file_enum =
@@ -212,10 +211,10 @@
// Gets the device file stream object on a blocking pool thread.
// |device_info| contains the device storage partition details.
-// On success, returns base::PLATFORM_FILE_OK and file stream details are set in
+// On success, returns base::File::FILE_OK and file stream details are set in
// |file_details|. On failure, returns a platform file error and file stream
// details are not set in |file_details|.
-base::PlatformFileError GetFileStreamOnBlockingPoolThread(
+base::File::Error GetFileStreamOnBlockingPoolThread(
const MTPDeviceDelegateImplWin::StorageDeviceInfo& device_info,
SnapshotFileDetails* file_details) {
base::ThreadRestrictions::AssertIOAllowed();
@@ -226,21 +225,21 @@
PortableDeviceMapService::GetInstance()->GetPortableDevice(
device_info.registered_device_path);
if (!device)
- return base::PLATFORM_FILE_ERROR_FAILED;
+ return base::File::FILE_ERROR_FAILED;
base::string16 file_object_id =
GetFileObjectIdFromPathOnBlockingPoolThread(
device_info, file_details->request_info().device_file_path);
if (file_object_id.empty())
- return base::PLATFORM_FILE_ERROR_FAILED;
+ return base::File::FILE_ERROR_FAILED;
- base::PlatformFileInfo file_info;
- base::PlatformFileError error =
+ base::File::Info file_info;
+ base::File::Error error =
GetFileInfoOnBlockingPoolThread(
device_info,
file_details->request_info().device_file_path,
&file_info);
- if (error != base::PLATFORM_FILE_OK)
+ if (error != base::File::FILE_OK)
return error;
DWORD optimal_transfer_size = 0;
@@ -252,7 +251,7 @@
file_stream.Receive(),
&optimal_transfer_size);
if (hr != S_OK)
- return base::PLATFORM_FILE_ERROR_FAILED;
+ return base::File::FILE_ERROR_FAILED;
}
// LocalFileStreamReader is used to read the contents of the snapshot file.
@@ -348,8 +347,8 @@
MTPDeviceDelegateImplWin::PendingTaskInfo::PendingTaskInfo(
const tracked_objects::Location& location,
- const base::Callback<base::PlatformFileError(void)>& task,
- const base::Callback<void(base::PlatformFileError)>& reply)
+ const base::Callback<base::File::Error(void)>& task,
+ const base::Callback<void(base::File::Error)>& reply)
: location(location),
task(task),
reply(reply) {
@@ -382,7 +381,7 @@
const ErrorCallback& error_callback) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
DCHECK(!file_path.empty());
- base::PlatformFileInfo* file_info = new base::PlatformFileInfo;
+ base::File::Info* file_info = new base::File::Info;
EnsureInitAndRunTask(
PendingTaskInfo(FROM_HERE,
base::Bind(&GetFileInfoOnBlockingPoolThread,
@@ -531,11 +530,11 @@
void MTPDeviceDelegateImplWin::OnGetFileInfo(
const GetFileInfoSuccessCallback& success_callback,
const ErrorCallback& error_callback,
- base::PlatformFileInfo* file_info,
- base::PlatformFileError error) {
+ base::File::Info* file_info,
+ base::File::Error error) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
DCHECK(file_info);
- if (error == base::PLATFORM_FILE_OK)
+ if (error == base::File::FILE_OK)
success_callback.Run(*file_info);
else
error_callback.Run(error);
@@ -547,10 +546,10 @@
const ReadDirectorySuccessCallback& success_callback,
const ErrorCallback& error_callback,
fileapi::AsyncFileUtil::EntryList* file_list,
- base::PlatformFileError error) {
+ base::File::Error error) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
DCHECK(file_list);
- if (error == base::PLATFORM_FILE_OK)
+ if (error == base::File::FILE_OK)
success_callback.Run(*file_list, false /*no more entries*/);
else
error_callback.Run(error);
@@ -560,13 +559,13 @@
void MTPDeviceDelegateImplWin::OnGetFileStream(
scoped_ptr<SnapshotFileDetails> file_details,
- base::PlatformFileError error) {
+ base::File::Error error) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
DCHECK(file_details);
DCHECK(!file_details->request_info().device_file_path.empty());
DCHECK(!file_details->request_info().snapshot_file_path.empty());
DCHECK(!current_snapshot_details_.get());
- if (error != base::PLATFORM_FILE_OK) {
+ if (error != base::File::FILE_OK) {
file_details->request_info().error_callback.Run(error);
task_in_progress_ = false;
ProcessNextPendingRequest();
@@ -615,7 +614,7 @@
current_snapshot_details_->request_info().snapshot_file_path);
} else {
current_snapshot_details_->request_info().error_callback.Run(
- base::PLATFORM_FILE_ERROR_FAILED);
+ base::File::FILE_ERROR_FAILED);
}
task_in_progress_ = false;
current_snapshot_details_.reset();
diff --git a/chrome/browser/media_galleries/win/mtp_device_delegate_impl_win.h b/chrome/browser/media_galleries/win/mtp_device_delegate_impl_win.h
index e3f8c05..e88b7c2 100644
--- a/chrome/browser/media_galleries/win/mtp_device_delegate_impl_win.h
+++ b/chrome/browser/media_galleries/win/mtp_device_delegate_impl_win.h
@@ -8,10 +8,10 @@
#include <queue>
#include "base/callback.h"
+#include "base/files/file.h"
#include "base/location.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
-#include "base/platform_file.h"
#include "base/strings/string16.h"
#include "base/win/scoped_comptr.h"
#include "chrome/browser/media_galleries/fileapi/mtp_device_async_delegate.h"
@@ -72,12 +72,12 @@
// Used to represent pending task details.
struct PendingTaskInfo {
PendingTaskInfo(const tracked_objects::Location& location,
- const base::Callback<base::PlatformFileError(void)>& task,
- const base::Callback<void(base::PlatformFileError)>& reply);
+ const base::Callback<base::File::Error(void)>& task,
+ const base::Callback<void(base::File::Error)>& reply);
const tracked_objects::Location location;
- const base::Callback<base::PlatformFileError(void)> task;
- const base::Callback<void(base::PlatformFileError)> reply;
+ const base::Callback<base::File::Error(void)> task;
+ const base::Callback<void(base::File::Error)> reply;
};
// Defers the device initializations until the first file operation request.
@@ -146,8 +146,8 @@
// invoked to notify the caller about the platform file |error|.
void OnGetFileInfo(const GetFileInfoSuccessCallback& success_callback,
const ErrorCallback& error_callback,
- base::PlatformFileInfo* file_info,
- base::PlatformFileError error);
+ base::File::Info* file_info,
+ base::File::Error error);
// Called when ReadDirectory() completes. |file_list| contains the directory
// file entries information. |error| specifies the platform file error code.
@@ -160,7 +160,7 @@
void OnDidReadDirectory(const ReadDirectorySuccessCallback& success_callback,
const ErrorCallback& error_callback,
fileapi::AsyncFileUtil::EntryList* file_list,
- base::PlatformFileError error);
+ base::File::Error error);
// Called when the get file stream request completes.
// |file_details.request_info| contains the CreateSnapshot request param
@@ -172,7 +172,7 @@
//
// If the get file stream request fails, |error| is set accordingly.
void OnGetFileStream(scoped_ptr<SnapshotFileDetails> file_details,
- base::PlatformFileError error);
+ base::File::Error error);
// Called when WriteDataChunkIntoSnapshotFile() completes.
// |bytes_written| specifies the number of bytes written into the
diff --git a/chrome/browser/media_galleries/win/mtp_device_operations_util.cc b/chrome/browser/media_galleries/win/mtp_device_operations_util.cc
index f2c681d..c120637 100644
--- a/chrome/browser/media_galleries/win/mtp_device_operations_util.cc
+++ b/chrome/browser/media_galleries/win/mtp_device_operations_util.cc
@@ -316,16 +316,16 @@
return base::win::ScopedComPtr<IPortableDevice>();
}
-base::PlatformFileError GetFileEntryInfo(
+base::File::Error GetFileEntryInfo(
IPortableDevice* device,
const base::string16& object_id,
- base::PlatformFileInfo* file_entry_info) {
+ base::File::Info* file_entry_info) {
DCHECK(device);
DCHECK(!object_id.empty());
DCHECK(file_entry_info);
MTPDeviceObjectEntry entry;
if (!GetMTPDeviceObjectEntry(device, object_id, &entry))
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ return base::File::FILE_ERROR_NOT_FOUND;
file_entry_info->size = entry.size;
file_entry_info->is_directory = entry.is_directory;
@@ -333,7 +333,7 @@
file_entry_info->last_modified = entry.last_modified_time;
file_entry_info->last_accessed = entry.last_modified_time;
file_entry_info->creation_time = base::Time();
- return base::PLATFORM_FILE_OK;
+ return base::File::FILE_OK;
}
bool GetDirectoryEntries(IPortableDevice* device,
diff --git a/chrome/browser/media_galleries/win/mtp_device_operations_util.h b/chrome/browser/media_galleries/win/mtp_device_operations_util.h
index d617b83..a45f9651 100644
--- a/chrome/browser/media_galleries/win/mtp_device_operations_util.h
+++ b/chrome/browser/media_galleries/win/mtp_device_operations_util.h
@@ -15,7 +15,7 @@
#include <string>
-#include "base/platform_file.h"
+#include "base/files/file.h"
#include "base/strings/string16.h"
#include "base/win/scoped_comptr.h"
#include "chrome/browser/media_galleries/win/mtp_device_object_entry.h"
@@ -32,10 +32,10 @@
// |device|. On success, returns no error (base::PLATFORM_FILE_OK) and fills in
// |file_entry_info|. On failure, returns the corresponding platform file error
// and |file_entry_info| is not set.
-base::PlatformFileError GetFileEntryInfo(
+base::File::Error GetFileEntryInfo(
IPortableDevice* device,
const base::string16& object_id,
- base::PlatformFileInfo* file_entry_info);
+ base::File::Info* file_entry_info);
// Gets the entries of the directory specified by |directory_object_id| from
// the given MTP |device|. On success, returns true and fills in
diff --git a/chrome/browser/media_galleries/win/snapshot_file_details.cc b/chrome/browser/media_galleries/win/snapshot_file_details.cc
index 093ef048..a514eea 100644
--- a/chrome/browser/media_galleries/win/snapshot_file_details.cc
+++ b/chrome/browser/media_galleries/win/snapshot_file_details.cc
@@ -37,8 +37,7 @@
file_stream_.Release();
}
-void SnapshotFileDetails::set_file_info(
- const base::PlatformFileInfo& file_info) {
+void SnapshotFileDetails::set_file_info(const base::File::Info& file_info) {
file_info_ = file_info;
}
diff --git a/chrome/browser/media_galleries/win/snapshot_file_details.h b/chrome/browser/media_galleries/win/snapshot_file_details.h
index f9e4dba..2ae6911 100644
--- a/chrome/browser/media_galleries/win/snapshot_file_details.h
+++ b/chrome/browser/media_galleries/win/snapshot_file_details.h
@@ -5,8 +5,8 @@
#ifndef CHROME_BROWSER_MEDIA_GALLERIES_WIN_SNAPSHOT_FILE_DETAILS_H_
#define CHROME_BROWSER_MEDIA_GALLERIES_WIN_SNAPSHOT_FILE_DETAILS_H_
+#include "base/files/file.h"
#include "base/files/file_path.h"
-#include "base/platform_file.h"
#include "base/win/scoped_comptr.h"
#include "chrome/browser/media_galleries/fileapi/mtp_device_async_delegate.h"
@@ -39,7 +39,7 @@
explicit SnapshotFileDetails(const SnapshotRequestInfo& request_info);
~SnapshotFileDetails();
- void set_file_info(const base::PlatformFileInfo& file_info);
+ void set_file_info(const base::File::Info& file_info);
void set_device_file_stream(IStream* file_stream);
void set_optimal_transfer_size(DWORD optimal_transfer_size);
@@ -47,7 +47,7 @@
return request_info_;
}
- base::PlatformFileInfo file_info() const {
+ base::File::Info file_info() const {
return file_info_;
}
@@ -77,7 +77,7 @@
SnapshotRequestInfo request_info_;
// Metadata of the created snapshot file.
- base::PlatformFileInfo file_info_;
+ base::File::Info file_info_;
// Used to read the device file contents.
base::win::ScopedComPtr<IStream> file_stream_;
diff --git a/chrome/browser/storage_monitor/image_capture_device.h b/chrome/browser/storage_monitor/image_capture_device.h
index 76652ba..2ad15950 100644
--- a/chrome/browser/storage_monitor/image_capture_device.h
+++ b/chrome/browser/storage_monitor/image_capture_device.h
@@ -8,13 +8,13 @@
#import <Foundation/Foundation.h>
#import <ImageCaptureCore/ImageCaptureCore.h>
+#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/mac/cocoa_protocols.h"
#include "base/mac/foundation_util.h"
#include "base/mac/scoped_nsobject.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
-#include "base/platform_file.h"
#include "base/strings/string_util.h"
#include "base/strings/sys_string_conversions.h"
#include "base/synchronization/lock.h"
@@ -34,7 +34,7 @@
// be passed as "dir/subdir/filename". These same relative filenames should
// be used as keys to download files.
virtual void ItemAdded(const std::string& name,
- const base::PlatformFileInfo& info) = 0;
+ const base::File::Info& info) = 0;
// Called when there are no more items to retrieve.
virtual void NoMoreItems() = 0;
@@ -43,7 +43,7 @@
// Note: in NOT_FOUND error case, may be called inline with the download
// request.
virtual void DownloadedFile(const std::string& name,
- base::PlatformFileError error) = 0;
+ base::File::Error error) = 0;
// Called to let the client know the device is removed. The client should
// set the ImageCaptureDevice listener to null upon receiving this call.
diff --git a/chrome/browser/storage_monitor/image_capture_device.mm b/chrome/browser/storage_monitor/image_capture_device.mm
index dfbb606..03ed119 100644
--- a/chrome/browser/storage_monitor/image_capture_device.mm
+++ b/chrome/browser/storage_monitor/image_capture_device.mm
@@ -9,17 +9,17 @@
namespace {
-base::PlatformFileError RenameFile(const base::FilePath& downloaded_filename,
- const base::FilePath& desired_filename) {
+base::File::Error RenameFile(const base::FilePath& downloaded_filename,
+ const base::FilePath& desired_filename) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE));
bool success = base::ReplaceFile(downloaded_filename, desired_filename, NULL);
- return success ? base::PLATFORM_FILE_OK : base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ return success ? base::File::FILE_OK : base::File::FILE_ERROR_NOT_FOUND;
}
void ReturnRenameResultToListener(
base::WeakPtr<ImageCaptureDeviceListener> listener,
const std::string& name,
- const base::PlatformFileError& result) {
+ const base::File::Error& result) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
if (listener)
listener->DownloadedFile(name, result);
@@ -127,11 +127,11 @@
}
if (listener_)
- listener_->DownloadedFile(name, base::PLATFORM_FILE_ERROR_NOT_FOUND);
+ listener_->DownloadedFile(name, base::File::FILE_ERROR_NOT_FOUND);
}
- (void)cameraDevice:(ICCameraDevice*)camera didAddItem:(ICCameraItem*)item {
- base::PlatformFileInfo info;
+ base::File::Info info;
if ([[item UTI] isEqualToString:base::mac::CFToNSCast(kUTTypeFolder)])
info.is_directory = true;
else
@@ -186,10 +186,10 @@
std::string name = PathForCameraItem(file).value();
if (error) {
- DLOG(INFO) << "error..."
- << base::SysNSStringToUTF8([error localizedDescription]);
+ DVLOG(1) << "error..."
+ << base::SysNSStringToUTF8([error localizedDescription]);
if (listener_)
- listener_->DownloadedFile(name, base::PLATFORM_FILE_ERROR_FAILED);
+ listener_->DownloadedFile(name, base::File::FILE_ERROR_FAILED);
return;
}
@@ -199,7 +199,7 @@
base::SysNSStringToUTF8([options objectForKey:ICSaveAsFilename]);
if (savedFilename == saveAsFilename) {
if (listener_)
- listener_->DownloadedFile(name, base::PLATFORM_FILE_OK);
+ listener_->DownloadedFile(name, base::File::FILE_OK);
return;
}
diff --git a/chrome/browser/storage_monitor/image_capture_device_manager_unittest.mm b/chrome/browser/storage_monitor/image_capture_device_manager_unittest.mm
index 42f0a421..6d8492d 100644
--- a/chrome/browser/storage_monitor/image_capture_device_manager_unittest.mm
+++ b/chrome/browser/storage_monitor/image_capture_device_manager_unittest.mm
@@ -214,11 +214,11 @@
TestCameraListener()
: completed_(false),
removed_(false),
- last_error_(base::PLATFORM_FILE_ERROR_INVALID_URL) {}
+ last_error_(base::File::FILE_ERROR_INVALID_URL) {}
virtual ~TestCameraListener() {}
virtual void ItemAdded(const std::string& name,
- const base::PlatformFileInfo& info) OVERRIDE {
+ const base::File::Info& info) OVERRIDE {
items_.push_back(name);
}
@@ -227,7 +227,7 @@
}
virtual void DownloadedFile(const std::string& name,
- base::PlatformFileError error) OVERRIDE {
+ base::File::Error error) OVERRIDE {
EXPECT_TRUE(content::BrowserThread::CurrentlyOn(
content::BrowserThread::UI));
downloads_.push_back(name);
@@ -242,14 +242,14 @@
std::vector<std::string> downloads() const { return downloads_; }
bool completed() const { return completed_; }
bool removed() const { return removed_; }
- base::PlatformFileError last_error() const { return last_error_; }
+ base::File::Error last_error() const { return last_error_; }
private:
std::vector<std::string> items_;
std::vector<std::string> downloads_;
bool completed_;
bool removed_;
- base::PlatformFileError last_error_;
+ base::File::Error last_error_;
};
class ImageCaptureDeviceManagerTest : public testing::Test {
@@ -377,7 +377,7 @@
base::RunLoop().RunUntilIdle();
ASSERT_EQ(1U, listener_.downloads().size());
EXPECT_EQ("nonexistent", listener_.downloads()[0]);
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, listener_.last_error());
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND, listener_.last_error());
// Test that an existing file we ask to be downloaded will end up in
// the location we specify. The mock system will copy testing file
@@ -389,7 +389,7 @@
ASSERT_EQ(2U, listener_.downloads().size());
EXPECT_EQ(kTestFileName, listener_.downloads()[1]);
- ASSERT_EQ(base::PLATFORM_FILE_OK, listener_.last_error());
+ ASSERT_EQ(base::File::FILE_OK, listener_.last_error());
char file_contents[5];
ASSERT_EQ(4, base::ReadFile(temp_file, file_contents,
strlen(kTestFileContents)));
diff --git a/chrome/browser/sync_file_system/drive_backend/drive_backend_sync_unittest.cc b/chrome/browser/sync_file_system/drive_backend/drive_backend_sync_unittest.cc
index bfc2daa..819a2a2b 100644
--- a/chrome/browser/sync_file_system/drive_backend/drive_backend_sync_unittest.cc
+++ b/chrome/browser/sync_file_system/drive_backend/drive_backend_sync_unittest.cc
@@ -144,7 +144,7 @@
file_system->backend()->sync_context()->
set_mock_notify_changes_duration_in_sec(0);
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system->OpenFileSystem());
+ EXPECT_EQ(base::File::FILE_OK, file_system->OpenFileSystem());
file_systems_[app_id] = file_system;
}
@@ -157,7 +157,7 @@
void AddLocalFolder(const std::string& app_id,
const base::FilePath::StringType& path) {
ASSERT_TRUE(ContainsKey(file_systems_, app_id));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_systems_[app_id]->CreateDirectory(
CreateURL(app_id, path)));
}
@@ -167,7 +167,7 @@
const std::string& content) {
fileapi::FileSystemURL url(CreateURL(app_id, path));
ASSERT_TRUE(ContainsKey(file_systems_, app_id));
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_systems_[app_id]->CreateFile(url));
+ EXPECT_EQ(base::File::FILE_OK, file_systems_[app_id]->CreateFile(url));
int64 bytes_written = file_systems_[app_id]->WriteString(url, content);
EXPECT_EQ(static_cast<int64>(content.size()), bytes_written);
base::RunLoop().RunUntilIdle();
@@ -186,7 +186,7 @@
void RemoveLocal(const std::string& app_id,
const base::FilePath::StringType& path) {
ASSERT_TRUE(ContainsKey(file_systems_, app_id));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_systems_[app_id]->Remove(
CreateURL(app_id, path),
true /* recursive */));
@@ -305,7 +305,7 @@
fileapi::FileSystemURL url(CreateURL(app_id, path));
CannedSyncableFileSystem::FileEntryList local_entries;
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system->ReadDirectory(url, &local_entries));
for (CannedSyncableFileSystem::FileEntryList::iterator itr =
local_entries.begin();
@@ -343,7 +343,7 @@
std::string file_content;
EXPECT_EQ(google_apis::HTTP_SUCCESS,
fake_drive_service_helper_->ReadFile(file_id, &file_content));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system->VerifyFile(url, file_content));
}
diff --git a/chrome/browser/sync_file_system/drive_backend_v1/drive_file_sync_service_sync_unittest.cc b/chrome/browser/sync_file_system/drive_backend_v1/drive_file_sync_service_sync_unittest.cc
index 27d4275..dc6c771 100644
--- a/chrome/browser/sync_file_system/drive_backend_v1/drive_file_sync_service_sync_unittest.cc
+++ b/chrome/browser/sync_file_system/drive_backend_v1/drive_file_sync_service_sync_unittest.cc
@@ -135,7 +135,7 @@
file_system->backend()->sync_context()->
set_mock_notify_changes_duration_in_sec(0);
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system->OpenFileSystem());
+ EXPECT_EQ(base::File::FILE_OK, file_system->OpenFileSystem());
file_systems_[origin] = file_system;
}
@@ -151,7 +151,7 @@
const std::string& content) {
fileapi::FileSystemURL url(CreateSyncableFileSystemURL(origin, path));
ASSERT_TRUE(ContainsKey(file_systems_, origin));
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_systems_[origin]->CreateFile(url));
+ EXPECT_EQ(base::File::FILE_OK, file_systems_[origin]->CreateFile(url));
int64 bytes_written = file_systems_[origin]->WriteString(url, content);
EXPECT_EQ(static_cast<int64>(content.size()), bytes_written);
FlushMessageLoop();
@@ -169,7 +169,7 @@
void RemoveLocal(const GURL& origin, const base::FilePath& path) {
ASSERT_TRUE(ContainsKey(file_systems_, origin));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_systems_[origin]->Remove(
CreateSyncableFileSystemURL(origin, path),
true /* recursive */));
@@ -300,7 +300,7 @@
fileapi::FileSystemURL url(CreateSyncableFileSystemURL(origin, path));
CannedSyncableFileSystem::FileEntryList local_entries;
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system->ReadDirectory(url, &local_entries));
for (CannedSyncableFileSystem::FileEntryList::iterator itr =
local_entries.begin();
@@ -337,7 +337,7 @@
std::string file_content;
EXPECT_EQ(google_apis::HTTP_SUCCESS,
fake_drive_helper_->ReadFile(file_id, &file_content));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system->VerifyFile(url, file_content));
}
diff --git a/chrome/browser/sync_file_system/local/canned_syncable_file_system.cc b/chrome/browser/sync_file_system/local/canned_syncable_file_system.cc
index 7f15131..12e9470 100644
--- a/chrome/browser/sync_file_system/local/canned_syncable_file_system.cc
+++ b/chrome/browser/sync_file_system/local/canned_syncable_file_system.cc
@@ -10,6 +10,7 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/file_util.h"
+#include "base/files/file.h"
#include "base/guid.h"
#include "base/message_loop/message_loop_proxy.h"
#include "base/run_loop.h"
@@ -32,7 +33,7 @@
#include "webkit/browser/quota/quota_manager.h"
#include "webkit/common/blob/shareable_file_reference.h"
-using base::PlatformFileError;
+using base::File;
using fileapi::FileSystemContext;
using fileapi::FileSystemOperationRunner;
using fileapi::FileSystemURL;
@@ -98,11 +99,11 @@
void OnCreateSnapshotFileAndVerifyData(
const std::string& expected_data,
const CannedSyncableFileSystem::StatusCallback& callback,
- base::PlatformFileError result,
- const base::PlatformFileInfo& file_info,
+ base::File::Error result,
+ const base::File::Info& file_info,
const base::FilePath& platform_path,
const scoped_refptr<webkit_blob::ShareableFileReference>& /* file_ref */) {
- if (result != base::PLATFORM_FILE_OK) {
+ if (result != base::File::FILE_OK) {
callback.Run(result);
return;
}
@@ -115,11 +116,11 @@
}
void OnCreateSnapshotFile(
- base::PlatformFileInfo* file_info_out,
+ base::File::Info* file_info_out,
base::FilePath* platform_path_out,
const CannedSyncableFileSystem::StatusCallback& callback,
- base::PlatformFileError result,
- const base::PlatformFileInfo& file_info,
+ base::File::Error result,
+ const base::File::Info& file_info,
const base::FilePath& platform_path,
const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref) {
DCHECK(!file_ref.get());
@@ -133,7 +134,7 @@
void OnReadDirectory(
CannedSyncableFileSystem::FileEntryList* entries_out,
const CannedSyncableFileSystem::StatusCallback& callback,
- base::PlatformFileError error,
+ base::File::Error error,
const fileapi::FileSystemOperation::FileEntryList& entries,
bool has_more) {
DCHECK(entries_out);
@@ -166,14 +167,14 @@
ScopedTextBlob* scoped_text_blob() const { return blob_data_.get(); }
void DidWrite(const base::Callback<void(int64 result)>& completion_callback,
- PlatformFileError error, int64 bytes, bool complete) {
- if (error == base::PLATFORM_FILE_OK) {
+ File::Error error, int64 bytes, bool complete) {
+ if (error == base::File::FILE_OK) {
bytes_written_ += bytes;
if (!complete)
return;
}
- completion_callback.Run(error == base::PLATFORM_FILE_OK
- ? bytes_written_ : static_cast<int64>(error));
+ completion_callback.Run(error == base::File::FILE_OK ?
+ bytes_written_ : static_cast<int64>(error));
}
private:
@@ -208,7 +209,7 @@
base::SingleThreadTaskRunner* file_task_runner)
: origin_(origin),
type_(fileapi::kFileSystemTypeSyncable),
- result_(base::PLATFORM_FILE_OK),
+ result_(base::File::FILE_OK),
sync_status_(sync_file_system::SYNC_STATUS_OK),
io_task_runner_(io_task_runner),
file_task_runner_(file_task_runner),
@@ -270,7 +271,7 @@
return file_system_context_->CrackURL(url);
}
-PlatformFileError CannedSyncableFileSystem::OpenFileSystem() {
+File::Error CannedSyncableFileSystem::OpenFileSystem() {
EXPECT_TRUE(is_filesystem_set_up_);
io_task_runner_->PostTask(
@@ -318,9 +319,9 @@
return sync_status_;
}
-PlatformFileError CannedSyncableFileSystem::CreateDirectory(
+File::Error CannedSyncableFileSystem::CreateDirectory(
const FileSystemURL& url) {
- return RunOnThread<PlatformFileError>(
+ return RunOnThread<File::Error>(
io_task_runner_.get(),
FROM_HERE,
base::Bind(&CannedSyncableFileSystem::DoCreateDirectory,
@@ -328,9 +329,8 @@
url));
}
-PlatformFileError CannedSyncableFileSystem::CreateFile(
- const FileSystemURL& url) {
- return RunOnThread<PlatformFileError>(
+File::Error CannedSyncableFileSystem::CreateFile(const FileSystemURL& url) {
+ return RunOnThread<File::Error>(
io_task_runner_.get(),
FROM_HERE,
base::Bind(&CannedSyncableFileSystem::DoCreateFile,
@@ -338,9 +338,9 @@
url));
}
-PlatformFileError CannedSyncableFileSystem::Copy(
+File::Error CannedSyncableFileSystem::Copy(
const FileSystemURL& src_url, const FileSystemURL& dest_url) {
- return RunOnThread<PlatformFileError>(
+ return RunOnThread<File::Error>(
io_task_runner_.get(),
FROM_HERE,
base::Bind(&CannedSyncableFileSystem::DoCopy,
@@ -349,9 +349,9 @@
dest_url));
}
-PlatformFileError CannedSyncableFileSystem::Move(
+File::Error CannedSyncableFileSystem::Move(
const FileSystemURL& src_url, const FileSystemURL& dest_url) {
- return RunOnThread<PlatformFileError>(
+ return RunOnThread<File::Error>(
io_task_runner_.get(),
FROM_HERE,
base::Bind(&CannedSyncableFileSystem::DoMove,
@@ -360,9 +360,9 @@
dest_url));
}
-PlatformFileError CannedSyncableFileSystem::TruncateFile(
+File::Error CannedSyncableFileSystem::TruncateFile(
const FileSystemURL& url, int64 size) {
- return RunOnThread<PlatformFileError>(
+ return RunOnThread<File::Error>(
io_task_runner_.get(),
FROM_HERE,
base::Bind(&CannedSyncableFileSystem::DoTruncateFile,
@@ -371,11 +371,11 @@
size));
}
-PlatformFileError CannedSyncableFileSystem::TouchFile(
+File::Error CannedSyncableFileSystem::TouchFile(
const FileSystemURL& url,
const base::Time& last_access_time,
const base::Time& last_modified_time) {
- return RunOnThread<PlatformFileError>(
+ return RunOnThread<File::Error>(
io_task_runner_.get(),
FROM_HERE,
base::Bind(&CannedSyncableFileSystem::DoTouchFile,
@@ -385,9 +385,9 @@
last_modified_time));
}
-PlatformFileError CannedSyncableFileSystem::Remove(
+File::Error CannedSyncableFileSystem::Remove(
const FileSystemURL& url, bool recursive) {
- return RunOnThread<PlatformFileError>(
+ return RunOnThread<File::Error>(
io_task_runner_.get(),
FROM_HERE,
base::Bind(&CannedSyncableFileSystem::DoRemove,
@@ -396,9 +396,9 @@
recursive));
}
-PlatformFileError CannedSyncableFileSystem::FileExists(
+File::Error CannedSyncableFileSystem::FileExists(
const FileSystemURL& url) {
- return RunOnThread<PlatformFileError>(
+ return RunOnThread<File::Error>(
io_task_runner_.get(),
FROM_HERE,
base::Bind(&CannedSyncableFileSystem::DoFileExists,
@@ -406,9 +406,9 @@
url));
}
-PlatformFileError CannedSyncableFileSystem::DirectoryExists(
+File::Error CannedSyncableFileSystem::DirectoryExists(
const FileSystemURL& url) {
- return RunOnThread<PlatformFileError>(
+ return RunOnThread<File::Error>(
io_task_runner_.get(),
FROM_HERE,
base::Bind(&CannedSyncableFileSystem::DoDirectoryExists,
@@ -416,10 +416,10 @@
url));
}
-PlatformFileError CannedSyncableFileSystem::VerifyFile(
+File::Error CannedSyncableFileSystem::VerifyFile(
const FileSystemURL& url,
const std::string& expected_data) {
- return RunOnThread<PlatformFileError>(
+ return RunOnThread<File::Error>(
io_task_runner_.get(),
FROM_HERE,
base::Bind(&CannedSyncableFileSystem::DoVerifyFile,
@@ -428,11 +428,11 @@
expected_data));
}
-PlatformFileError CannedSyncableFileSystem::GetMetadataAndPlatformPath(
+File::Error CannedSyncableFileSystem::GetMetadataAndPlatformPath(
const FileSystemURL& url,
- base::PlatformFileInfo* info,
+ base::File::Info* info,
base::FilePath* platform_path) {
- return RunOnThread<PlatformFileError>(
+ return RunOnThread<File::Error>(
io_task_runner_.get(),
FROM_HERE,
base::Bind(&CannedSyncableFileSystem::DoGetMetadataAndPlatformPath,
@@ -442,10 +442,10 @@
platform_path));
}
-PlatformFileError CannedSyncableFileSystem::ReadDirectory(
+File::Error CannedSyncableFileSystem::ReadDirectory(
const fileapi::FileSystemURL& url,
FileEntryList* entries) {
- return RunOnThread<PlatformFileError>(
+ return RunOnThread<File::Error>(
io_task_runner_.get(),
FROM_HERE,
base::Bind(&CannedSyncableFileSystem::DoReadDirectory,
@@ -477,9 +477,9 @@
data));
}
-PlatformFileError CannedSyncableFileSystem::DeleteFileSystem() {
+File::Error CannedSyncableFileSystem::DeleteFileSystem() {
EXPECT_TRUE(is_filesystem_set_up_);
- return RunOnThread<PlatformFileError>(
+ return RunOnThread<File::Error>(
io_task_runner_.get(),
FROM_HERE,
base::Bind(&FileSystemContext::DeleteFileSystem,
@@ -651,7 +651,7 @@
void CannedSyncableFileSystem::DoGetMetadataAndPlatformPath(
const FileSystemURL& url,
- base::PlatformFileInfo* info,
+ base::File::Info* info,
base::FilePath* platform_path,
const StatusCallback& callback) {
EXPECT_TRUE(io_task_runner_->RunsTasksOnCurrentThread());
@@ -714,7 +714,7 @@
base::SingleThreadTaskRunner* original_task_runner,
const GURL& root,
const std::string& name,
- PlatformFileError result) {
+ File::Error result) {
if (io_task_runner_->RunsTasksOnCurrentThread()) {
EXPECT_FALSE(is_filesystem_opened_);
is_filesystem_opened_ = true;
diff --git a/chrome/browser/sync_file_system/local/canned_syncable_file_system.h b/chrome/browser/sync_file_system/local/canned_syncable_file_system.h
index 2112f46..0ef388d 100644
--- a/chrome/browser/sync_file_system/local/canned_syncable_file_system.h
+++ b/chrome/browser/sync_file_system/local/canned_syncable_file_system.h
@@ -9,10 +9,10 @@
#include <vector>
#include "base/callback_forward.h"
+#include "base/files/file.h"
#include "base/files/scoped_temp_dir.h"
#include "base/message_loop/message_loop.h"
#include "base/observer_list_threadsafe.h"
-#include "base/platform_file.h"
#include "chrome/browser/sync_file_system/local/local_file_sync_status.h"
#include "chrome/browser/sync_file_system/sync_status_code.h"
#include "webkit/browser/blob/blob_data_handle.h"
@@ -57,9 +57,9 @@
public:
typedef base::Callback<void(const GURL& root,
const std::string& name,
- base::PlatformFileError result)>
+ base::File::Error result)>
OpenFileSystemCallback;
- typedef base::Callback<void(base::PlatformFileError)> StatusCallback;
+ typedef base::Callback<void(base::File::Error)> StatusCallback;
typedef base::Callback<void(int64)> WriteCallback;
typedef fileapi::FileSystemOperation::FileEntryList FileEntryList;
@@ -83,7 +83,7 @@
LocalFileSyncContext* sync_context);
// Opens a new syncable file system.
- base::PlatformFileError OpenFileSystem();
+ base::File::Error OpenFileSystem();
// Register sync status observers. Unlike original
// LocalFileSyncStatus::Observer implementation the observer methods
@@ -106,29 +106,28 @@
// OpenFileSystem() must have been called before calling any of them.
// They create an operation and run it on IO task runner, and the operation
// posts a task on file runner.
- base::PlatformFileError CreateDirectory(const fileapi::FileSystemURL& url);
- base::PlatformFileError CreateFile(const fileapi::FileSystemURL& url);
- base::PlatformFileError Copy(const fileapi::FileSystemURL& src_url,
- const fileapi::FileSystemURL& dest_url);
- base::PlatformFileError Move(const fileapi::FileSystemURL& src_url,
- const fileapi::FileSystemURL& dest_url);
- base::PlatformFileError TruncateFile(const fileapi::FileSystemURL& url,
- int64 size);
- base::PlatformFileError TouchFile(const fileapi::FileSystemURL& url,
- const base::Time& last_access_time,
- const base::Time& last_modified_time);
- base::PlatformFileError Remove(const fileapi::FileSystemURL& url,
- bool recursive);
- base::PlatformFileError FileExists(const fileapi::FileSystemURL& url);
- base::PlatformFileError DirectoryExists(const fileapi::FileSystemURL& url);
- base::PlatformFileError VerifyFile(const fileapi::FileSystemURL& url,
- const std::string& expected_data);
- base::PlatformFileError GetMetadataAndPlatformPath(
+ base::File::Error CreateDirectory(const fileapi::FileSystemURL& url);
+ base::File::Error CreateFile(const fileapi::FileSystemURL& url);
+ base::File::Error Copy(const fileapi::FileSystemURL& src_url,
+ const fileapi::FileSystemURL& dest_url);
+ base::File::Error Move(const fileapi::FileSystemURL& src_url,
+ const fileapi::FileSystemURL& dest_url);
+ base::File::Error TruncateFile(const fileapi::FileSystemURL& url,
+ int64 size);
+ base::File::Error TouchFile(const fileapi::FileSystemURL& url,
+ const base::Time& last_access_time,
+ const base::Time& last_modified_time);
+ base::File::Error Remove(const fileapi::FileSystemURL& url, bool recursive);
+ base::File::Error FileExists(const fileapi::FileSystemURL& url);
+ base::File::Error DirectoryExists(const fileapi::FileSystemURL& url);
+ base::File::Error VerifyFile(const fileapi::FileSystemURL& url,
+ const std::string& expected_data);
+ base::File::Error GetMetadataAndPlatformPath(
const fileapi::FileSystemURL& url,
- base::PlatformFileInfo* info,
+ base::File::Info* info,
base::FilePath* platform_path);
- base::PlatformFileError ReadDirectory(const fileapi::FileSystemURL& url,
- FileEntryList* entries);
+ base::File::Error ReadDirectory(const fileapi::FileSystemURL& url,
+ FileEntryList* entries);
// Returns the # of bytes written (>=0) or an error code (<0).
int64 Write(net::URLRequestContext* url_request_context,
@@ -137,7 +136,7 @@
int64 WriteString(const fileapi::FileSystemURL& url, const std::string& data);
// Purges the file system local storage.
- base::PlatformFileError DeleteFileSystem();
+ base::File::Error DeleteFileSystem();
// Retrieves the quota and usage.
quota::QuotaStatusCode GetUsageAndQuota(int64* usage, int64* quota);
@@ -186,7 +185,7 @@
const std::string& expected_data,
const StatusCallback& callback);
void DoGetMetadataAndPlatformPath(const fileapi::FileSystemURL& url,
- base::PlatformFileInfo* info,
+ base::File::Info* info,
base::FilePath* platform_path,
const StatusCallback& callback);
void DoReadDirectory(const fileapi::FileSystemURL& url,
@@ -210,7 +209,7 @@
void DidOpenFileSystem(base::SingleThreadTaskRunner* original_task_runner,
const GURL& root,
const std::string& name,
- base::PlatformFileError result);
+ base::File::Error result);
void DidInitializeFileSystemContext(sync_file_system::SyncStatusCode status);
void InitializeSyncStatusObserver();
@@ -223,7 +222,7 @@
const GURL origin_;
const fileapi::FileSystemType type_;
GURL root_url_;
- base::PlatformFileError result_;
+ base::File::Error result_;
sync_file_system::SyncStatusCode sync_status_;
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
diff --git a/chrome/browser/sync_file_system/local/local_file_change_tracker.cc b/chrome/browser/sync_file_system/local/local_file_change_tracker.cc
index 61e2312..6bbe60ea 100644
--- a/chrome/browser/sync_file_system/local/local_file_change_tracker.cc
+++ b/chrome/browser/sync_file_system/local/local_file_change_tracker.cc
@@ -336,7 +336,7 @@
scoped_ptr<FileSystemOperationContext> context(
new FileSystemOperationContext(file_system_context));
- base::PlatformFileInfo file_info;
+ base::File::Info file_info;
base::FilePath platform_path;
while (!dirty_files.empty()) {
diff --git a/chrome/browser/sync_file_system/local/local_file_change_tracker_unittest.cc b/chrome/browser/sync_file_system/local/local_file_change_tracker_unittest.cc
index 2171858..4b495a1 100644
--- a/chrome/browser/sync_file_system/local/local_file_change_tracker_unittest.cc
+++ b/chrome/browser/sync_file_system/local/local_file_change_tracker_unittest.cc
@@ -115,7 +115,7 @@
};
TEST_F(LocalFileChangeTrackerTest, GetChanges) {
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system_.OpenFileSystem());
+ EXPECT_EQ(base::File::FILE_OK, file_system_.OpenFileSystem());
// Test URLs (no parent/child relationships, as we test such cases
// mainly in LocalFileSyncStatusTest).
@@ -230,7 +230,7 @@
}
TEST_F(LocalFileChangeTrackerTest, RestoreCreateAndModifyChanges) {
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system_.OpenFileSystem());
+ EXPECT_EQ(base::File::FILE_OK, file_system_.OpenFileSystem());
FileSystemURLSet urls;
@@ -248,17 +248,17 @@
ScopedTextBlob blob(url_request_context, "blob_id:test", kData);
// Create files and nested directories.
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_.CreateFile(URL(kPath0))); // Creates a file.
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_.CreateDirectory(URL(kPath1))); // Creates a dir.
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_.CreateDirectory(URL(kPath2))); // Creates another dir.
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_.CreateFile(URL(kPath3))); // Creates a file.
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_.TruncateFile(URL(kPath3), 1)); // Modifies the file.
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_.CreateFile(URL(kPath4))); // Creates another file.
EXPECT_EQ(static_cast<int64>(kData.size()), // Modifies the file.
file_system_.Write(&url_request_context,
@@ -299,7 +299,7 @@
}
TEST_F(LocalFileChangeTrackerTest, RestoreRemoveChanges) {
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system_.OpenFileSystem());
+ EXPECT_EQ(base::File::FILE_OK, file_system_.OpenFileSystem());
FileSystemURLSet urls;
@@ -314,27 +314,27 @@
ASSERT_EQ(0U, urls.size());
// Creates and removes a same file.
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_.CreateFile(URL(kPath0)));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_.Remove(URL(kPath0), false /* recursive */));
// Creates and removes a same directory.
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_.CreateDirectory(URL(kPath1)));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_.Remove(URL(kPath1), false /* recursive */));
// Creates files and nested directories, then removes the parent directory.
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_.CreateDirectory(URL(kPath2)));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_.CreateFile(URL(kPath3)));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_.CreateDirectory(URL(kPath4)));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_.CreateFile(URL(kPath5)));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_.Remove(URL(kPath2), true /* recursive */));
file_system_.GetChangedURLsInTracker(&urls);
@@ -375,7 +375,7 @@
}
TEST_F(LocalFileChangeTrackerTest, RestoreCopyChanges) {
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system_.OpenFileSystem());
+ EXPECT_EQ(base::File::FILE_OK, file_system_.OpenFileSystem());
FileSystemURLSet urls;
@@ -399,17 +399,17 @@
ScopedTextBlob blob(url_request_context, "blob_id:test", kData);
// Create files and nested directories.
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_.CreateFile(URL(kPath0))); // Creates a file.
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_.CreateDirectory(URL(kPath1))); // Creates a dir.
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_.CreateDirectory(URL(kPath2))); // Creates another dir.
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_.CreateFile(URL(kPath3))); // Creates a file.
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_.TruncateFile(URL(kPath3), 1)); // Modifies the file.
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_.CreateFile(URL(kPath4))); // Creates another file.
EXPECT_EQ(static_cast<int64>(kData.size()),
file_system_.Write(&url_request_context, // Modifies the file.
@@ -429,9 +429,9 @@
EXPECT_TRUE(urls.empty());
// Copy the file and the parent directory.
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_.Copy(URL(kPath0), URL(kPath0Copy))); // Copy the file.
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_.Copy(URL(kPath1), URL(kPath1Copy))); // Copy the dir.
file_system_.GetChangedURLsInTracker(&urls);
@@ -466,7 +466,7 @@
}
TEST_F(LocalFileChangeTrackerTest, RestoreMoveChanges) {
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system_.OpenFileSystem());
+ EXPECT_EQ(base::File::FILE_OK, file_system_.OpenFileSystem());
FileSystemURLSet urls;
@@ -486,15 +486,15 @@
ASSERT_EQ(0U, urls.size());
// Create files and nested directories.
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_.CreateFile(URL(kPath0)));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_.CreateDirectory(URL(kPath1)));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_.CreateFile(URL(kPath2)));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_.CreateDirectory(URL(kPath3)));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_.CreateFile(URL(kPath4)));
// Verify we have 5 changes for preparation.
@@ -511,9 +511,9 @@
EXPECT_TRUE(urls.empty());
// Move the file and the parent directory.
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_.Move(URL(kPath0), URL(kPath5)));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_.Move(URL(kPath1), URL(kPath6)));
file_system_.GetChangedURLsInTracker(&urls);
@@ -560,7 +560,7 @@
}
TEST_F(LocalFileChangeTrackerTest, NextChangedURLsWithRecursiveCopy) {
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system_.OpenFileSystem());
+ EXPECT_EQ(base::File::FILE_OK, file_system_.OpenFileSystem());
FileSystemURLSet urls;
@@ -573,13 +573,13 @@
const char kPath2Copy[] = "dir b/dir";
// Creates kPath0,1,2 and then copies them all.
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_.CreateDirectory(URL(kPath0)));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_.CreateFile(URL(kPath1)));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_.CreateDirectory(URL(kPath2)));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_.Copy(URL(kPath0), URL(kPath0Copy)));
std::deque<FileSystemURL> urls_to_process;
@@ -601,20 +601,20 @@
}
TEST_F(LocalFileChangeTrackerTest, NextChangedURLsWithRecursiveRemove) {
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system_.OpenFileSystem());
+ EXPECT_EQ(base::File::FILE_OK, file_system_.OpenFileSystem());
const char kPath0[] = "dir a";
const char kPath1[] = "dir a/file1";
const char kPath2[] = "dir a/file2";
// Creates kPath0,1,2 and then removes them all.
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_.CreateDirectory(URL(kPath0)));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_.CreateFile(URL(kPath1)));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_.CreateFile(URL(kPath2)));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_.Remove(URL(kPath0), true /* recursive */));
FileSystemURLSet urls;
@@ -638,20 +638,20 @@
}
TEST_F(LocalFileChangeTrackerTest, ResetForFileSystem) {
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system_.OpenFileSystem());
+ EXPECT_EQ(base::File::FILE_OK, file_system_.OpenFileSystem());
const char kPath0[] = "dir a";
const char kPath1[] = "dir a/file";
const char kPath2[] = "dir a/subdir";
const char kPath3[] = "dir b";
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_.CreateDirectory(URL(kPath0)));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_.CreateFile(URL(kPath1)));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_.CreateDirectory(URL(kPath2)));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_.CreateDirectory(URL(kPath3)));
FileSystemURLSet urls;
diff --git a/chrome/browser/sync_file_system/local/local_file_sync_context.cc b/chrome/browser/sync_file_system/local/local_file_sync_context.cc
index 81a83da..891a54f 100644
--- a/chrome/browser/sync_file_system/local/local_file_sync_context.cc
+++ b/chrome/browser/sync_file_system/local/local_file_sync_context.cc
@@ -334,7 +334,7 @@
file_system_context, url);
if (fileapi::VirtualPath::IsRootPath(url.path())) {
- DidApplyRemoteChange(url, callback, base::PLATFORM_FILE_OK);
+ DidApplyRemoteChange(url, callback, base::File::FILE_OK);
return;
}
@@ -356,7 +356,7 @@
const base::FilePath& local_path,
const FileSystemURL& url,
const SyncStatusCallback& callback,
- base::PlatformFileError error) {
+ base::File::Error error) {
// Remove() may fail if the target entry does not exist (which is ok),
// so we ignore |error| here.
@@ -622,13 +622,13 @@
FileSystemContext* file_system_context,
const GURL& /* root */,
const std::string& /* name */,
- base::PlatformFileError error) {
+ base::File::Error error) {
DCHECK(io_task_runner_->RunsTasksOnCurrentThread());
if (shutdown_on_io_)
- error = base::PLATFORM_FILE_ERROR_ABORT;
- if (error != base::PLATFORM_FILE_OK) {
+ error = base::File::FILE_ERROR_ABORT;
+ if (error != base::File::FILE_OK) {
DidInitialize(source_url, file_system_context,
- PlatformFileErrorToSyncStatusCode(error));
+ FileErrorToSyncStatusCode(error));
return;
}
DCHECK(file_system_context);
@@ -725,7 +725,7 @@
InitializeFileSystemContextOnIOThread(source_url, file_system_context,
GURL(), std::string(),
- base::PLATFORM_FILE_OK);
+ base::File::FILE_OK);
}
void LocalFileSyncContext::DidInitialize(
@@ -853,12 +853,12 @@
backend->change_tracker()->GetChangesForURL(url, &changes);
base::FilePath platform_path;
- base::PlatformFileInfo file_info;
+ base::File::Info file_info;
FileSystemFileUtil* file_util =
file_system_context->sandbox_delegate()->sync_file_util();
DCHECK(file_util);
- base::PlatformFileError file_error = file_util->GetFileInfo(
+ base::File::Error file_error = file_util->GetFileInfo(
make_scoped_ptr(
new FileSystemOperationContext(file_system_context)).get(),
url,
@@ -866,7 +866,7 @@
&platform_path);
webkit_blob::ScopedFile snapshot;
- if (file_error == base::PLATFORM_FILE_OK && sync_mode == SYNC_SNAPSHOT) {
+ if (file_error == base::File::FILE_OK && sync_mode == SYNC_SNAPSHOT) {
base::FilePath snapshot_path;
base::CreateTemporaryFileInDir(local_base_path_.Append(kSnapshotDir),
&snapshot_path);
@@ -880,14 +880,15 @@
}
if (status == SYNC_STATUS_OK &&
- file_error != base::PLATFORM_FILE_OK &&
- file_error != base::PLATFORM_FILE_ERROR_NOT_FOUND)
- status = PlatformFileErrorToSyncStatusCode(file_error);
+ file_error != base::File::FILE_OK &&
+ file_error != base::File::FILE_ERROR_NOT_FOUND) {
+ status = FileErrorToSyncStatusCode(file_error);
+}
DCHECK(!file_info.is_symbolic_link);
SyncFileType file_type = SYNC_FILE_TYPE_FILE;
- if (file_error == base::PLATFORM_FILE_ERROR_NOT_FOUND)
+ if (file_error == base::File::FILE_ERROR_NOT_FOUND)
file_type = SYNC_FILE_TYPE_UNKNOWN;
else if (file_info.is_directory)
file_type = SYNC_FILE_TYPE_DIRECTORY;
@@ -954,22 +955,21 @@
void LocalFileSyncContext::DidApplyRemoteChange(
const FileSystemURL& url,
const SyncStatusCallback& callback_on_ui,
- base::PlatformFileError file_error) {
+ base::File::Error file_error) {
DCHECK(io_task_runner_->RunsTasksOnCurrentThread());
root_delete_helper_.reset();
ui_task_runner_->PostTask(
FROM_HERE,
- base::Bind(callback_on_ui,
- PlatformFileErrorToSyncStatusCode(file_error)));
+ base::Bind(callback_on_ui, FileErrorToSyncStatusCode(file_error)));
}
void LocalFileSyncContext::DidGetFileMetadata(
const SyncFileMetadataCallback& callback,
- base::PlatformFileError file_error,
- const base::PlatformFileInfo& file_info) {
+ base::File::Error file_error,
+ const base::File::Info& file_info) {
DCHECK(io_task_runner_->RunsTasksOnCurrentThread());
SyncFileMetadata metadata;
- if (file_error == base::PLATFORM_FILE_OK) {
+ if (file_error == base::File::FILE_OK) {
metadata.file_type = file_info.is_directory ?
SYNC_FILE_TYPE_DIRECTORY : SYNC_FILE_TYPE_FILE;
metadata.size = file_info.size;
@@ -977,9 +977,7 @@
}
ui_task_runner_->PostTask(
FROM_HERE,
- base::Bind(callback,
- PlatformFileErrorToSyncStatusCode(file_error),
- metadata));
+ base::Bind(callback, FileErrorToSyncStatusCode(file_error), metadata));
}
base::TimeDelta LocalFileSyncContext::NotifyChangesDuration() {
@@ -993,8 +991,8 @@
const base::FilePath& local_path,
const FileSystemURL& dest_url,
const StatusCallback& callback,
- base::PlatformFileError error) {
- if (error != base::PLATFORM_FILE_OK) {
+ base::File::Error error) {
+ if (error != base::File::FILE_OK) {
callback.Run(error);
return;
}
diff --git a/chrome/browser/sync_file_system/local/local_file_sync_context.h b/chrome/browser/sync_file_system/local/local_file_sync_context.h
index 418fab8..e8af9d3 100644
--- a/chrome/browser/sync_file_system/local/local_file_sync_context.h
+++ b/chrome/browser/sync_file_system/local/local_file_sync_context.h
@@ -12,6 +12,7 @@
#include "base/basictypes.h"
#include "base/callback.h"
+#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/logging.h"
#include "base/memory/ref_counted.h"
@@ -208,7 +209,7 @@
virtual void OnWriteEnabled(const fileapi::FileSystemURL& url) OVERRIDE;
private:
- typedef base::Callback<void(base::PlatformFileError result)> StatusCallback;
+ typedef base::Callback<void(base::File::Error result)> StatusCallback;
typedef std::deque<SyncStatusCallback> StatusCallbackQueue;
friend class base::RefCountedThreadSafe<LocalFileSyncContext>;
friend class CannedSyncableFileSystem;
@@ -234,7 +235,7 @@
fileapi::FileSystemContext* file_system_context,
const GURL& /* root */,
const std::string& /* name */,
- base::PlatformFileError error);
+ base::File::Error error);
SyncStatusCode InitializeChangeTrackerOnFileThread(
scoped_ptr<LocalFileChangeTracker>* tracker_ptr,
fileapi::FileSystemContext* file_system_context,
@@ -301,18 +302,18 @@
const base::FilePath& local_path,
const fileapi::FileSystemURL& url,
const SyncStatusCallback& callback,
- base::PlatformFileError error);
+ base::File::Error error);
// Callback routine for ApplyRemoteChange.
void DidApplyRemoteChange(
const fileapi::FileSystemURL& url,
const SyncStatusCallback& callback_on_ui,
- base::PlatformFileError file_error);
+ base::File::Error file_error);
void DidGetFileMetadata(
const SyncFileMetadataCallback& callback,
- base::PlatformFileError file_error,
- const base::PlatformFileInfo& file_info);
+ base::File::Error file_error,
+ const base::File::Info& file_info);
base::TimeDelta NotifyChangesDuration();
@@ -321,7 +322,7 @@
const base::FilePath& local_file_path,
const fileapi::FileSystemURL& dest_url,
const StatusCallback& callback,
- base::PlatformFileError error);
+ base::File::Error error);
const base::FilePath local_base_path_;
diff --git a/chrome/browser/sync_file_system/local/local_file_sync_context_unittest.cc b/chrome/browser/sync_file_system/local/local_file_sync_context_unittest.cc
index 9e2ebeae..a4c1a31 100644
--- a/chrome/browser/sync_file_system/local/local_file_sync_context_unittest.cc
+++ b/chrome/browser/sync_file_system/local/local_file_sync_context_unittest.cc
@@ -55,7 +55,7 @@
content::TestBrowserThreadBundle::REAL_FILE_THREAD |
content::TestBrowserThreadBundle::REAL_IO_THREAD),
status_(SYNC_FILE_ERROR_FAILED),
- file_error_(base::PLATFORM_FILE_ERROR_FAILED),
+ file_error_(base::File::FILE_ERROR_FAILED),
async_modify_finished_(false),
has_inflight_prepare_for_sync_(false) {}
@@ -183,19 +183,19 @@
return;
}
ASSERT_TRUE(io_task_runner_->RunsTasksOnCurrentThread());
- file_error_ = base::PLATFORM_FILE_ERROR_FAILED;
+ file_error_ = base::File::FILE_ERROR_FAILED;
file_system->operation_runner()->Truncate(
url, 1, base::Bind(&LocalFileSyncContextTest::DidModifyFile,
base::Unretained(this)));
}
- base::PlatformFileError WaitUntilModifyFileIsDone() {
+ base::File::Error WaitUntilModifyFileIsDone() {
while (!async_modify_finished_)
base::MessageLoop::current()->RunUntilIdle();
return file_error_;
}
- void DidModifyFile(base::PlatformFileError error) {
+ void DidModifyFile(base::File::Error error) {
if (!ui_task_runner_->RunsTasksOnCurrentThread()) {
ASSERT_TRUE(io_task_runner_->RunsTasksOnCurrentThread());
ui_task_runner_->PostTask(
@@ -236,10 +236,10 @@
ASSERT_EQ(SYNC_STATUS_OK,
file_system.MaybeInitializeFileSystemContext(
sync_context_.get()));
- ASSERT_EQ(base::PLATFORM_FILE_OK, file_system.OpenFileSystem());
+ ASSERT_EQ(base::File::FILE_OK, file_system.OpenFileSystem());
const FileSystemURL kFile(file_system.URL("file"));
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system.CreateFile(kFile));
+ EXPECT_EQ(base::File::FILE_OK, file_system.CreateFile(kFile));
SyncFileMetadata metadata;
FileChangeList changes;
@@ -286,10 +286,10 @@
ASSERT_EQ(SYNC_STATUS_OK,
file_system.MaybeInitializeFileSystemContext(
sync_context_.get()));
- ASSERT_EQ(base::PLATFORM_FILE_OK, file_system.OpenFileSystem());
+ ASSERT_EQ(base::File::FILE_OK, file_system.OpenFileSystem());
const FileSystemURL kFile(file_system.URL("file"));
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system.CreateFile(kFile));
+ EXPECT_EQ(base::File::FILE_OK, file_system.CreateFile(kFile));
SyncFileMetadata metadata;
FileChangeList changes;
@@ -314,7 +314,7 @@
if (sync_mode == LocalFileSyncContext::SYNC_SNAPSHOT) {
// Write should succeed.
- EXPECT_EQ(base::PLATFORM_FILE_OK, WaitUntilModifyFileIsDone());
+ EXPECT_EQ(base::File::FILE_OK, WaitUntilModifyFileIsDone());
} else {
base::MessageLoop::current()->RunUntilIdle();
EXPECT_FALSE(async_modify_finished_);
@@ -323,7 +323,7 @@
SimulateFinishSync(file_system.file_system_context(), kFile,
SYNC_STATUS_OK, sync_mode);
- EXPECT_EQ(base::PLATFORM_FILE_OK, WaitUntilModifyFileIsDone());
+ EXPECT_EQ(base::File::FILE_OK, WaitUntilModifyFileIsDone());
// Sync succeeded, but the other change that was made during or
// after sync is recorded.
@@ -352,7 +352,7 @@
scoped_refptr<LocalFileSyncContext> sync_context_;
SyncStatusCode status_;
- base::PlatformFileError file_error_;
+ base::File::Error file_error_;
bool async_modify_finished_;
bool has_inflight_prepare_for_sync_;
};
@@ -390,10 +390,10 @@
// Opens the file_system, perform some operation and see if the change tracker
// correctly captures the change.
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system.OpenFileSystem());
+ EXPECT_EQ(base::File::FILE_OK, file_system.OpenFileSystem());
const FileSystemURL kURL(file_system.URL("foo"));
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system.CreateFile(kURL));
+ EXPECT_EQ(base::File::FILE_OK, file_system.CreateFile(kURL));
FileSystemURLSet urls;
file_system.GetChangedURLsInTracker(&urls);
@@ -424,14 +424,14 @@
EXPECT_EQ(SYNC_STATUS_OK,
file_system2.MaybeInitializeFileSystemContext(sync_context_.get()));
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system1.OpenFileSystem());
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system2.OpenFileSystem());
+ EXPECT_EQ(base::File::FILE_OK, file_system1.OpenFileSystem());
+ EXPECT_EQ(base::File::FILE_OK, file_system2.OpenFileSystem());
const FileSystemURL kURL1(file_system1.URL("foo"));
const FileSystemURL kURL2(file_system2.URL("bar"));
// Creates a file in file_system1.
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system1.CreateFile(kURL1));
+ EXPECT_EQ(base::File::FILE_OK, file_system1.CreateFile(kURL1));
// file_system1's tracker must have recorded the change.
FileSystemURLSet urls;
@@ -445,7 +445,7 @@
ASSERT_TRUE(urls.empty());
// Creates a directory in file_system2.
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system2.CreateDirectory(kURL2));
+ EXPECT_EQ(base::File::FILE_OK, file_system2.CreateDirectory(kURL2));
// file_system1's tracker must have the change for kURL1 as before.
urls.clear();
@@ -531,12 +531,12 @@
EXPECT_EQ(SYNC_STATUS_OK,
file_system.MaybeInitializeFileSystemContext(sync_context_.get()));
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system.OpenFileSystem());
+ EXPECT_EQ(base::File::FILE_OK, file_system.OpenFileSystem());
const FileSystemURL kURL1(file_system.URL("foo"));
// Creates a file in file_system.
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system.CreateFile(kURL1));
+ EXPECT_EQ(base::File::FILE_OK, file_system.CreateFile(kURL1));
// Kick file write on IO thread.
StartModifyFileOnIOThread(&file_system, kURL1);
@@ -562,7 +562,7 @@
&metadata, &changes, NULL));
// Wait for the completion.
- EXPECT_EQ(base::PLATFORM_FILE_OK, WaitUntilModifyFileIsDone());
+ EXPECT_EQ(base::File::FILE_OK, WaitUntilModifyFileIsDone());
// The PrepareForSync must have been started; wait until DidPrepareForSync
// is done.
@@ -592,7 +592,7 @@
dir_.path(), ui_task_runner_.get(), io_task_runner_.get());
ASSERT_EQ(SYNC_STATUS_OK,
file_system.MaybeInitializeFileSystemContext(sync_context_.get()));
- ASSERT_EQ(base::PLATFORM_FILE_OK, file_system.OpenFileSystem());
+ ASSERT_EQ(base::File::FILE_OK, file_system.OpenFileSystem());
// Record the initial usage (likely 0).
int64 initial_usage = -1;
@@ -605,9 +605,9 @@
const FileSystemURL kDir(file_system.URL("dir"));
const FileSystemURL kChild(file_system.URL("dir/child"));
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system.CreateFile(kFile));
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system.CreateDirectory(kDir));
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system.CreateFile(kChild));
+ EXPECT_EQ(base::File::FILE_OK, file_system.CreateFile(kFile));
+ EXPECT_EQ(base::File::FILE_OK, file_system.CreateDirectory(kDir));
+ EXPECT_EQ(base::File::FILE_OK, file_system.CreateFile(kChild));
// file_system's change tracker must have recorded the creation.
FileSystemURLSet urls;
@@ -645,11 +645,11 @@
SYNC_FILE_TYPE_DIRECTORY));
// Check the directory/files are deleted successfully.
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND,
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND,
file_system.FileExists(kFile));
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND,
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND,
file_system.DirectoryExists(kDir));
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND,
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND,
file_system.FileExists(kChild));
// The changes applied by ApplyRemoteChange should not be recorded in
@@ -678,7 +678,7 @@
dir_.path(), ui_task_runner_.get(), io_task_runner_.get());
ASSERT_EQ(SYNC_STATUS_OK,
file_system.MaybeInitializeFileSystemContext(sync_context_.get()));
- ASSERT_EQ(base::PLATFORM_FILE_OK, file_system.OpenFileSystem());
+ ASSERT_EQ(base::File::FILE_OK, file_system.OpenFileSystem());
// Record the initial usage (likely 0).
int64 initial_usage = -1;
@@ -691,9 +691,9 @@
const FileSystemURL kDir(file_system.URL("dir"));
const FileSystemURL kChild(file_system.URL("dir/child"));
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system.CreateFile(kFile));
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system.CreateDirectory(kDir));
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system.CreateFile(kChild));
+ EXPECT_EQ(base::File::FILE_OK, file_system.CreateFile(kFile));
+ EXPECT_EQ(base::File::FILE_OK, file_system.CreateDirectory(kDir));
+ EXPECT_EQ(base::File::FILE_OK, file_system.CreateFile(kChild));
// At this point the usage must be greater than the initial usage.
int64 new_usage = -1;
@@ -711,11 +711,11 @@
SYNC_FILE_TYPE_DIRECTORY));
// Check the directory/files are deleted successfully.
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND,
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND,
file_system.FileExists(kFile));
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND,
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND,
file_system.DirectoryExists(kDir));
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND,
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND,
file_system.FileExists(kChild));
// All changes made for the previous creation must have been also reset.
@@ -746,7 +746,7 @@
dir_.path(), ui_task_runner_.get(), io_task_runner_.get());
ASSERT_EQ(SYNC_STATUS_OK,
file_system.MaybeInitializeFileSystemContext(sync_context_.get()));
- ASSERT_EQ(base::PLATFORM_FILE_OK, file_system.OpenFileSystem());
+ ASSERT_EQ(base::File::FILE_OK, file_system.OpenFileSystem());
const FileSystemURL kFile1(file_system.URL("file1"));
const FileSystemURL kFile2(file_system.URL("file2"));
@@ -757,14 +757,14 @@
const char kTestFileData2[] = "This is sample test data.";
// Create kFile1 and populate it with kTestFileData0.
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system.CreateFile(kFile1));
+ EXPECT_EQ(base::File::FILE_OK, file_system.CreateFile(kFile1));
EXPECT_EQ(static_cast<int64>(arraysize(kTestFileData0) - 1),
file_system.WriteString(kFile1, kTestFileData0));
// kFile2 and kDir are not there yet.
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND,
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND,
file_system.FileExists(kFile2));
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND,
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND,
file_system.DirectoryExists(kDir));
// file_system's change tracker must have recorded the creation.
@@ -848,7 +848,7 @@
kFilePath1,
kDir,
SYNC_FILE_TYPE_DIRECTORY));
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system.FileExists(kDir));
+ EXPECT_EQ(base::File::FILE_OK, file_system.FileExists(kDir));
change = FileChange(FileChange::FILE_CHANGE_ADD_OR_UPDATE,
SYNC_FILE_TYPE_DIRECTORY);
@@ -874,9 +874,9 @@
EXPECT_TRUE(urls.empty());
// Make sure all three files/directory exist.
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system.FileExists(kFile1));
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system.FileExists(kFile2));
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system.DirectoryExists(kDir));
+ EXPECT_EQ(base::File::FILE_OK, file_system.FileExists(kFile1));
+ EXPECT_EQ(base::File::FILE_OK, file_system.FileExists(kFile2));
+ EXPECT_EQ(base::File::FILE_OK, file_system.DirectoryExists(kDir));
sync_context_->ShutdownOnUIThread();
file_system.TearDown();
@@ -895,15 +895,15 @@
dir_.path(), ui_task_runner_.get(), io_task_runner_.get());
ASSERT_EQ(SYNC_STATUS_OK,
file_system.MaybeInitializeFileSystemContext(sync_context_.get()));
- ASSERT_EQ(base::PLATFORM_FILE_OK, file_system.OpenFileSystem());
+ ASSERT_EQ(base::File::FILE_OK, file_system.OpenFileSystem());
const char kTestFileData[] = "Lorem ipsum!";
const FileSystemURL kDir(file_system.URL("dir"));
const FileSystemURL kFile(file_system.URL("dir/file"));
// Either kDir or kFile not exist yet.
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, file_system.FileExists(kDir));
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, file_system.FileExists(kFile));
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND, file_system.FileExists(kDir));
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND, file_system.FileExists(kFile));
// Prepare a temporary file which represents remote file data.
const base::FilePath kFilePath(temp_dir.path().Append(FPL("file")));
@@ -928,8 +928,8 @@
EXPECT_TRUE(urls.empty());
// Make sure kDir and kFile are created by ApplyRemoteChange.
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system.FileExists(kFile));
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system.DirectoryExists(kDir));
+ EXPECT_EQ(base::File::FILE_OK, file_system.FileExists(kFile));
+ EXPECT_EQ(base::File::FILE_OK, file_system.DirectoryExists(kDir));
sync_context_->ShutdownOnUIThread();
file_system.TearDown();
diff --git a/chrome/browser/sync_file_system/local/local_file_sync_service_unittest.cc b/chrome/browser/sync_file_system/local/local_file_sync_service_unittest.cc
index 6ad32ff..79e91e0 100644
--- a/chrome/browser/sync_file_system/local/local_file_sync_service_unittest.cc
+++ b/chrome/browser/sync_file_system/local/local_file_sync_service_unittest.cc
@@ -128,7 +128,7 @@
local_service_->AddChangeObserver(this);
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system_->OpenFileSystem());
+ EXPECT_EQ(base::File::FILE_OK, file_system_->OpenFileSystem());
file_system_->backend()->sync_context()->
set_mock_notify_changes_duration_in_sec(0);
@@ -230,7 +230,7 @@
ApplyRemoteChange(change, local_path, kFile));
// Verify the file is synced.
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_->VerifyFile(kFile, kTestFileData));
// Run PrepareForProcessRemoteChange for kDir.
@@ -245,7 +245,7 @@
ApplyRemoteChange(change, base::FilePath(), kDir));
// Verify the directory.
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_->DirectoryExists(kDir));
// Run PrepareForProcessRemoteChange and ApplyRemoteChange for
@@ -260,7 +260,7 @@
EXPECT_EQ(SYNC_STATUS_OK, ApplyRemoteChange(change, base::FilePath(), kDir));
// Now the directory must have deleted.
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND,
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND,
file_system_->DirectoryExists(kDir));
}
@@ -270,11 +270,11 @@
const char kTestFileData[] = "0123456789";
const int kTestFileDataSize = static_cast<int>(arraysize(kTestFileData) - 1);
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system_->CreateFile(kFile));
+ EXPECT_EQ(base::File::FILE_OK, file_system_->CreateFile(kFile));
EXPECT_EQ(1, num_changes_);
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system_->CreateDirectory(kDir));
+ EXPECT_EQ(base::File::FILE_OK, file_system_->CreateDirectory(kDir));
EXPECT_EQ(kTestFileDataSize,
file_system_->WriteString(kFile, kTestFileData));
@@ -305,7 +305,7 @@
AssignAndQuitCallback(&run_loop, &status));
run_loop.Run();
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system2.OpenFileSystem());
+ EXPECT_EQ(base::File::FILE_OK, file_system2.OpenFileSystem());
file_system2.backend()->sync_context()->
set_mock_notify_changes_duration_in_sec(0);
@@ -314,10 +314,10 @@
const FileSystemURL kFile3(file_system2.URL("file3"));
const FileSystemURL kFile4(file_system2.URL("file4"));
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system_->CreateFile(kFile1));
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system_->CreateFile(kFile2));
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system2.CreateFile(kFile3));
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system2.CreateFile(kFile4));
+ EXPECT_EQ(base::File::FILE_OK, file_system_->CreateFile(kFile1));
+ EXPECT_EQ(base::File::FILE_OK, file_system_->CreateFile(kFile2));
+ EXPECT_EQ(base::File::FILE_OK, file_system2.CreateFile(kFile3));
+ EXPECT_EQ(base::File::FILE_OK, file_system2.CreateFile(kFile4));
EXPECT_EQ(4, num_changes_);
@@ -340,14 +340,14 @@
file_system_->AddSyncStatusObserver(&status_observer);
// Creates and writes into a file.
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system_->CreateFile(kFile));
+ EXPECT_EQ(base::File::FILE_OK, file_system_->CreateFile(kFile));
EXPECT_EQ(kTestFileDataSize,
file_system_->WriteString(kFile, std::string(kTestFileData)));
// Retrieve the expected file info.
- base::PlatformFileInfo info;
+ base::File::Info info;
base::FilePath platform_path;
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_->GetMetadataAndPlatformPath(
kFile, &info, &platform_path));
@@ -393,8 +393,8 @@
file_system_->AddSyncStatusObserver(&status_observer);
// Creates and then deletes a file.
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system_->CreateFile(kFile));
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system_->Remove(kFile, false));
+ EXPECT_EQ(base::File::FILE_OK, file_system_->CreateFile(kFile));
+ EXPECT_EQ(base::File::FILE_OK, file_system_->Remove(kFile, false));
// The local_change_processor's ApplyLocalChange should be called once
// with DELETE change for TYPE_FILE.
@@ -429,8 +429,8 @@
file_system_->AddSyncStatusObserver(&status_observer);
// Creates and then deletes a directory.
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system_->CreateDirectory(kDir));
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system_->Remove(kDir, false));
+ EXPECT_EQ(base::File::FILE_OK, file_system_->CreateDirectory(kDir));
+ EXPECT_EQ(base::File::FILE_OK, file_system_->Remove(kDir, false));
// The local_change_processor's ApplyLocalChange should never be called.
StrictMock<MockLocalChangeProcessor> local_change_processor;
@@ -462,12 +462,12 @@
// Creates a file, delete the file and creates a directory with the same
// name.
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system_->CreateFile(kPath));
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system_->Remove(kPath, false));
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system_->CreateDirectory(kPath));
+ EXPECT_EQ(base::File::FILE_OK, file_system_->CreateFile(kPath));
+ EXPECT_EQ(base::File::FILE_OK, file_system_->Remove(kPath, false));
+ EXPECT_EQ(base::File::FILE_OK, file_system_->CreateDirectory(kPath));
// Creates one more file.
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system_->CreateFile(kOther));
+ EXPECT_EQ(base::File::FILE_OK, file_system_->CreateFile(kOther));
// The local_change_processor's ApplyLocalChange will be called
// twice for FILE_TYPE and FILE_DIRECTORY.
@@ -510,9 +510,9 @@
base::RunLoop run_loop;
// Creates a file.
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system_->CreateFile(kURL));
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system_->TruncateFile(kURL, kSize));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK, file_system_->CreateFile(kURL));
+ EXPECT_EQ(base::File::FILE_OK, file_system_->TruncateFile(kURL, kSize));
+ EXPECT_EQ(base::File::FILE_OK,
file_system_->TouchFile(kURL, base::Time(), kTime));
SyncStatusCode status = SYNC_STATUS_UNKNOWN;
@@ -533,7 +533,7 @@
const FileSystemURL kURL(file_system_->URL("foo"));
// Create a file and reset the changes (as preparation).
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system_->CreateFile(kURL));
+ EXPECT_EQ(base::File::FILE_OK, file_system_->CreateFile(kURL));
file_system_->ClearChangeForURLInTracker(kURL);
EXPECT_EQ(0, GetNumChangesInTracker());
diff --git a/chrome/browser/sync_file_system/local/root_delete_helper.cc b/chrome/browser/sync_file_system/local/root_delete_helper.cc
index 1c507097..56fdb1f 100644
--- a/chrome/browser/sync_file_system/local/root_delete_helper.cc
+++ b/chrome/browser/sync_file_system/local/root_delete_helper.cc
@@ -66,7 +66,7 @@
weak_factory_.GetWeakPtr()));
}
-void RootDeleteHelper::DidDeleteFileSystem(base::PlatformFileError error) {
+void RootDeleteHelper::DidDeleteFileSystem(base::File::Error error) {
// Ignore errors, no idea how to deal with it.
DCHECK(!sync_status_->IsWritable(url_));
@@ -97,7 +97,7 @@
void RootDeleteHelper::DidOpenFileSystem(const GURL& /* root */,
const std::string& /* name */,
- base::PlatformFileError error) {
+ base::File::Error error) {
FileStatusCallback callback = callback_;
callback.Run(error);
}
diff --git a/chrome/browser/sync_file_system/local/root_delete_helper.h b/chrome/browser/sync_file_system/local/root_delete_helper.h
index a9dde0c..c4fb1f7 100644
--- a/chrome/browser/sync_file_system/local/root_delete_helper.h
+++ b/chrome/browser/sync_file_system/local/root_delete_helper.h
@@ -7,9 +7,9 @@
#include "base/basictypes.h"
#include "base/callback.h"
+#include "base/files/file.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
-#include "base/platform_file.h"
#include "webkit/browser/fileapi/file_system_url.h"
class GURL;
@@ -30,7 +30,7 @@
// Expected to be called on and will callback on IO thread.
class RootDeleteHelper {
public:
- typedef base::Callback<void(base::PlatformFileError)> FileStatusCallback;
+ typedef base::Callback<void(base::File::Error)> FileStatusCallback;
RootDeleteHelper(fileapi::FileSystemContext* file_system_context,
LocalFileSyncStatus* sync_status,
@@ -41,11 +41,11 @@
void Run();
private:
- void DidDeleteFileSystem(base::PlatformFileError error);
+ void DidDeleteFileSystem(base::File::Error error);
void DidResetFileChangeTracker();
void DidOpenFileSystem(const GURL& root,
const std::string& name,
- base::PlatformFileError error);
+ base::File::Error error);
scoped_refptr<fileapi::FileSystemContext> file_system_context_;
const fileapi::FileSystemURL url_;
diff --git a/chrome/browser/sync_file_system/local/sync_file_system_backend.cc b/chrome/browser/sync_file_system/local/sync_file_system_backend.cc
index aba7756..ad04c63ca 100644
--- a/chrome/browser/sync_file_system/local/sync_file_system_backend.cc
+++ b/chrome/browser/sync_file_system/local/sync_file_system_backend.cc
@@ -137,9 +137,9 @@
fileapi::CopyOrMoveFileValidatorFactory*
SyncFileSystemBackend::GetCopyOrMoveFileValidatorFactory(
fileapi::FileSystemType type,
- base::PlatformFileError* error_code) {
+ base::File::Error* error_code) {
DCHECK(error_code);
- *error_code = base::PLATFORM_FILE_OK;
+ *error_code = base::File::FILE_OK;
return NULL;
}
@@ -147,7 +147,7 @@
SyncFileSystemBackend::CreateFileSystemOperation(
const fileapi::FileSystemURL& url,
fileapi::FileSystemContext* context,
- base::PlatformFileError* error_code) const {
+ base::File::Error* error_code) const {
DCHECK(CanHandleType(url.type()));
DCHECK(context);
DCHECK(error_code);
@@ -277,13 +277,13 @@
if (status != sync_file_system::SYNC_STATUS_OK) {
callback.Run(GURL(), std::string(),
- SyncStatusCodeToPlatformFileError(status));
+ SyncStatusCodeToFileError(status));
return;
}
callback.Run(GetSyncableFileSystemRootURI(origin_url),
GetFileSystemName(origin_url, type),
- base::PLATFORM_FILE_OK);
+ base::File::FILE_OK);
}
} // namespace sync_file_system
diff --git a/chrome/browser/sync_file_system/local/sync_file_system_backend.h b/chrome/browser/sync_file_system/local/sync_file_system_backend.h
index 1a4a509..5eeaba9 100644
--- a/chrome/browser/sync_file_system/local/sync_file_system_backend.h
+++ b/chrome/browser/sync_file_system/local/sync_file_system_backend.h
@@ -40,11 +40,11 @@
virtual fileapi::CopyOrMoveFileValidatorFactory*
GetCopyOrMoveFileValidatorFactory(
fileapi::FileSystemType type,
- base::PlatformFileError* error_code) OVERRIDE;
+ base::File::Error* error_code) OVERRIDE;
virtual fileapi::FileSystemOperation* CreateFileSystemOperation(
const fileapi::FileSystemURL& url,
fileapi::FileSystemContext* context,
- base::PlatformFileError* error_code) const OVERRIDE;
+ base::File::Error* error_code) const OVERRIDE;
virtual scoped_ptr<webkit_blob::FileStreamReader> CreateFileStreamReader(
const fileapi::FileSystemURL& url,
int64 offset,
diff --git a/chrome/browser/sync_file_system/local/syncable_file_operation_runner_unittest.cc b/chrome/browser/sync_file_system/local/syncable_file_operation_runner_unittest.cc
index a49b916..e451eff 100644
--- a/chrome/browser/sync_file_system/local/syncable_file_operation_runner_unittest.cc
+++ b/chrome/browser/sync_file_system/local/syncable_file_operation_runner_unittest.cc
@@ -6,6 +6,7 @@
#include "base/basictypes.h"
#include "base/file_util.h"
+#include "base/files/file.h"
#include "base/location.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
@@ -27,7 +28,7 @@
using fileapi::FileSystemURL;
using webkit_blob::MockBlobURLRequestContext;
using webkit_blob::ScopedTextBlob;
-using base::PlatformFileError;
+using base::File;
namespace sync_file_system {
@@ -51,7 +52,7 @@
base::MessageLoopProxy::current().get(),
base::MessageLoopProxy::current().get()),
callback_count_(0),
- write_status_(base::PLATFORM_FILE_ERROR_FAILED),
+ write_status_(File::FILE_ERROR_FAILED),
write_bytes_(0),
write_complete_(false),
url_request_context_(file_system_.file_system_context()),
@@ -68,8 +69,8 @@
SYNC_STATUS_OK,
file_system_.MaybeInitializeFileSystemContext(sync_context_.get()));
- ASSERT_EQ(base::PLATFORM_FILE_OK, file_system_.OpenFileSystem());
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(File::FILE_OK, file_system_.OpenFileSystem());
+ ASSERT_EQ(File::FILE_OK,
file_system_.CreateDirectory(URL(kParent)));
}
@@ -91,14 +92,14 @@
}
void ResetCallbackStatus() {
- write_status_ = base::PLATFORM_FILE_ERROR_FAILED;
+ write_status_ = File::FILE_ERROR_FAILED;
write_bytes_ = 0;
write_complete_ = false;
callback_count_ = 0;
}
StatusCallback ExpectStatus(const tracked_objects::Location& location,
- PlatformFileError expect) {
+ File::Error expect) {
return base::Bind(&SyncableFileOperationRunnerTest::DidFinish,
weak_factory_.GetWeakPtr(), location, expect);
}
@@ -110,7 +111,7 @@
}
void DidWrite(const tracked_objects::Location& location,
- PlatformFileError status, int64 bytes, bool complete) {
+ File::Error status, int64 bytes, bool complete) {
SCOPED_TRACE(testing::Message() << location.ToString());
write_status_ = status;
write_bytes_ += bytes;
@@ -119,7 +120,7 @@
}
void DidFinish(const tracked_objects::Location& location,
- PlatformFileError expect, PlatformFileError status) {
+ File::Error expect, File::Error status) {
SCOPED_TRACE(testing::Message() << location.ToString());
EXPECT_EQ(expect, status);
++callback_count_;
@@ -137,7 +138,7 @@
scoped_refptr<LocalFileSyncContext> sync_context_;
int callback_count_;
- PlatformFileError write_status_;
+ File::Error write_status_;
size_t write_bytes_;
bool write_complete_;
@@ -157,16 +158,16 @@
ResetCallbackStatus();
file_system_.operation_runner()->CreateFile(
URL(kFile), false /* exclusive */,
- ExpectStatus(FROM_HERE, base::PLATFORM_FILE_OK));
+ ExpectStatus(FROM_HERE, File::FILE_OK));
file_system_.operation_runner()->Truncate(
URL(kFile), 1,
- ExpectStatus(FROM_HERE, base::PLATFORM_FILE_OK));
+ ExpectStatus(FROM_HERE, File::FILE_OK));
base::MessageLoop::current()->RunUntilIdle();
EXPECT_EQ(0, callback_count_);
// Read operations are not blocked (and are executed before queued ones).
file_system_.operation_runner()->FileExists(
- URL(kFile), ExpectStatus(FROM_HERE, base::PLATFORM_FILE_ERROR_NOT_FOUND));
+ URL(kFile), ExpectStatus(FROM_HERE, File::FILE_ERROR_NOT_FOUND));
base::MessageLoop::current()->RunUntilIdle();
EXPECT_EQ(1, callback_count_);
@@ -181,15 +182,15 @@
// Now the file must have been created and updated.
ResetCallbackStatus();
file_system_.operation_runner()->FileExists(
- URL(kFile), ExpectStatus(FROM_HERE, base::PLATFORM_FILE_OK));
+ URL(kFile), ExpectStatus(FROM_HERE, File::FILE_OK));
base::MessageLoop::current()->RunUntilIdle();
EXPECT_EQ(1, callback_count_);
}
TEST_F(SyncableFileOperationRunnerTest, WriteToParentAndChild) {
// First create the kDir directory and kChild in the dir.
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system_.CreateDirectory(URL(kDir)));
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system_.CreateFile(URL(kChild)));
+ EXPECT_EQ(File::FILE_OK, file_system_.CreateDirectory(URL(kDir)));
+ EXPECT_EQ(File::FILE_OK, file_system_.CreateFile(URL(kChild)));
// Start syncing the kDir directory.
sync_status()->StartSyncing(URL(kDir));
@@ -198,16 +199,16 @@
// Writes to kParent and kChild should be all queued up.
ResetCallbackStatus();
file_system_.operation_runner()->Truncate(
- URL(kChild), 1, ExpectStatus(FROM_HERE, base::PLATFORM_FILE_OK));
+ URL(kChild), 1, ExpectStatus(FROM_HERE, File::FILE_OK));
file_system_.operation_runner()->Remove(
URL(kParent), true /* recursive */,
- ExpectStatus(FROM_HERE, base::PLATFORM_FILE_OK));
+ ExpectStatus(FROM_HERE, File::FILE_OK));
base::MessageLoop::current()->RunUntilIdle();
EXPECT_EQ(0, callback_count_);
// Read operations are not blocked (and are executed before queued ones).
file_system_.operation_runner()->DirectoryExists(
- URL(kDir), ExpectStatus(FROM_HERE, base::PLATFORM_FILE_OK));
+ URL(kDir), ExpectStatus(FROM_HERE, File::FILE_OK));
base::MessageLoop::current()->RunUntilIdle();
EXPECT_EQ(1, callback_count_);
@@ -215,7 +216,7 @@
ResetCallbackStatus();
file_system_.operation_runner()->CreateDirectory(
URL(kOther), false /* exclusive */, false /* recursive */,
- ExpectStatus(FROM_HERE, base::PLATFORM_FILE_OK));
+ ExpectStatus(FROM_HERE, File::FILE_OK));
base::MessageLoop::current()->RunUntilIdle();
EXPECT_EQ(1, callback_count_);
@@ -230,8 +231,8 @@
TEST_F(SyncableFileOperationRunnerTest, CopyAndMove) {
// First create the kDir directory and kChild in the dir.
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system_.CreateDirectory(URL(kDir)));
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system_.CreateFile(URL(kChild)));
+ EXPECT_EQ(File::FILE_OK, file_system_.CreateDirectory(URL(kDir)));
+ EXPECT_EQ(File::FILE_OK, file_system_.CreateFile(URL(kChild)));
// Start syncing the kParent directory.
sync_status()->StartSyncing(URL(kParent));
@@ -243,18 +244,18 @@
URL(kDir), URL("dest-copy"),
fileapi::FileSystemOperation::OPTION_NONE,
fileapi::FileSystemOperationRunner::CopyProgressCallback(),
- ExpectStatus(FROM_HERE, base::PLATFORM_FILE_OK));
+ ExpectStatus(FROM_HERE, File::FILE_OK));
file_system_.operation_runner()->Move(
URL(kDir), URL("dest-move"),
fileapi::FileSystemOperation::OPTION_NONE,
- ExpectStatus(FROM_HERE, base::PLATFORM_FILE_OK));
+ ExpectStatus(FROM_HERE, File::FILE_OK));
base::MessageLoop::current()->RunUntilIdle();
EXPECT_EQ(1, callback_count_);
// Only "dest-copy1" should exist.
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(File::FILE_OK,
file_system_.DirectoryExists(URL("dest-copy")));
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND,
+ EXPECT_EQ(File::FILE_ERROR_NOT_FOUND,
file_system_.DirectoryExists(URL("dest-move")));
// Start syncing the "dest-copy2" directory.
@@ -266,7 +267,7 @@
URL(kDir), URL("dest-copy2"),
fileapi::FileSystemOperation::OPTION_NONE,
fileapi::FileSystemOperationRunner::CopyProgressCallback(),
- ExpectStatus(FROM_HERE, base::PLATFORM_FILE_OK));
+ ExpectStatus(FROM_HERE, File::FILE_OK));
base::MessageLoop::current()->RunUntilIdle();
EXPECT_EQ(0, callback_count_);
@@ -277,7 +278,7 @@
EXPECT_EQ(1, callback_count_);
// Now we should have "dest-copy2".
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(File::FILE_OK,
file_system_.DirectoryExists(URL("dest-copy2")));
// Finish syncing the kParent to unlock Move.
@@ -287,12 +288,12 @@
EXPECT_EQ(1, callback_count_);
// Now we should have "dest-move".
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(File::FILE_OK,
file_system_.DirectoryExists(URL("dest-move")));
}
TEST_F(SyncableFileOperationRunnerTest, Write) {
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system_.CreateFile(URL(kFile)));
+ EXPECT_EQ(File::FILE_OK, file_system_.CreateFile(URL(kFile)));
const std::string kData("Lorem ipsum.");
ScopedTextBlob blob(url_request_context_, "blob:foo", kData);
@@ -311,7 +312,7 @@
while (!write_complete_)
base::MessageLoop::current()->RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_OK, write_status_);
+ EXPECT_EQ(File::FILE_OK, write_status_);
EXPECT_EQ(kData.size(), write_bytes_);
EXPECT_TRUE(write_complete_);
}
@@ -323,10 +324,10 @@
ResetCallbackStatus();
file_system_.operation_runner()->CreateFile(
URL(kFile), false /* exclusive */,
- ExpectStatus(FROM_HERE, base::PLATFORM_FILE_ERROR_ABORT));
+ ExpectStatus(FROM_HERE, File::FILE_ERROR_ABORT));
file_system_.operation_runner()->Truncate(
URL(kFile), 1,
- ExpectStatus(FROM_HERE, base::PLATFORM_FILE_ERROR_ABORT));
+ ExpectStatus(FROM_HERE, File::FILE_ERROR_ABORT));
base::MessageLoop::current()->RunUntilIdle();
EXPECT_EQ(0, callback_count_);
@@ -356,7 +357,7 @@
ResetCallbackStatus();
file_system_.operation_runner()->CopyInForeignFile(
temp_path, URL(kFile),
- ExpectStatus(FROM_HERE, base::PLATFORM_FILE_OK));
+ ExpectStatus(FROM_HERE, File::FILE_OK));
base::MessageLoop::current()->RunUntilIdle();
EXPECT_EQ(0, callback_count_);
@@ -372,7 +373,7 @@
ResetCallbackStatus();
file_system_.DoVerifyFile(
URL(kFile), kTestData,
- ExpectStatus(FROM_HERE, base::PLATFORM_FILE_OK));
+ ExpectStatus(FROM_HERE, File::FILE_OK));
base::MessageLoop::current()->RunUntilIdle();
EXPECT_EQ(1, callback_count_);
}
@@ -381,7 +382,7 @@
// Prepare a file.
file_system_.operation_runner()->CreateFile(
URL(kFile), false /* exclusive */,
- ExpectStatus(FROM_HERE, base::PLATFORM_FILE_OK));
+ ExpectStatus(FROM_HERE, File::FILE_OK));
base::MessageLoop::current()->RunUntilIdle();
EXPECT_EQ(1, callback_count_);
@@ -390,9 +391,9 @@
fileapi::FileSystemOperationRunner::OperationID id =
file_system_.operation_runner()->Truncate(
URL(kFile), 10,
- ExpectStatus(FROM_HERE, base::PLATFORM_FILE_OK));
+ ExpectStatus(FROM_HERE, File::FILE_OK));
file_system_.operation_runner()->Cancel(
- id, ExpectStatus(FROM_HERE, base::PLATFORM_FILE_ERROR_INVALID_OPERATION));
+ id, ExpectStatus(FROM_HERE, File::FILE_ERROR_INVALID_OPERATION));
base::MessageLoop::current()->RunUntilIdle();
EXPECT_EQ(2, callback_count_);
}
diff --git a/chrome/browser/sync_file_system/local/syncable_file_system_operation.cc b/chrome/browser/sync_file_system/local/syncable_file_system_operation.cc
index 51a3cbf..ce824e28 100644
--- a/chrome/browser/sync_file_system/local/syncable_file_system_operation.cc
+++ b/chrome/browser/sync_file_system/local/syncable_file_system_operation.cc
@@ -25,7 +25,7 @@
void WriteCallbackAdapter(
const SyncableFileSystemOperation::WriteCallback& callback,
- base::PlatformFileError status) {
+ base::File::Error status) {
callback.Run(status, 0, true);
}
@@ -79,7 +79,7 @@
const StatusCallback& callback) {
DCHECK(CalledOnValidThread());
if (!operation_runner_.get()) {
- callback.Run(base::PLATFORM_FILE_ERROR_NOT_FOUND);
+ callback.Run(base::File::FILE_ERROR_NOT_FOUND);
return;
}
DCHECK(operation_runner_.get());
@@ -101,11 +101,11 @@
const StatusCallback& callback) {
DCHECK(CalledOnValidThread());
if (!operation_runner_.get()) {
- callback.Run(base::PLATFORM_FILE_ERROR_NOT_FOUND);
+ callback.Run(base::File::FILE_ERROR_NOT_FOUND);
return;
}
if (!is_directory_operation_enabled_) {
- callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION);
+ callback.Run(base::File::FILE_ERROR_INVALID_OPERATION);
return;
}
DCHECK(operation_runner_.get());
@@ -128,7 +128,7 @@
const StatusCallback& callback) {
DCHECK(CalledOnValidThread());
if (!operation_runner_.get()) {
- callback.Run(base::PLATFORM_FILE_ERROR_NOT_FOUND);
+ callback.Run(base::File::FILE_ERROR_NOT_FOUND);
return;
}
DCHECK(operation_runner_.get());
@@ -150,7 +150,7 @@
const StatusCallback& callback) {
DCHECK(CalledOnValidThread());
if (!operation_runner_.get()) {
- callback.Run(base::PLATFORM_FILE_ERROR_NOT_FOUND);
+ callback.Run(base::File::FILE_ERROR_NOT_FOUND);
return;
}
DCHECK(operation_runner_.get());
@@ -202,7 +202,7 @@
const StatusCallback& callback) {
DCHECK(CalledOnValidThread());
if (!operation_runner_.get()) {
- callback.Run(base::PLATFORM_FILE_ERROR_NOT_FOUND);
+ callback.Run(base::File::FILE_ERROR_NOT_FOUND);
return;
}
DCHECK(operation_runner_.get());
@@ -224,7 +224,7 @@
const WriteCallback& callback) {
DCHECK(CalledOnValidThread());
if (!operation_runner_.get()) {
- callback.Run(base::PLATFORM_FILE_ERROR_NOT_FOUND, 0, true);
+ callback.Run(base::File::FILE_ERROR_NOT_FOUND, 0, true);
return;
}
DCHECK(operation_runner_.get());
@@ -247,7 +247,7 @@
const StatusCallback& callback) {
DCHECK(CalledOnValidThread());
if (!operation_runner_.get()) {
- callback.Run(base::PLATFORM_FILE_ERROR_NOT_FOUND);
+ callback.Run(base::File::FILE_ERROR_NOT_FOUND);
return;
}
DCHECK(operation_runner_.get());
@@ -297,7 +297,7 @@
const StatusCallback& callback) {
DCHECK(CalledOnValidThread());
if (!operation_runner_.get()) {
- callback.Run(base::PLATFORM_FILE_ERROR_NOT_FOUND);
+ callback.Run(base::File::FILE_ERROR_NOT_FOUND);
return;
}
DCHECK(operation_runner_.get());
@@ -345,7 +345,7 @@
impl_->MoveFileLocal(src_url, dest_url, option, callback);
}
-base::PlatformFileError SyncableFileSystemOperation::SyncGetPlatformPath(
+base::File::Error SyncableFileSystemOperation::SyncGetPlatformPath(
const FileSystemURL& url,
base::FilePath* platform_path) {
return impl_->SyncGetPlatformPath(url, platform_path);
@@ -374,7 +374,7 @@
url.origin());
}
-void SyncableFileSystemOperation::DidFinish(base::PlatformFileError status) {
+void SyncableFileSystemOperation::DidFinish(base::File::Error status) {
DCHECK(CalledOnValidThread());
DCHECK(!completion_callback_.is_null());
if (operation_runner_.get())
@@ -384,7 +384,7 @@
void SyncableFileSystemOperation::DidWrite(
const WriteCallback& callback,
- base::PlatformFileError result,
+ base::File::Error result,
int64 bytes,
bool complete) {
DCHECK(CalledOnValidThread());
@@ -399,7 +399,7 @@
void SyncableFileSystemOperation::OnCancelled() {
DCHECK(!completion_callback_.is_null());
- completion_callback_.Run(base::PLATFORM_FILE_ERROR_ABORT);
+ completion_callback_.Run(base::File::FILE_ERROR_ABORT);
}
} // namespace sync_file_system
diff --git a/chrome/browser/sync_file_system/local/syncable_file_system_operation.h b/chrome/browser/sync_file_system/local/syncable_file_system_operation.h
index 0948dc0..fda7573 100644
--- a/chrome/browser/sync_file_system/local/syncable_file_system_operation.h
+++ b/chrome/browser/sync_file_system/local/syncable_file_system_operation.h
@@ -91,7 +91,7 @@
const fileapi::FileSystemURL& dest_url,
CopyOrMoveOption option,
const StatusCallback& callback) OVERRIDE;
- virtual base::PlatformFileError SyncGetPlatformPath(
+ virtual base::File::Error SyncGetPlatformPath(
const fileapi::FileSystemURL& url,
base::FilePath* platform_path) OVERRIDE;
@@ -107,9 +107,9 @@
fileapi::FileSystemContext* file_system_context,
scoped_ptr<fileapi::FileSystemOperationContext> operation_context);
- void DidFinish(base::PlatformFileError status);
+ void DidFinish(base::File::Error status);
void DidWrite(const WriteCallback& callback,
- base::PlatformFileError result,
+ base::File::Error result,
int64 bytes,
bool complete);
diff --git a/chrome/browser/sync_file_system/local/syncable_file_system_unittest.cc b/chrome/browser/sync_file_system/local/syncable_file_system_unittest.cc
index 1b4f0653..ccd9a0f 100644
--- a/chrome/browser/sync_file_system/local/syncable_file_system_unittest.cc
+++ b/chrome/browser/sync_file_system/local/syncable_file_system_unittest.cc
@@ -111,13 +111,13 @@
// Brief combined testing. Just see if all the sandbox feature works.
TEST_F(SyncableFileSystemTest, SyncableLocalSandboxCombined) {
// Opens a syncable file system.
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_.OpenFileSystem());
// Do some operations.
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_.CreateDirectory(URL("dir")));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_.CreateFile(URL("dir/foo")));
const int64 kOriginalQuota = QuotaManager::kSyncableStorageDefaultHostQuota;
@@ -135,10 +135,10 @@
// Truncate to extend an existing file and see if the usage reflects it.
const int64 kFileSizeToExtend = 333;
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_.CreateFile(URL("dir/foo")));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_.TruncateFile(URL("dir/foo"), kFileSizeToExtend));
int64 new_usage;
@@ -149,7 +149,7 @@
// Shrink the quota to the current usage, try to extend the file further
// and see if it fails.
QuotaManager::kSyncableStorageDefaultHostQuota = new_usage;
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NO_SPACE,
+ EXPECT_EQ(base::File::FILE_ERROR_NO_SPACE,
file_system_.TruncateFile(URL("dir/foo"), kFileSizeToExtend + 1));
usage = new_usage;
@@ -158,7 +158,7 @@
EXPECT_EQ(usage, new_usage);
// Deletes the file system.
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_.DeleteFileSystem());
// Now the usage must be zero.
@@ -172,7 +172,7 @@
// Combined testing with LocalFileChangeTracker.
TEST_F(SyncableFileSystemTest, ChangeTrackerSimple) {
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_.OpenFileSystem());
const char kPath0[] = "dir a";
@@ -181,15 +181,15 @@
const char kPath3[] = "dir b";
// Do some operations.
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_.CreateDirectory(URL(kPath0))); // Creates a dir.
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_.CreateDirectory(URL(kPath1))); // Creates another.
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_.CreateFile(URL(kPath2))); // Creates a file.
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_.TruncateFile(URL(kPath2), 1)); // Modifies the file.
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_.TruncateFile(URL(kPath2), 2)); // Modifies it again.
FileSystemURLSet urls;
@@ -211,9 +211,9 @@
sync_file_system::SYNC_FILE_TYPE_FILE));
// Creates and removes a same directory.
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_.CreateDirectory(URL(kPath3)));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_.Remove(URL(kPath3), false /* recursive */));
// The changes will be offset.
@@ -222,7 +222,7 @@
EXPECT_TRUE(urls.empty());
// Recursively removes the kPath0 directory.
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_.Remove(URL(kPath0), true /* recursive */));
urls.clear();
@@ -249,11 +249,11 @@
TEST_F(SyncableFileSystemTest, DisableDirectoryOperations) {
bool was_enabled = IsSyncFSDirectoryOperationEnabled();
SetEnableSyncFSDirectoryOperation(false);
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_system_.OpenFileSystem());
// Try some directory operations (which should fail).
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_INVALID_OPERATION,
+ EXPECT_EQ(base::File::FILE_ERROR_INVALID_OPERATION,
file_system_.CreateDirectory(URL("dir")));
// Set up another (non-syncable) local file system.
@@ -265,16 +265,16 @@
const FileSystemURL kSrcDir = other_file_system_.CreateURLFromUTF8("/a");
const FileSystemURL kSrcChild = other_file_system_.CreateURLFromUTF8("/a/b");
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
fileapi::AsyncFileTestHelper::CreateDirectory(
other_file_system_.file_system_context(), kSrcDir));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
fileapi::AsyncFileTestHelper::CreateFile(
other_file_system_.file_system_context(), kSrcChild));
// Now try copying the directory into the syncable file system, which should
// fail if directory operation is disabled. (http://crbug.com/161442)
- EXPECT_NE(base::PLATFORM_FILE_OK,
+ EXPECT_NE(base::File::FILE_OK,
file_system_.Copy(kSrcDir, URL("dest")));
other_file_system_.TearDown();
diff --git a/chrome/browser/sync_file_system/sync_file_system_service_unittest.cc b/chrome/browser/sync_file_system/sync_file_system_service_unittest.cc
index a6ebece..7a35a8dc 100644
--- a/chrome/browser/sync_file_system/sync_file_system_service_unittest.cc
+++ b/chrome/browser/sync_file_system/sync_file_system_service_unittest.cc
@@ -69,9 +69,9 @@
// This is called on IO thread.
void VerifyFileError(base::RunLoop* run_loop,
- base::PlatformFileError error) {
+ base::File::Error error) {
DCHECK(run_loop);
- EXPECT_EQ(base::PLATFORM_FILE_OK, error);
+ EXPECT_EQ(base::File::FILE_OK, error);
run_loop->Quit();
}
@@ -179,7 +179,7 @@
run_loop.Run();
EXPECT_EQ(SYNC_STATUS_OK, status);
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system_->OpenFileSystem());
+ EXPECT_EQ(base::File::FILE_OK, file_system_->OpenFileSystem());
}
// Calls InitializeForApp after setting up the mock remote service to
@@ -344,7 +344,7 @@
ApplyLocalChange(change, _, _, kFile, _))
.WillOnce(MockStatusCallback(SYNC_STATUS_OK));
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system_->CreateFile(kFile));
+ EXPECT_EQ(base::File::FILE_OK, file_system_->CreateFile(kFile));
run_loop.Run();
@@ -472,7 +472,7 @@
// 3. The file has pending local changes.
{
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system_->CreateFile(kFile));
+ EXPECT_EQ(base::File::FILE_OK, file_system_->CreateFile(kFile));
base::RunLoop run_loop;
EXPECT_CALL(*mock_remote_service(), IsConflicting(kFile))
@@ -493,7 +493,7 @@
// 4. The file has a conflict and pending local changes. In this case
// we return SYNC_FILE_STATUS_CONFLICTING.
{
- EXPECT_EQ(base::PLATFORM_FILE_OK, file_system_->TruncateFile(kFile, 1U));
+ EXPECT_EQ(base::File::FILE_OK, file_system_->TruncateFile(kFile, 1U));
base::RunLoop run_loop;
EXPECT_CALL(*mock_remote_service(), IsConflicting(kFile))
diff --git a/chrome/browser/sync_file_system/sync_status_code.cc b/chrome/browser/sync_file_system/sync_status_code.cc
index ae96c0a0d..85a989c 100644
--- a/chrome/browser/sync_file_system/sync_status_code.cc
+++ b/chrome/browser/sync_file_system/sync_status_code.cc
@@ -19,7 +19,7 @@
return "Failed.";
// PlatformFile related errors.
- // TODO(nhiroki): add stringize function for PlatformFileError into base/.
+ // TODO(nhiroki): add stringize function for File::Error into base/.
case SYNC_FILE_ERROR_FAILED:
return "File operation failed.";
case SYNC_FILE_ERROR_IN_USE:
@@ -108,93 +108,93 @@
return SYNC_DATABASE_ERROR_FAILED;
}
-SyncStatusCode PlatformFileErrorToSyncStatusCode(
- base::PlatformFileError file_error) {
+SyncStatusCode FileErrorToSyncStatusCode(
+ base::File::Error file_error) {
switch (file_error) {
- case base::PLATFORM_FILE_OK:
+ case base::File::FILE_OK:
return SYNC_STATUS_OK;
- case base::PLATFORM_FILE_ERROR_FAILED:
+ case base::File::FILE_ERROR_FAILED:
return SYNC_FILE_ERROR_FAILED;
- case base::PLATFORM_FILE_ERROR_IN_USE:
+ case base::File::FILE_ERROR_IN_USE:
return SYNC_FILE_ERROR_IN_USE;
- case base::PLATFORM_FILE_ERROR_EXISTS:
+ case base::File::FILE_ERROR_EXISTS:
return SYNC_FILE_ERROR_EXISTS;
- case base::PLATFORM_FILE_ERROR_NOT_FOUND:
+ case base::File::FILE_ERROR_NOT_FOUND:
return SYNC_FILE_ERROR_NOT_FOUND;
- case base::PLATFORM_FILE_ERROR_ACCESS_DENIED:
+ case base::File::FILE_ERROR_ACCESS_DENIED:
return SYNC_FILE_ERROR_ACCESS_DENIED;
- case base::PLATFORM_FILE_ERROR_TOO_MANY_OPENED:
+ case base::File::FILE_ERROR_TOO_MANY_OPENED:
return SYNC_FILE_ERROR_TOO_MANY_OPENED;
- case base::PLATFORM_FILE_ERROR_NO_MEMORY:
+ case base::File::FILE_ERROR_NO_MEMORY:
return SYNC_FILE_ERROR_NO_MEMORY;
- case base::PLATFORM_FILE_ERROR_NO_SPACE:
+ case base::File::FILE_ERROR_NO_SPACE:
return SYNC_FILE_ERROR_NO_SPACE;
- case base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY:
+ case base::File::FILE_ERROR_NOT_A_DIRECTORY:
return SYNC_FILE_ERROR_NOT_A_DIRECTORY;
- case base::PLATFORM_FILE_ERROR_INVALID_OPERATION:
+ case base::File::FILE_ERROR_INVALID_OPERATION:
return SYNC_FILE_ERROR_INVALID_OPERATION;
- case base::PLATFORM_FILE_ERROR_SECURITY:
+ case base::File::FILE_ERROR_SECURITY:
return SYNC_FILE_ERROR_SECURITY;
- case base::PLATFORM_FILE_ERROR_ABORT:
+ case base::File::FILE_ERROR_ABORT:
return SYNC_FILE_ERROR_ABORT;
- case base::PLATFORM_FILE_ERROR_NOT_A_FILE:
+ case base::File::FILE_ERROR_NOT_A_FILE:
return SYNC_FILE_ERROR_NOT_A_FILE;
- case base::PLATFORM_FILE_ERROR_NOT_EMPTY:
+ case base::File::FILE_ERROR_NOT_EMPTY:
return SYNC_FILE_ERROR_NOT_EMPTY;
- case base::PLATFORM_FILE_ERROR_INVALID_URL:
+ case base::File::FILE_ERROR_INVALID_URL:
return SYNC_FILE_ERROR_INVALID_URL;
- case base::PLATFORM_FILE_ERROR_IO:
+ case base::File::FILE_ERROR_IO:
return SYNC_FILE_ERROR_IO;
- case base::PLATFORM_FILE_ERROR_MAX:
+ case base::File::FILE_ERROR_MAX:
NOTREACHED();
return SYNC_FILE_ERROR_FAILED;
}
// Return the value as is, so the value converted by
- // SyncStatusCodeToPlatformFileError could be restored.
+ // SyncStatusCodeToFileError could be restored.
return static_cast<SyncStatusCode>(file_error);
}
-base::PlatformFileError SyncStatusCodeToPlatformFileError(
+base::File::Error SyncStatusCodeToFileError(
SyncStatusCode status) {
switch (status) {
case SYNC_STATUS_OK:
- return base::PLATFORM_FILE_OK;
+ return base::File::FILE_OK;
case SYNC_FILE_ERROR_FAILED:
- return base::PLATFORM_FILE_ERROR_FAILED;
+ return base::File::FILE_ERROR_FAILED;
case SYNC_FILE_ERROR_IN_USE:
- return base::PLATFORM_FILE_ERROR_IN_USE;
+ return base::File::FILE_ERROR_IN_USE;
case SYNC_FILE_ERROR_EXISTS:
- return base::PLATFORM_FILE_ERROR_EXISTS;
+ return base::File::FILE_ERROR_EXISTS;
case SYNC_FILE_ERROR_NOT_FOUND:
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ return base::File::FILE_ERROR_NOT_FOUND;
case SYNC_FILE_ERROR_ACCESS_DENIED:
- return base::PLATFORM_FILE_ERROR_ACCESS_DENIED;
+ return base::File::FILE_ERROR_ACCESS_DENIED;
case SYNC_FILE_ERROR_TOO_MANY_OPENED:
- return base::PLATFORM_FILE_ERROR_TOO_MANY_OPENED;
+ return base::File::FILE_ERROR_TOO_MANY_OPENED;
case SYNC_FILE_ERROR_NO_MEMORY:
- return base::PLATFORM_FILE_ERROR_NO_MEMORY;
+ return base::File::FILE_ERROR_NO_MEMORY;
case SYNC_FILE_ERROR_NO_SPACE:
- return base::PLATFORM_FILE_ERROR_NO_SPACE;
+ return base::File::FILE_ERROR_NO_SPACE;
case SYNC_FILE_ERROR_NOT_A_DIRECTORY:
- return base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY;
+ return base::File::FILE_ERROR_NOT_A_DIRECTORY;
case SYNC_FILE_ERROR_INVALID_OPERATION:
- return base::PLATFORM_FILE_ERROR_INVALID_OPERATION;
+ return base::File::FILE_ERROR_INVALID_OPERATION;
case SYNC_FILE_ERROR_SECURITY:
- return base::PLATFORM_FILE_ERROR_SECURITY;
+ return base::File::FILE_ERROR_SECURITY;
case SYNC_FILE_ERROR_ABORT:
- return base::PLATFORM_FILE_ERROR_ABORT;
+ return base::File::FILE_ERROR_ABORT;
case SYNC_FILE_ERROR_NOT_A_FILE:
- return base::PLATFORM_FILE_ERROR_NOT_A_FILE;
+ return base::File::FILE_ERROR_NOT_A_FILE;
case SYNC_FILE_ERROR_NOT_EMPTY:
- return base::PLATFORM_FILE_ERROR_NOT_EMPTY;
+ return base::File::FILE_ERROR_NOT_EMPTY;
case SYNC_FILE_ERROR_INVALID_URL:
- return base::PLATFORM_FILE_ERROR_INVALID_URL;
+ return base::File::FILE_ERROR_INVALID_URL;
case SYNC_FILE_ERROR_IO:
- return base::PLATFORM_FILE_ERROR_IO;
+ return base::File::FILE_ERROR_IO;
default:
// Return the value as is, so that caller may be able to
// restore the information.
- return static_cast<base::PlatformFileError>(status);
+ return static_cast<base::File::Error>(status);
}
}
diff --git a/chrome/browser/sync_file_system/sync_status_code.h b/chrome/browser/sync_file_system/sync_status_code.h
index 2cd7281..d262438 100644
--- a/chrome/browser/sync_file_system/sync_status_code.h
+++ b/chrome/browser/sync_file_system/sync_status_code.h
@@ -7,7 +7,7 @@
#include <string>
-#include "base/platform_file.h"
+#include "base/files/file.h"
namespace leveldb {
class Status;
@@ -23,7 +23,7 @@
// submodule error code (yet).
SYNC_STATUS_FAILED = -1001,
- // Basic ones that could be directly mapped to PlatformFileError.
+ // Basic ones that could be directly mapped to File::Error.
SYNC_FILE_ERROR_FAILED = -1,
SYNC_FILE_ERROR_IN_USE = -2,
SYNC_FILE_ERROR_EXISTS = -3,
@@ -67,11 +67,9 @@
SyncStatusCode LevelDBStatusToSyncStatusCode(const leveldb::Status& status);
-SyncStatusCode PlatformFileErrorToSyncStatusCode(
- base::PlatformFileError file_error);
+SyncStatusCode FileErrorToSyncStatusCode(base::File::Error file_error);
-base::PlatformFileError SyncStatusCodeToPlatformFileError(
- SyncStatusCode status);
+base::File::Error SyncStatusCodeToFileError(SyncStatusCode status);
} // namespace sync_file_system
diff --git a/components/nacl/browser/nacl_browser.cc b/components/nacl/browser/nacl_browser.cc
index b1f1236b..b6a14fe 100644
--- a/components/nacl/browser/nacl_browser.cc
+++ b/components/nacl/browser/nacl_browser.cc
@@ -266,13 +266,13 @@
}
}
-void NaClBrowser::OnIrtOpened(base::PlatformFileError error_code,
+void NaClBrowser::OnIrtOpened(base::File::Error error_code,
base::PassPlatformFile file,
bool created) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
DCHECK_EQ(irt_state_, NaClResourceRequested);
DCHECK(!created);
- if (error_code == base::PLATFORM_FILE_OK) {
+ if (error_code == base::File::FILE_OK) {
irt_platform_file_ = file.ReleaseValue();
} else {
LOG(ERROR) << "Failed to open NaCl IRT file \""
diff --git a/components/nacl/browser/nacl_browser.h b/components/nacl/browser/nacl_browser.h
index 6ffdc0f6..d97add2 100644
--- a/components/nacl/browser/nacl_browser.h
+++ b/components/nacl/browser/nacl_browser.h
@@ -137,7 +137,7 @@
void OpenIrtLibraryFile();
- void OnIrtOpened(base::PlatformFileError error_code,
+ void OnIrtOpened(base::File::Error error_code,
base::PassPlatformFile file, bool created);
void InitValidationCacheFilePath();
diff --git a/content/browser/fileapi/blob_url_request_job_unittest.cc b/content/browser/fileapi/blob_url_request_job_unittest.cc
index e5a3781..f9f25e2 100644
--- a/content/browser/fileapi/blob_url_request_job_unittest.cc
+++ b/content/browser/fileapi/blob_url_request_job_unittest.cc
@@ -210,12 +210,12 @@
kFileSystemType,
base::FilePath().AppendASCII(filename));
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
fileapi::AsyncFileTestHelper::CreateFileWithData(
file_system_context_, url, buf, buf_size));
- base::PlatformFileInfo file_info;
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ base::File::Info file_info;
+ ASSERT_EQ(base::File::FILE_OK,
fileapi::AsyncFileTestHelper::GetMetadata(
file_system_context_, url, &file_info));
if (modification_time)
@@ -224,8 +224,8 @@
void OnValidateFileSystem(const GURL& root,
const std::string& name,
- base::PlatformFileError result) {
- ASSERT_EQ(base::PLATFORM_FILE_OK, result);
+ base::File::Error result) {
+ ASSERT_EQ(base::File::FILE_OK, result);
ASSERT_TRUE(root.is_valid());
file_system_root_url_ = root;
}
diff --git a/content/browser/fileapi/copy_or_move_file_validator_unittest.cc b/content/browser/fileapi/copy_or_move_file_validator_unittest.cc
index dc6a06a..750c420 100644
--- a/content/browser/fileapi/copy_or_move_file_validator_unittest.cc
+++ b/content/browser/fileapi/copy_or_move_file_validator_unittest.cc
@@ -36,8 +36,8 @@
void ExpectOk(const GURL& origin_url,
const std::string& name,
- base::PlatformFileError error) {
- ASSERT_EQ(base::PLATFORM_FILE_OK, error);
+ base::File::Error error) {
+ ASSERT_EQ(base::File::FILE_OK, error);
}
class CopyOrMoveFileValidatorTestHelper {
@@ -75,19 +75,19 @@
fileapi::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT,
base::Bind(&ExpectOk));
base::RunLoop().RunUntilIdle();
- ASSERT_EQ(base::PLATFORM_FILE_OK, CreateDirectory(SourceURL("")));
+ ASSERT_EQ(base::File::FILE_OK, CreateDirectory(SourceURL("")));
// Sets up dest.
DCHECK_EQ(kWithValidatorType, dest_type_);
- ASSERT_EQ(base::PLATFORM_FILE_OK, CreateDirectory(DestURL("")));
+ ASSERT_EQ(base::File::FILE_OK, CreateDirectory(DestURL("")));
copy_src_ = SourceURL("copy_src.jpg");
move_src_ = SourceURL("move_src.jpg");
copy_dest_ = DestURL("copy_dest.jpg");
move_dest_ = DestURL("move_dest.jpg");
- ASSERT_EQ(base::PLATFORM_FILE_OK, CreateFile(copy_src_, 10));
- ASSERT_EQ(base::PLATFORM_FILE_OK, CreateFile(move_src_, 10));
+ ASSERT_EQ(base::File::FILE_OK, CreateFile(copy_src_, 10));
+ ASSERT_EQ(base::File::FILE_OK, CreateFile(move_src_, 10));
ASSERT_TRUE(FileExists(copy_src_, 10));
ASSERT_TRUE(FileExists(move_src_, 10));
@@ -102,7 +102,7 @@
backend->InitializeCopyOrMoveFileValidatorFactory(factory.Pass());
}
- void CopyTest(base::PlatformFileError expected) {
+ void CopyTest(base::File::Error expected) {
ASSERT_TRUE(FileExists(copy_src_, 10));
ASSERT_FALSE(FileExists(copy_dest_, 10));
@@ -111,13 +111,13 @@
file_system_context_.get(), copy_src_, copy_dest_));
EXPECT_TRUE(FileExists(copy_src_, 10));
- if (expected == base::PLATFORM_FILE_OK)
+ if (expected == base::File::FILE_OK)
EXPECT_TRUE(FileExists(copy_dest_, 10));
else
EXPECT_FALSE(FileExists(copy_dest_, 10));
};
- void MoveTest(base::PlatformFileError expected) {
+ void MoveTest(base::File::Error expected) {
ASSERT_TRUE(FileExists(move_src_, 10));
ASSERT_FALSE(FileExists(move_dest_, 10));
@@ -125,7 +125,7 @@
AsyncFileTestHelper::Move(
file_system_context_.get(), move_src_, move_dest_));
- if (expected == base::PLATFORM_FILE_OK) {
+ if (expected == base::File::FILE_OK) {
EXPECT_FALSE(FileExists(move_src_, 10));
EXPECT_TRUE(FileExists(move_dest_, 10));
} else {
@@ -147,16 +147,16 @@
base::FilePath().AppendASCII("dest").AppendASCII(path));
}
- base::PlatformFileError CreateFile(const FileSystemURL& url, size_t size) {
- base::PlatformFileError result =
+ base::File::Error CreateFile(const FileSystemURL& url, size_t size) {
+ base::File::Error result =
AsyncFileTestHelper::CreateFile(file_system_context_.get(), url);
- if (result != base::PLATFORM_FILE_OK)
+ if (result != base::File::FILE_OK)
return result;
return AsyncFileTestHelper::TruncateFile(
file_system_context_.get(), url, size);
}
- base::PlatformFileError CreateDirectory(const FileSystemURL& url) {
+ base::File::Error CreateDirectory(const FileSystemURL& url) {
return AsyncFileTestHelper::CreateDirectory(file_system_context_.get(),
url);
}
@@ -212,12 +212,12 @@
class TestCopyOrMoveFileValidator : public CopyOrMoveFileValidator {
public:
explicit TestCopyOrMoveFileValidator(Validity validity)
- : result_(validity == VALID || validity == POST_WRITE_INVALID
- ? base::PLATFORM_FILE_OK
- : base::PLATFORM_FILE_ERROR_SECURITY),
- write_result_(validity == VALID || validity == PRE_WRITE_INVALID
- ? base::PLATFORM_FILE_OK
- : base::PLATFORM_FILE_ERROR_SECURITY) {
+ : result_(validity == VALID || validity == POST_WRITE_INVALID ?
+ base::File::FILE_OK :
+ base::File::FILE_ERROR_SECURITY),
+ write_result_(validity == VALID || validity == PRE_WRITE_INVALID ?
+ base::File::FILE_OK :
+ base::File::FILE_ERROR_SECURITY) {
}
virtual ~TestCopyOrMoveFileValidator() {}
@@ -237,8 +237,8 @@
}
private:
- base::PlatformFileError result_;
- base::PlatformFileError write_result_;
+ base::File::Error result_;
+ base::File::Error write_result_;
DISALLOW_COPY_AND_ASSIGN(TestCopyOrMoveFileValidator);
};
@@ -257,8 +257,8 @@
kWithValidatorType,
kWithValidatorType);
helper.SetUp();
- helper.CopyTest(base::PLATFORM_FILE_OK);
- helper.MoveTest(base::PLATFORM_FILE_OK);
+ helper.CopyTest(base::File::FILE_OK);
+ helper.MoveTest(base::File::FILE_OK);
}
TEST(CopyOrMoveFileValidatorTest, MissingValidator) {
@@ -268,8 +268,8 @@
kNoValidatorType,
kWithValidatorType);
helper.SetUp();
- helper.CopyTest(base::PLATFORM_FILE_ERROR_SECURITY);
- helper.MoveTest(base::PLATFORM_FILE_ERROR_SECURITY);
+ helper.CopyTest(base::File::FILE_ERROR_SECURITY);
+ helper.MoveTest(base::File::FILE_ERROR_SECURITY);
}
TEST(CopyOrMoveFileValidatorTest, AcceptAll) {
@@ -281,8 +281,8 @@
new TestCopyOrMoveFileValidatorFactory(VALID));
helper.SetMediaCopyOrMoveFileValidatorFactory(factory.Pass());
- helper.CopyTest(base::PLATFORM_FILE_OK);
- helper.MoveTest(base::PLATFORM_FILE_OK);
+ helper.CopyTest(base::File::FILE_OK);
+ helper.MoveTest(base::File::FILE_OK);
}
TEST(CopyOrMoveFileValidatorTest, AcceptNone) {
@@ -294,8 +294,8 @@
new TestCopyOrMoveFileValidatorFactory(PRE_WRITE_INVALID));
helper.SetMediaCopyOrMoveFileValidatorFactory(factory.Pass());
- helper.CopyTest(base::PLATFORM_FILE_ERROR_SECURITY);
- helper.MoveTest(base::PLATFORM_FILE_ERROR_SECURITY);
+ helper.CopyTest(base::File::FILE_ERROR_SECURITY);
+ helper.MoveTest(base::File::FILE_ERROR_SECURITY);
}
TEST(CopyOrMoveFileValidatorTest, OverrideValidator) {
@@ -312,8 +312,8 @@
new TestCopyOrMoveFileValidatorFactory(VALID));
helper.SetMediaCopyOrMoveFileValidatorFactory(accept_factory.Pass());
- helper.CopyTest(base::PLATFORM_FILE_ERROR_SECURITY);
- helper.MoveTest(base::PLATFORM_FILE_ERROR_SECURITY);
+ helper.CopyTest(base::File::FILE_ERROR_SECURITY);
+ helper.MoveTest(base::File::FILE_ERROR_SECURITY);
}
TEST(CopyOrMoveFileValidatorTest, RejectPostWrite) {
@@ -325,8 +325,8 @@
new TestCopyOrMoveFileValidatorFactory(POST_WRITE_INVALID));
helper.SetMediaCopyOrMoveFileValidatorFactory(factory.Pass());
- helper.CopyTest(base::PLATFORM_FILE_ERROR_SECURITY);
- helper.MoveTest(base::PLATFORM_FILE_ERROR_SECURITY);
+ helper.CopyTest(base::File::FILE_ERROR_SECURITY);
+ helper.MoveTest(base::File::FILE_ERROR_SECURITY);
}
} // namespace content
diff --git a/content/browser/fileapi/copy_or_move_operation_delegate_unittest.cc b/content/browser/fileapi/copy_or_move_operation_delegate_unittest.cc
index a1501964..15d11a1 100644
--- a/content/browser/fileapi/copy_or_move_operation_delegate_unittest.cc
+++ b/content/browser/fileapi/copy_or_move_operation_delegate_unittest.cc
@@ -46,8 +46,8 @@
void ExpectOk(const GURL& origin_url,
const std::string& name,
- base::PlatformFileError error) {
- ASSERT_EQ(base::PLATFORM_FILE_OK, error);
+ base::File::Error error) {
+ ASSERT_EQ(base::File::FILE_OK, error);
}
class TestValidatorFactory : public fileapi::CopyOrMoveFileValidatorFactory {
@@ -69,10 +69,10 @@
explicit TestValidator(bool pre_copy_valid,
bool post_copy_valid,
const std::string& reject_string)
- : result_(pre_copy_valid ? base::PLATFORM_FILE_OK
- : base::PLATFORM_FILE_ERROR_SECURITY),
- write_result_(post_copy_valid ? base::PLATFORM_FILE_OK
- : base::PLATFORM_FILE_ERROR_SECURITY),
+ : result_(pre_copy_valid ? base::File::FILE_OK :
+ base::File::FILE_ERROR_SECURITY),
+ write_result_(post_copy_valid ? base::File::FILE_OK :
+ base::File::FILE_ERROR_SECURITY),
reject_string_(reject_string) {
}
virtual ~TestValidator() {}
@@ -87,10 +87,10 @@
virtual void StartPostWriteValidation(
const base::FilePath& dest_platform_path,
const ResultCallback& result_callback) OVERRIDE {
- base::PlatformFileError result = write_result_;
+ base::File::Error result = write_result_;
std::string unsafe = dest_platform_path.BaseName().AsUTF8Unsafe();
if (unsafe.find(reject_string_) != std::string::npos) {
- result = base::PLATFORM_FILE_ERROR_SECURITY;
+ result = base::File::FILE_ERROR_SECURITY;
}
// Post the result since a real validator must do work asynchronously.
base::MessageLoop::current()->PostTask(
@@ -98,8 +98,8 @@
}
private:
- base::PlatformFileError result_;
- base::PlatformFileError write_result_;
+ base::File::Error result_;
+ base::File::Error write_result_;
std::string reject_string_;
DISALLOW_COPY_AND_ASSIGN(TestValidator);
@@ -133,8 +133,8 @@
}
void AssignAndQuit(base::RunLoop* run_loop,
- base::PlatformFileError* result_out,
- base::PlatformFileError result) {
+ base::File::Error* result_out,
+ base::File::Error result) {
*result_out = result;
run_loop->Quit();
}
@@ -260,12 +260,12 @@
origin_, dest_type_, base::FilePath::FromUTF8Unsafe(path));
}
- base::PlatformFileError Copy(const FileSystemURL& src,
- const FileSystemURL& dest) {
+ base::File::Error Copy(const FileSystemURL& src,
+ const FileSystemURL& dest) {
return AsyncFileTestHelper::Copy(file_system_context_.get(), src, dest);
}
- base::PlatformFileError CopyWithProgress(
+ base::File::Error CopyWithProgress(
const FileSystemURL& src,
const FileSystemURL& dest,
const AsyncFileTestHelper::CopyProgressCallback& progress_callback) {
@@ -273,16 +273,16 @@
file_system_context_.get(), src, dest, progress_callback);
}
- base::PlatformFileError Move(const FileSystemURL& src,
- const FileSystemURL& dest) {
+ base::File::Error Move(const FileSystemURL& src,
+ const FileSystemURL& dest) {
return AsyncFileTestHelper::Move(file_system_context_.get(), src, dest);
}
- base::PlatformFileError SetUpTestCaseFiles(
+ base::File::Error SetUpTestCaseFiles(
const FileSystemURL& root,
const TestCaseRecord* const test_cases,
size_t test_case_size) {
- base::PlatformFileError result = base::PLATFORM_FILE_ERROR_FAILED;
+ base::File::Error result = base::File::FILE_ERROR_FAILED;
for (size_t i = 0; i < test_case_size; ++i) {
const TestCaseRecord& test_case = test_cases[i];
FileSystemURL url = file_system_context_->CreateCrackedFileSystemURL(
@@ -293,8 +293,8 @@
result = CreateDirectory(url);
else
result = CreateFile(url, test_case.data_file_size);
- EXPECT_EQ(base::PLATFORM_FILE_OK, result) << url.DebugString();
- if (result != base::PLATFORM_FILE_OK)
+ EXPECT_EQ(base::File::FILE_OK, result) << url.DebugString();
+ if (result != base::File::FILE_OK)
return result;
}
return result;
@@ -317,7 +317,7 @@
while (!directories.empty()) {
FileSystemURL dir = directories.front();
directories.pop();
- ASSERT_EQ(base::PLATFORM_FILE_OK, ReadDirectory(dir, &entries));
+ ASSERT_EQ(base::File::FILE_OK, ReadDirectory(dir, &entries));
for (size_t i = 0; i < entries.size(); ++i) {
FileSystemURL url = file_system_context_->CreateCrackedFileSystemURL(
dir.origin(),
@@ -344,21 +344,21 @@
}
}
- base::PlatformFileError ReadDirectory(const FileSystemURL& url,
- FileEntryList* entries) {
+ base::File::Error ReadDirectory(const FileSystemURL& url,
+ FileEntryList* entries) {
return AsyncFileTestHelper::ReadDirectory(
file_system_context_.get(), url, entries);
}
- base::PlatformFileError CreateDirectory(const FileSystemURL& url) {
+ base::File::Error CreateDirectory(const FileSystemURL& url) {
return AsyncFileTestHelper::CreateDirectory(file_system_context_.get(),
url);
}
- base::PlatformFileError CreateFile(const FileSystemURL& url, size_t size) {
- base::PlatformFileError result =
+ base::File::Error CreateFile(const FileSystemURL& url, size_t size) {
+ base::File::Error result =
AsyncFileTestHelper::CreateFile(file_system_context_.get(), url);
- if (result != base::PLATFORM_FILE_OK)
+ if (result != base::File::FILE_OK)
return result;
return AsyncFileTestHelper::TruncateFile(
file_system_context_.get(), url, size);
@@ -408,11 +408,11 @@
int64 dest_initial_usage = helper.GetDestUsage();
// Set up a source file.
- ASSERT_EQ(base::PLATFORM_FILE_OK, helper.CreateFile(src, 10));
+ ASSERT_EQ(base::File::FILE_OK, helper.CreateFile(src, 10));
int64 src_increase = helper.GetSourceUsage() - src_initial_usage;
// Copy it.
- ASSERT_EQ(base::PLATFORM_FILE_OK, helper.Copy(src, dest));
+ ASSERT_EQ(base::File::FILE_OK, helper.Copy(src, dest));
// Verify.
ASSERT_TRUE(helper.FileExists(src, 10));
@@ -437,11 +437,11 @@
int64 dest_initial_usage = helper.GetDestUsage();
// Set up a source file.
- ASSERT_EQ(base::PLATFORM_FILE_OK, helper.CreateFile(src, 10));
+ ASSERT_EQ(base::File::FILE_OK, helper.CreateFile(src, 10));
int64 src_increase = helper.GetSourceUsage() - src_initial_usage;
// Move it.
- ASSERT_EQ(base::PLATFORM_FILE_OK, helper.Move(src, dest));
+ ASSERT_EQ(base::File::FILE_OK, helper.Move(src, dest));
// Verify.
ASSERT_FALSE(helper.FileExists(src, AsyncFileTestHelper::kDontCheckSize));
@@ -466,11 +466,11 @@
int64 dest_initial_usage = helper.GetDestUsage();
// Set up a source directory.
- ASSERT_EQ(base::PLATFORM_FILE_OK, helper.CreateDirectory(src));
+ ASSERT_EQ(base::File::FILE_OK, helper.CreateDirectory(src));
int64 src_increase = helper.GetSourceUsage() - src_initial_usage;
// Copy it.
- ASSERT_EQ(base::PLATFORM_FILE_OK, helper.Copy(src, dest));
+ ASSERT_EQ(base::File::FILE_OK, helper.Copy(src, dest));
// Verify.
ASSERT_TRUE(helper.DirectoryExists(src));
@@ -495,11 +495,11 @@
int64 dest_initial_usage = helper.GetDestUsage();
// Set up a source directory.
- ASSERT_EQ(base::PLATFORM_FILE_OK, helper.CreateDirectory(src));
+ ASSERT_EQ(base::File::FILE_OK, helper.CreateDirectory(src));
int64 src_increase = helper.GetSourceUsage() - src_initial_usage;
// Move it.
- ASSERT_EQ(base::PLATFORM_FILE_OK, helper.Move(src, dest));
+ ASSERT_EQ(base::File::FILE_OK, helper.Move(src, dest));
// Verify.
ASSERT_FALSE(helper.DirectoryExists(src));
@@ -524,15 +524,15 @@
int64 dest_initial_usage = helper.GetDestUsage();
// Set up a source directory.
- ASSERT_EQ(base::PLATFORM_FILE_OK, helper.CreateDirectory(src));
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK, helper.CreateDirectory(src));
+ ASSERT_EQ(base::File::FILE_OK,
helper.SetUpTestCaseFiles(src,
fileapi::test::kRegularTestCases,
fileapi::test::kRegularTestCaseSize));
int64 src_increase = helper.GetSourceUsage() - src_initial_usage;
// Copy it.
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
helper.CopyWithProgress(
src, dest,
AsyncFileTestHelper::CopyProgressCallback()));
@@ -564,15 +564,15 @@
int64 dest_initial_usage = helper.GetDestUsage();
// Set up a source directory.
- ASSERT_EQ(base::PLATFORM_FILE_OK, helper.CreateDirectory(src));
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK, helper.CreateDirectory(src));
+ ASSERT_EQ(base::File::FILE_OK,
helper.SetUpTestCaseFiles(src,
fileapi::test::kRegularTestCases,
fileapi::test::kRegularTestCaseSize));
int64 src_increase = helper.GetSourceUsage() - src_initial_usage;
// Move it.
- ASSERT_EQ(base::PLATFORM_FILE_OK, helper.Move(src, dest));
+ ASSERT_EQ(base::File::FILE_OK, helper.Move(src, dest));
// Verify.
ASSERT_FALSE(helper.DirectoryExists(src));
@@ -600,8 +600,8 @@
FileSystemURL dest = helper.DestURL("b");
// Set up a source directory.
- ASSERT_EQ(base::PLATFORM_FILE_OK, helper.CreateDirectory(src));
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK, helper.CreateDirectory(src));
+ ASSERT_EQ(base::File::FILE_OK,
helper.SetUpTestCaseFiles(src,
fileapi::test::kRegularTestCases,
fileapi::test::kRegularTestCaseSize));
@@ -633,12 +633,12 @@
FileSystemURL dest = helper.DestURL("b");
// Set up a source file.
- ASSERT_EQ(base::PLATFORM_FILE_OK, helper.CreateFile(src, 10));
+ ASSERT_EQ(base::File::FILE_OK, helper.CreateFile(src, 10));
// The copy attempt should fail with a security error -- getting
// the factory returns a security error, and the copy operation must
// respect that.
- ASSERT_EQ(base::PLATFORM_FILE_ERROR_SECURITY, helper.Copy(src, dest));
+ ASSERT_EQ(base::File::FILE_ERROR_SECURITY, helper.Copy(src, dest));
}
TEST(LocalFileSystemCopyOrMoveOperationTest, ProgressCallback) {
@@ -651,14 +651,14 @@
FileSystemURL dest = helper.DestURL("b");
// Set up a source directory.
- ASSERT_EQ(base::PLATFORM_FILE_OK, helper.CreateDirectory(src));
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK, helper.CreateDirectory(src));
+ ASSERT_EQ(base::File::FILE_OK,
helper.SetUpTestCaseFiles(src,
fileapi::test::kRegularTestCases,
fileapi::test::kRegularTestCaseSize));
std::vector<ProgressRecord> records;
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
helper.CopyWithProgress(src, dest,
base::Bind(&RecordProgressCallback,
base::Unretained(&records))));
@@ -748,12 +748,12 @@
base::Bind(&RecordFileProgressCallback, base::Unretained(&progress)),
base::TimeDelta()); // For testing, we need all the progress.
- base::PlatformFileError error = base::PLATFORM_FILE_ERROR_FAILED;
+ base::File::Error error = base::File::FILE_ERROR_FAILED;
base::RunLoop run_loop;
helper.Run(base::Bind(&AssignAndQuit, &run_loop, &error));
run_loop.Run();
- EXPECT_EQ(base::PLATFORM_FILE_OK, error);
+ EXPECT_EQ(base::File::FILE_OK, error);
ASSERT_EQ(5U, progress.size());
EXPECT_EQ(0, progress[0]);
EXPECT_EQ(10, progress[1]);
@@ -806,12 +806,12 @@
base::Bind(&RecordFileProgressCallback, base::Unretained(&progress)),
base::TimeDelta()); // For testing, we need all the progress.
- base::PlatformFileError error = base::PLATFORM_FILE_ERROR_FAILED;
+ base::File::Error error = base::File::FILE_ERROR_FAILED;
base::RunLoop run_loop;
helper.Run(base::Bind(&AssignAndQuit, &run_loop, &error));
run_loop.Run();
- EXPECT_EQ(base::PLATFORM_FILE_OK, error);
+ EXPECT_EQ(base::File::FILE_OK, error);
ASSERT_EQ(5U, progress.size());
EXPECT_EQ(0, progress[0]);
EXPECT_EQ(10, progress[1]);
@@ -866,12 +866,12 @@
base::Bind(&CopyOrMoveOperationDelegate::StreamCopyHelper::Cancel,
base::Unretained(&helper)));
- base::PlatformFileError error = base::PLATFORM_FILE_ERROR_FAILED;
+ base::File::Error error = base::File::FILE_ERROR_FAILED;
base::RunLoop run_loop;
helper.Run(base::Bind(&AssignAndQuit, &run_loop, &error));
run_loop.Run();
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_ABORT, error);
+ EXPECT_EQ(base::File::FILE_ERROR_ABORT, error);
}
} // namespace content
diff --git a/content/browser/fileapi/dragged_file_util_unittest.cc b/content/browser/fileapi/dragged_file_util_unittest.cc
index d54504c..ebe514d1 100644
--- a/content/browser/fileapi/dragged_file_util_unittest.cc
+++ b/content/browser/fileapi/dragged_file_util_unittest.cc
@@ -56,7 +56,7 @@
bool IsDirectoryEmpty(FileSystemContext* context, const FileSystemURL& url) {
FileEntryList entries;
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
AsyncFileTestHelper::ReadDirectory(context, url, &entries));
return entries.empty();
}
@@ -162,22 +162,22 @@
void VerifyFilesHaveSameContent(const FileSystemURL& url1,
const FileSystemURL& url2) {
// Get the file info and the platform path for url1.
- base::PlatformFileInfo info1;
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ base::File::Info info1;
+ ASSERT_EQ(base::File::FILE_OK,
AsyncFileTestHelper::GetMetadata(
file_system_context(), url1, &info1));
base::FilePath platform_path1;
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
AsyncFileTestHelper::GetPlatformPath(
file_system_context(), url1, &platform_path1));
// Get the file info and the platform path for url2.
- base::PlatformFileInfo info2;
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ base::File::Info info2;
+ ASSERT_EQ(base::File::FILE_OK,
AsyncFileTestHelper::GetMetadata(
file_system_context(), url2, &info2));
base::FilePath platform_path2;
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
AsyncFileTestHelper::GetPlatformPath(
file_system_context(), url2, &platform_path2));
@@ -207,7 +207,7 @@
FileSystemURL dir = directories.front();
directories.pop();
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
AsyncFileTestHelper::ReadDirectory(
file_system_context(), dir, &entries));
for (size_t i = 0; i < entries.size(); ++i) {
@@ -226,7 +226,7 @@
FileSystemURL dir = directories.front();
directories.pop();
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
AsyncFileTestHelper::ReadDirectory(
file_system_context(), dir, &entries));
for (size_t i = 0; i < entries.size(); ++i) {
@@ -301,10 +301,10 @@
// See if we can query the file info via the isolated FileUtil.
// (This should succeed since we have registered all the top-level
// entries of the test cases in SetUp())
- base::PlatformFileInfo info;
+ base::File::Info info;
base::FilePath platform_path;
FileSystemOperationContext context(file_system_context());
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
file_util()->GetFileInfo(&context, url, &info, &platform_path));
// See if the obtained file info is correct.
@@ -393,7 +393,7 @@
// Perform ReadDirectory in the isolated filesystem.
FileSystemURL url = GetFileSystemURL(base::FilePath(test_case.path));
FileEntryList entries;
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
AsyncFileTestHelper::ReadDirectory(
file_system_context(), url, &entries));
@@ -420,7 +420,7 @@
FileSystemOperationContext context(file_system_context());
base::FilePath local_file_path;
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_util()->GetLocalFilePath(&context, url, &local_file_path));
EXPECT_EQ(GetTestCasePlatformPath(test_case.path).value(),
local_file_path.value());
@@ -435,14 +435,14 @@
std::queue<FileSystemURL> directories;
directories.push(src_root);
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
AsyncFileTestHelper::CreateDirectory(file_system_context(),
dest_root));
while (!directories.empty()) {
FileSystemURL dir = directories.front();
directories.pop();
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
AsyncFileTestHelper::ReadDirectory(file_system_context(),
dir, &entries));
for (size_t i = 0; i < entries.size(); ++i) {
@@ -452,7 +452,7 @@
src_root, dest_root, src_url);
if (entries[i].is_directory) {
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
AsyncFileTestHelper::CreateDirectory(file_system_context(),
dest_url));
directories.push(src_url);
@@ -460,7 +460,7 @@
}
SCOPED_TRACE(testing::Message() << "Testing file copy "
<< src_url.path().value());
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
AsyncFileTestHelper::Copy(file_system_context(),
src_url, dest_url));
VerifyFilesHaveSameContent(src_url, dest_url);
@@ -472,12 +472,12 @@
FileSystemURL src_root = GetFileSystemURL(base::FilePath());
FileSystemURL dest_root = GetOtherFileSystemURL(base::FilePath());
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
AsyncFileTestHelper::CreateDirectory(file_system_context(),
dest_root));
FileEntryList entries;
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
AsyncFileTestHelper::ReadDirectory(file_system_context(),
src_root, &entries));
for (size_t i = 0; i < entries.size(); ++i) {
@@ -489,7 +489,7 @@
src_root, dest_root, src_url);
SCOPED_TRACE(testing::Message() << "Testing file copy "
<< src_url.path().value());
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
AsyncFileTestHelper::Copy(file_system_context(),
src_url, dest_url));
VerifyDirectoriesHaveSameContent(src_url, dest_url);
@@ -508,15 +508,15 @@
base::Time last_access_time = base::Time::FromTimeT(1000);
base::Time last_modified_time = base::Time::FromTimeT(2000);
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_util()->Touch(GetOperationContext().get(), url,
last_access_time,
last_modified_time));
// Verification.
- base::PlatformFileInfo info;
+ base::File::Info info;
base::FilePath platform_path;
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
file_util()->GetFileInfo(GetOperationContext().get(), url,
&info, &platform_path));
EXPECT_EQ(last_access_time.ToTimeT(), info.last_accessed.ToTimeT());
@@ -535,19 +535,19 @@
FileSystemURL url = GetFileSystemURL(base::FilePath(test_case.path));
// Truncate to 0.
- base::PlatformFileInfo info;
+ base::File::Info info;
base::FilePath platform_path;
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_util()->Truncate(GetOperationContext().get(), url, 0));
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
file_util()->GetFileInfo(GetOperationContext().get(), url,
&info, &platform_path));
EXPECT_EQ(0, info.size);
// Truncate (extend) to 999.
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_util()->Truncate(GetOperationContext().get(), url, 999));
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
file_util()->GetFileInfo(GetOperationContext().get(), url,
&info, &platform_path));
EXPECT_EQ(999, info.size);
diff --git a/content/browser/fileapi/file_system_dir_url_request_job_unittest.cc b/content/browser/fileapi/file_system_dir_url_request_job_unittest.cc
index 1468bdff..46b4bb16 100644
--- a/content/browser/fileapi/file_system_dir_url_request_job_unittest.cc
+++ b/content/browser/fileapi/file_system_dir_url_request_job_unittest.cc
@@ -79,8 +79,8 @@
void OnOpenFileSystem(const GURL& root_url,
const std::string& name,
- base::PlatformFileError result) {
- ASSERT_EQ(base::PLATFORM_FILE_OK, result);
+ base::File::Error result) {
+ ASSERT_EQ(base::File::FILE_OK, result);
}
void TestRequestHelper(const GURL& url, bool run_to_completion,
@@ -128,7 +128,7 @@
void CreateDirectory(const base::StringPiece& dir_name) {
base::FilePath path = base::FilePath().AppendASCII(dir_name);
scoped_ptr<FileSystemOperationContext> context(NewOperationContext());
- ASSERT_EQ(base::PLATFORM_FILE_OK, file_util()->CreateDirectory(
+ ASSERT_EQ(base::File::FILE_OK, file_util()->CreateDirectory(
context.get(),
CreateURL(path),
false /* exclusive */,
@@ -138,20 +138,20 @@
void EnsureFileExists(const base::StringPiece file_name) {
base::FilePath path = base::FilePath().AppendASCII(file_name);
scoped_ptr<FileSystemOperationContext> context(NewOperationContext());
- ASSERT_EQ(base::PLATFORM_FILE_OK, file_util()->EnsureFileExists(
+ ASSERT_EQ(base::File::FILE_OK, file_util()->EnsureFileExists(
context.get(), CreateURL(path), NULL));
}
void TruncateFile(const base::StringPiece file_name, int64 length) {
base::FilePath path = base::FilePath().AppendASCII(file_name);
scoped_ptr<FileSystemOperationContext> context(NewOperationContext());
- ASSERT_EQ(base::PLATFORM_FILE_OK, file_util()->Truncate(
+ ASSERT_EQ(base::File::FILE_OK, file_util()->Truncate(
context.get(), CreateURL(path), length));
}
- base::PlatformFileError GetFileInfo(const base::FilePath& path,
- base::PlatformFileInfo* file_info,
- base::FilePath* platform_file_path) {
+ base::File::Error GetFileInfo(const base::FilePath& path,
+ base::File::Info* file_info,
+ base::FilePath* platform_file_path) {
scoped_ptr<FileSystemOperationContext> context(NewOperationContext());
return file_util()->GetFileInfo(context.get(),
CreateURL(path),
diff --git a/content/browser/fileapi/file_system_file_stream_reader_unittest.cc b/content/browser/fileapi/file_system_file_stream_reader_unittest.cc
index 3295230..94bbeaf 100644
--- a/content/browser/fileapi/file_system_file_stream_reader_unittest.cc
+++ b/content/browser/fileapi/file_system_file_stream_reader_unittest.cc
@@ -109,12 +109,12 @@
base::Time* modification_time) {
FileSystemURL url = GetFileSystemURL(file_name);
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
fileapi::AsyncFileTestHelper::CreateFileWithData(
file_system_context_, url, buf, buf_size));
- base::PlatformFileInfo file_info;
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ base::File::Info file_info;
+ ASSERT_EQ(base::File::FILE_OK,
AsyncFileTestHelper::GetMetadata(
file_system_context_, url, &file_info));
if (modification_time)
@@ -124,8 +124,8 @@
private:
static void OnOpenFileSystem(const GURL& root_url,
const std::string& name,
- base::PlatformFileError result) {
- ASSERT_EQ(base::PLATFORM_FILE_OK, result);
+ base::File::Error result) {
+ ASSERT_EQ(base::File::FILE_OK, result);
}
FileSystemURL GetFileSystemURL(const std::string& file_name) {
diff --git a/content/browser/fileapi/file_system_operation_impl_unittest.cc b/content/browser/fileapi/file_system_operation_impl_unittest.cc
index e084947..c405b962 100644
--- a/content/browser/fileapi/file_system_operation_impl_unittest.cc
+++ b/content/browser/fileapi/file_system_operation_impl_unittest.cc
@@ -45,8 +45,8 @@
const int kFileOperationStatusNotSet = 1;
void AssertFileErrorEq(const tracked_objects::Location& from_here,
- base::PlatformFileError expected,
- base::PlatformFileError actual) {
+ base::File::Error expected,
+ base::File::Error actual) {
ASSERT_EQ(expected, actual) << from_here.ToString();
}
@@ -92,7 +92,7 @@
}
int status() const { return status_; }
- const base::PlatformFileInfo& info() const { return info_; }
+ const base::File::Info& info() const { return info_; }
const base::FilePath& path() const { return path_; }
const std::vector<fileapi::DirectoryEntry>& entries() const {
return entries_;
@@ -150,7 +150,7 @@
FileSystemURL CreateFile(const std::string& path) {
FileSystemURL url = URLForPath(path);
bool created = false;
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_util()->EnsureFileExists(NewContext().get(),
url, &created));
EXPECT_TRUE(created);
@@ -159,7 +159,7 @@
FileSystemURL CreateDirectory(const std::string& path) {
FileSystemURL url = URLForPath(path);
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_util()->CreateDirectory(NewContext().get(), url,
false /* exclusive */, true));
return url;
@@ -193,27 +193,27 @@
weak_factory_.GetWeakPtr());
}
- void DidFinish(base::PlatformFileError status) {
+ void DidFinish(base::File::Error status) {
status_ = status;
}
void DidReadDirectory(
- base::PlatformFileError status,
+ base::File::Error status,
const std::vector<fileapi::DirectoryEntry>& entries,
bool /* has_more */) {
entries_ = entries;
status_ = status;
}
- void DidGetMetadata(base::PlatformFileError status,
- const base::PlatformFileInfo& info) {
+ void DidGetMetadata(base::File::Error status,
+ const base::File::Info& info) {
info_ = info;
status_ = status;
}
void DidCreateSnapshotFile(
- base::PlatformFileError status,
- const base::PlatformFileInfo& info,
+ base::File::Error status,
+ const base::File::Info& info,
const base::FilePath& platform_path,
const scoped_refptr<ShareableFileReference>& shareable_file_ref) {
info_ = info;
@@ -246,7 +246,7 @@
sandbox_file_system_.file_system_context(), url);
operation_runner()->Remove(url, false /* recursive */,
base::Bind(&AssertFileErrorEq, FROM_HERE,
- base::PLATFORM_FILE_OK));
+ base::File::FILE_OK));
base::RunLoop().RunUntilIdle();
change_observer()->ResetCount();
@@ -289,7 +289,7 @@
// For post-operation status.
int status_;
- base::PlatformFileInfo info_;
+ base::File::Info info_;
base::FilePath path_;
std::vector<fileapi::DirectoryEntry> entries_;
scoped_refptr<ShareableFileReference> shareable_file_ref_;
@@ -308,7 +308,7 @@
FileSystemOperation::OPTION_NONE,
RecordStatusCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, status());
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND, status());
EXPECT_TRUE(change_observer()->HasNoChange());
}
@@ -320,7 +320,7 @@
FileSystemOperation::OPTION_NONE,
RecordStatusCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_INVALID_OPERATION, status());
+ EXPECT_EQ(base::File::FILE_ERROR_INVALID_OPERATION, status());
EXPECT_TRUE(change_observer()->HasNoChange());
}
@@ -334,7 +334,7 @@
FileSystemOperation::OPTION_NONE,
RecordStatusCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_INVALID_OPERATION, status());
+ EXPECT_EQ(base::File::FILE_ERROR_INVALID_OPERATION, status());
EXPECT_TRUE(change_observer()->HasNoChange());
}
@@ -349,7 +349,7 @@
FileSystemOperation::OPTION_NONE,
RecordStatusCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_EMPTY, status());
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_EMPTY, status());
EXPECT_TRUE(change_observer()->HasNoChange());
}
@@ -363,7 +363,7 @@
FileSystemOperation::OPTION_NONE,
RecordStatusCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_INVALID_OPERATION, status());
+ EXPECT_EQ(base::File::FILE_ERROR_INVALID_OPERATION, status());
EXPECT_TRUE(change_observer()->HasNoChange());
}
@@ -374,7 +374,7 @@
FileSystemOperation::OPTION_NONE,
RecordStatusCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, status());
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND, status());
EXPECT_TRUE(change_observer()->HasNoChange());
}
@@ -386,7 +386,7 @@
FileSystemOperation::OPTION_NONE,
RecordStatusCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_OK, status());
+ EXPECT_EQ(base::File::FILE_OK, status());
EXPECT_TRUE(FileExists("dest"));
EXPECT_EQ(1, change_observer()->get_and_reset_modify_file_count());
@@ -403,7 +403,7 @@
FileSystemOperation::OPTION_NONE,
RecordStatusCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_OK, status());
+ EXPECT_EQ(base::File::FILE_OK, status());
EXPECT_TRUE(FileExists("new"));
EXPECT_EQ(1, change_observer()->get_and_reset_create_file_from_count());
@@ -419,7 +419,7 @@
FileSystemOperation::OPTION_NONE,
RecordStatusCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_OK, status());
+ EXPECT_EQ(base::File::FILE_OK, status());
EXPECT_FALSE(DirectoryExists("src"));
EXPECT_EQ(1, change_observer()->get_and_reset_create_directory_count());
@@ -439,7 +439,7 @@
FileSystemOperation::OPTION_NONE,
RecordStatusCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_OK, status());
+ EXPECT_EQ(base::File::FILE_OK, status());
EXPECT_FALSE(DirectoryExists("src"));
EXPECT_TRUE(DirectoryExists("dest/new"));
@@ -459,7 +459,7 @@
FileSystemOperation::OPTION_NONE,
RecordStatusCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_OK, status());
+ EXPECT_EQ(base::File::FILE_OK, status());
EXPECT_TRUE(DirectoryExists("dest/dir"));
EXPECT_TRUE(FileExists("dest/dir/sub"));
@@ -479,7 +479,7 @@
FileSystemOperation::OPTION_NONE,
RecordStatusCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_OK, status());
+ EXPECT_EQ(base::File::FILE_OK, status());
EXPECT_TRUE(DirectoryExists("src/dir"));
EXPECT_TRUE(FileExists("src/dir/sub"));
@@ -496,7 +496,7 @@
FileSystemOperationRunner::CopyProgressCallback(),
RecordStatusCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, status());
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND, status());
EXPECT_TRUE(change_observer()->HasNoChange());
}
@@ -509,7 +509,7 @@
FileSystemOperationRunner::CopyProgressCallback(),
RecordStatusCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_INVALID_OPERATION, status());
+ EXPECT_EQ(base::File::FILE_ERROR_INVALID_OPERATION, status());
EXPECT_TRUE(change_observer()->HasNoChange());
}
@@ -524,7 +524,7 @@
FileSystemOperationRunner::CopyProgressCallback(),
RecordStatusCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_INVALID_OPERATION, status());
+ EXPECT_EQ(base::File::FILE_ERROR_INVALID_OPERATION, status());
EXPECT_TRUE(change_observer()->HasNoChange());
}
@@ -540,7 +540,7 @@
FileSystemOperationRunner::CopyProgressCallback(),
RecordStatusCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_EMPTY, status());
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_EMPTY, status());
EXPECT_TRUE(change_observer()->HasNoChange());
}
@@ -554,7 +554,7 @@
FileSystemOperationRunner::CopyProgressCallback(),
RecordStatusCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_INVALID_OPERATION, status());
+ EXPECT_EQ(base::File::FILE_ERROR_INVALID_OPERATION, status());
EXPECT_TRUE(change_observer()->HasNoChange());
}
@@ -567,7 +567,7 @@
FileSystemOperationRunner::CopyProgressCallback(),
RecordStatusCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, status());
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND, status());
EXPECT_TRUE(change_observer()->HasNoChange());
}
@@ -577,7 +577,7 @@
FileSystemURL dest_dir(CreateDirectory("dest"));
operation_runner()->Truncate(src_file, 6, RecordStatusCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_OK, status());
+ EXPECT_EQ(base::File::FILE_OK, status());
EXPECT_EQ(6, GetFileSize("src/file"));
FileSystemURL dest_file(URLForPath("dest/file"));
@@ -590,7 +590,7 @@
FileSystemOperationRunner::CopyProgressCallback(),
RecordStatusCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NO_SPACE, status());
+ EXPECT_EQ(base::File::FILE_ERROR_NO_SPACE, status());
EXPECT_FALSE(FileExists("dest/file"));
}
@@ -603,7 +603,7 @@
FileSystemOperationRunner::CopyProgressCallback(),
RecordStatusCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_OK, status());
+ EXPECT_EQ(base::File::FILE_OK, status());
EXPECT_TRUE(FileExists("dest"));
EXPECT_EQ(2, quota_manager_proxy()->notify_storage_accessed_count());
@@ -619,7 +619,7 @@
FileSystemOperationRunner::CopyProgressCallback(),
RecordStatusCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_OK, status());
+ EXPECT_EQ(base::File::FILE_OK, status());
EXPECT_TRUE(FileExists("new"));
EXPECT_EQ(2, quota_manager_proxy()->notify_storage_accessed_count());
@@ -636,7 +636,7 @@
FileSystemOperationRunner::CopyProgressCallback(),
RecordStatusCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_OK, status());
+ EXPECT_EQ(base::File::FILE_OK, status());
// Make sure we've overwritten but not copied the source under the |dest_dir|.
EXPECT_TRUE(DirectoryExists("dest"));
@@ -657,7 +657,7 @@
FileSystemOperationRunner::CopyProgressCallback(),
RecordStatusCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_OK, status());
+ EXPECT_EQ(base::File::FILE_OK, status());
EXPECT_TRUE(DirectoryExists("dest"));
EXPECT_GE(quota_manager_proxy()->notify_storage_accessed_count(), 2);
@@ -678,7 +678,7 @@
RecordStatusCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_OK, status());
+ EXPECT_EQ(base::File::FILE_OK, status());
EXPECT_TRUE(DirectoryExists("dest/dir"));
EXPECT_TRUE(FileExists("dest/dir/sub"));
@@ -702,7 +702,7 @@
RecordStatusCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_OK, status());
+ EXPECT_EQ(base::File::FILE_OK, status());
EXPECT_TRUE(DirectoryExists("src/dir"));
EXPECT_TRUE(FileExists("src/dir/sub"));
@@ -731,7 +731,7 @@
base::RunLoop().RunUntilIdle();
EXPECT_EQ(1, change_observer()->create_file_count());
- EXPECT_EQ(base::PLATFORM_FILE_OK, status());
+ EXPECT_EQ(base::File::FILE_OK, status());
EXPECT_TRUE(FileExists("dest/file"));
int64 after_usage;
GetUsageAndQuota(&after_usage, NULL);
@@ -762,7 +762,7 @@
EXPECT_FALSE(FileExists("dest/file"));
EXPECT_EQ(0, change_observer()->create_file_count());
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NO_SPACE, status());
+ EXPECT_EQ(base::File::FILE_ERROR_NO_SPACE, status());
}
TEST_F(FileSystemOperationImplTest, TestCreateFileFailure) {
@@ -770,7 +770,7 @@
FileSystemURL file(CreateFile("file"));
operation_runner()->CreateFile(file, true, RecordStatusCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_EXISTS, status());
+ EXPECT_EQ(base::File::FILE_ERROR_EXISTS, status());
EXPECT_TRUE(change_observer()->HasNoChange());
}
@@ -779,7 +779,7 @@
FileSystemURL file(CreateFile("file"));
operation_runner()->CreateFile(file, false, RecordStatusCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_OK, status());
+ EXPECT_EQ(base::File::FILE_OK, status());
EXPECT_TRUE(FileExists("file"));
// The file was already there; did nothing.
@@ -791,7 +791,7 @@
operation_runner()->CreateFile(URLForPath("new"), true,
RecordStatusCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_OK, status());
+ EXPECT_EQ(base::File::FILE_OK, status());
EXPECT_TRUE(FileExists("new"));
EXPECT_EQ(1, change_observer()->get_and_reset_create_file_count());
}
@@ -801,7 +801,7 @@
operation_runner()->CreateFile(URLForPath("nonexistent"), false,
RecordStatusCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_OK, status());
+ EXPECT_EQ(base::File::FILE_OK, status());
EXPECT_EQ(1, change_observer()->get_and_reset_create_file_count());
}
@@ -812,7 +812,7 @@
URLForPath("nonexistent/dir"), false, false,
RecordStatusCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, status());
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND, status());
EXPECT_TRUE(change_observer()->HasNoChange());
}
@@ -822,7 +822,7 @@
operation_runner()->CreateDirectory(dir, true, false,
RecordStatusCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_EXISTS, status());
+ EXPECT_EQ(base::File::FILE_ERROR_EXISTS, status());
EXPECT_TRUE(change_observer()->HasNoChange());
}
@@ -832,7 +832,7 @@
operation_runner()->CreateDirectory(file, true, false,
RecordStatusCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_EXISTS, status());
+ EXPECT_EQ(base::File::FILE_ERROR_EXISTS, status());
EXPECT_TRUE(change_observer()->HasNoChange());
}
@@ -842,14 +842,14 @@
operation_runner()->CreateDirectory(dir, false, false,
RecordStatusCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_OK, status());
+ EXPECT_EQ(base::File::FILE_OK, status());
EXPECT_TRUE(change_observer()->HasNoChange());
// Dir doesn't exist.
operation_runner()->CreateDirectory(URLForPath("new"), false, false,
RecordStatusCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_OK, status());
+ EXPECT_EQ(base::File::FILE_OK, status());
EXPECT_TRUE(DirectoryExists("new"));
EXPECT_EQ(1, change_observer()->get_and_reset_create_directory_count());
}
@@ -859,7 +859,7 @@
operation_runner()->CreateDirectory(URLForPath("new"), true, false,
RecordStatusCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_OK, status());
+ EXPECT_EQ(base::File::FILE_OK, status());
EXPECT_TRUE(DirectoryExists("new"));
EXPECT_EQ(1, change_observer()->get_and_reset_create_directory_count());
EXPECT_TRUE(change_observer()->HasNoChange());
@@ -869,17 +869,17 @@
operation_runner()->GetMetadata(URLForPath("nonexistent"),
RecordMetadataCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, status());
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND, status());
operation_runner()->FileExists(URLForPath("nonexistent"),
RecordStatusCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, status());
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND, status());
operation_runner()->DirectoryExists(URLForPath("nonexistent"),
RecordStatusCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, status());
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND, status());
EXPECT_TRUE(change_observer()->HasNoChange());
}
@@ -890,23 +890,23 @@
operation_runner()->DirectoryExists(dir, RecordStatusCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_OK, status());
+ EXPECT_EQ(base::File::FILE_OK, status());
++read_access;
operation_runner()->GetMetadata(dir, RecordMetadataCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_OK, status());
+ EXPECT_EQ(base::File::FILE_OK, status());
EXPECT_TRUE(info().is_directory);
++read_access;
operation_runner()->FileExists(file, RecordStatusCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_OK, status());
+ EXPECT_EQ(base::File::FILE_OK, status());
++read_access;
operation_runner()->GetMetadata(file, RecordMetadataCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_OK, status());
+ EXPECT_EQ(base::File::FILE_OK, status());
EXPECT_FALSE(info().is_directory);
++read_access;
@@ -919,12 +919,12 @@
FileSystemURL dir(CreateDirectory("dir"));
operation_runner()->FileExists(dir, RecordStatusCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_A_FILE, status());
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_A_FILE, status());
FileSystemURL file(CreateFile("file"));
operation_runner()->DirectoryExists(file, RecordStatusCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY, status());
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_A_DIRECTORY, status());
}
TEST_F(FileSystemOperationImplTest, TestReadDirFailure) {
@@ -932,13 +932,13 @@
operation_runner()->ReadDirectory(URLForPath("nonexistent"),
RecordReadDirectoryCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, status());
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND, status());
// File exists.
FileSystemURL file(CreateFile("file"));
operation_runner()->ReadDirectory(file, RecordReadDirectoryCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY, status());
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_A_DIRECTORY, status());
EXPECT_TRUE(change_observer()->HasNoChange());
}
@@ -953,7 +953,7 @@
operation_runner()->ReadDirectory(parent_dir, RecordReadDirectoryCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_OK, status());
+ EXPECT_EQ(base::File::FILE_OK, status());
EXPECT_EQ(2u, entries().size());
for (size_t i = 0; i < entries().size(); ++i) {
@@ -971,7 +971,7 @@
operation_runner()->Remove(URLForPath("nonexistent"), false /* recursive */,
RecordStatusCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, status());
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND, status());
// It's an error to try to remove a non-empty directory if recursive flag
// is false.
@@ -986,7 +986,7 @@
operation_runner()->Remove(parent_dir, false /* recursive */,
RecordStatusCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_EMPTY, status());
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_EMPTY, status());
EXPECT_TRUE(change_observer()->HasNoChange());
}
@@ -996,7 +996,7 @@
operation_runner()->Remove(empty_dir, false /* recursive */,
RecordStatusCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_OK, status());
+ EXPECT_EQ(base::File::FILE_OK, status());
EXPECT_FALSE(DirectoryExists("empty_dir"));
EXPECT_EQ(1, change_observer()->get_and_reset_remove_directory_count());
@@ -1022,7 +1022,7 @@
operation_runner()->Remove(parent_dir, true /* recursive */,
RecordStatusCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_OK, status());
+ EXPECT_EQ(base::File::FILE_OK, status());
EXPECT_FALSE(DirectoryExists("parent_dir"));
EXPECT_EQ(2, change_observer()->get_and_reset_remove_directory_count());
@@ -1042,7 +1042,7 @@
// Check that its length is the size of the data written.
operation_runner()->GetMetadata(file, RecordMetadataCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_OK, status());
+ EXPECT_EQ(base::File::FILE_OK, status());
EXPECT_FALSE(info().is_directory);
EXPECT_EQ(data_size, info().size);
@@ -1050,7 +1050,7 @@
int length = 17;
operation_runner()->Truncate(file, length, RecordStatusCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_OK, status());
+ EXPECT_EQ(base::File::FILE_OK, status());
EXPECT_EQ(1, change_observer()->get_and_reset_modify_file_count());
EXPECT_TRUE(change_observer()->HasNoChange());
@@ -1071,7 +1071,7 @@
length = 3;
operation_runner()->Truncate(file, length, RecordStatusCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_OK, status());
+ EXPECT_EQ(base::File::FILE_OK, status());
EXPECT_EQ(1, change_observer()->get_and_reset_modify_file_count());
EXPECT_TRUE(change_observer()->HasNoChange());
@@ -1096,7 +1096,7 @@
operation_runner()->Truncate(file, 10, RecordStatusCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_OK, status());
+ EXPECT_EQ(base::File::FILE_OK, status());
EXPECT_EQ(1, change_observer()->get_and_reset_modify_file_count());
EXPECT_TRUE(change_observer()->HasNoChange());
@@ -1104,7 +1104,7 @@
operation_runner()->Truncate(file, 11, RecordStatusCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NO_SPACE, status());
+ EXPECT_EQ(base::File::FILE_ERROR_NO_SPACE, status());
EXPECT_TRUE(change_observer()->HasNoChange());
EXPECT_EQ(10, GetFileSize("dir/file"));
@@ -1130,7 +1130,7 @@
operation_runner()->TouchFile(file, new_accessed_time, new_modified_time,
RecordStatusCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_OK, status());
+ EXPECT_EQ(base::File::FILE_OK, status());
EXPECT_TRUE(change_observer()->HasNoChange());
EXPECT_TRUE(base::GetFileInfo(platform_path, &info));
@@ -1149,7 +1149,7 @@
FileSystemURL file(CreateFile("dir/file"));
operation_runner()->FileExists(file, RecordStatusCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_OK, status());
+ EXPECT_EQ(base::File::FILE_OK, status());
// See if we can get a 'snapshot' file info for the file.
// Since FileSystemOperationImpl assumes the file exists in the local
@@ -1157,7 +1157,7 @@
// as the file itself.
operation_runner()->CreateSnapshotFile(file, RecordSnapshotFileCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::PLATFORM_FILE_OK, status());
+ EXPECT_EQ(base::File::FILE_OK, status());
EXPECT_FALSE(info().is_directory);
EXPECT_EQ(PlatformPath("dir/file"), path());
EXPECT_TRUE(change_observer()->HasNoChange());
@@ -1184,16 +1184,16 @@
operation_runner()->Truncate(
child_file1, 5000,
- base::Bind(&AssertFileErrorEq, FROM_HERE, base::PLATFORM_FILE_OK));
+ base::Bind(&AssertFileErrorEq, FROM_HERE, base::File::FILE_OK));
operation_runner()->Truncate(
child_file2, 400,
- base::Bind(&AssertFileErrorEq, FROM_HERE, base::PLATFORM_FILE_OK));
+ base::Bind(&AssertFileErrorEq, FROM_HERE, base::File::FILE_OK));
operation_runner()->Truncate(
grandchild_file1, 30,
- base::Bind(&AssertFileErrorEq, FROM_HERE, base::PLATFORM_FILE_OK));
+ base::Bind(&AssertFileErrorEq, FROM_HERE, base::File::FILE_OK));
operation_runner()->Truncate(
grandchild_file2, 2,
- base::Bind(&AssertFileErrorEq, FROM_HERE, base::PLATFORM_FILE_OK));
+ base::Bind(&AssertFileErrorEq, FROM_HERE, base::File::FILE_OK));
base::RunLoop().RunUntilIdle();
const int64 all_file_size = 5000 + 400 + 30 + 2;
@@ -1202,7 +1202,7 @@
operation_runner()->Move(
src, dest, FileSystemOperation::OPTION_NONE,
- base::Bind(&AssertFileErrorEq, FROM_HERE, base::PLATFORM_FILE_OK));
+ base::Bind(&AssertFileErrorEq, FROM_HERE, base::File::FILE_OK));
base::RunLoop().RunUntilIdle();
EXPECT_FALSE(DirectoryExists("src/dir"));
@@ -1237,16 +1237,16 @@
operation_runner()->Truncate(
child_file1, 8000,
- base::Bind(&AssertFileErrorEq, FROM_HERE, base::PLATFORM_FILE_OK));
+ base::Bind(&AssertFileErrorEq, FROM_HERE, base::File::FILE_OK));
operation_runner()->Truncate(
child_file2, 700,
- base::Bind(&AssertFileErrorEq, FROM_HERE, base::PLATFORM_FILE_OK));
+ base::Bind(&AssertFileErrorEq, FROM_HERE, base::File::FILE_OK));
operation_runner()->Truncate(
grandchild_file1, 60,
- base::Bind(&AssertFileErrorEq, FROM_HERE, base::PLATFORM_FILE_OK));
+ base::Bind(&AssertFileErrorEq, FROM_HERE, base::File::FILE_OK));
operation_runner()->Truncate(
grandchild_file2, 5,
- base::Bind(&AssertFileErrorEq, FROM_HERE, base::PLATFORM_FILE_OK));
+ base::Bind(&AssertFileErrorEq, FROM_HERE, base::File::FILE_OK));
base::RunLoop().RunUntilIdle();
const int64 child_file_size = 8000 + 700;
@@ -1262,7 +1262,7 @@
operation_runner()->Copy(
src, dest1, FileSystemOperation::OPTION_NONE,
FileSystemOperationRunner::CopyProgressCallback(),
- base::Bind(&AssertFileErrorEq, FROM_HERE, base::PLATFORM_FILE_OK));
+ base::Bind(&AssertFileErrorEq, FROM_HERE, base::File::FILE_OK));
base::RunLoop().RunUntilIdle();
expected_usage += all_file_size + child_path_cost + grandchild_path_cost;
@@ -1278,7 +1278,7 @@
operation_runner()->Copy(
child_dir, dest2, FileSystemOperation::OPTION_NONE,
FileSystemOperationRunner::CopyProgressCallback(),
- base::Bind(&AssertFileErrorEq, FROM_HERE, base::PLATFORM_FILE_OK));
+ base::Bind(&AssertFileErrorEq, FROM_HERE, base::File::FILE_OK));
base::RunLoop().RunUntilIdle();
expected_usage += grandchild_file_size + grandchild_path_cost;
diff --git a/content/browser/fileapi/file_system_operation_impl_write_unittest.cc b/content/browser/fileapi/file_system_operation_impl_write_unittest.cc
index e0b9454..2ee7021 100644
--- a/content/browser/fileapi/file_system_operation_impl_write_unittest.cc
+++ b/content/browser/fileapi/file_system_operation_impl_write_unittest.cc
@@ -43,8 +43,8 @@
const GURL kOrigin("http://example.com");
const fileapi::FileSystemType kFileSystemType = fileapi::kFileSystemTypeTest;
-void AssertStatusEq(base::PlatformFileError expected,
- base::PlatformFileError actual) {
+void AssertStatusEq(base::File::Error expected,
+ base::File::Error actual) {
ASSERT_EQ(expected, actual);
}
@@ -54,8 +54,8 @@
: public testing::Test {
public:
FileSystemOperationImplWriteTest()
- : status_(base::PLATFORM_FILE_OK),
- cancel_status_(base::PLATFORM_FILE_ERROR_FAILED),
+ : status_(base::File::FILE_OK),
+ cancel_status_(base::File::FILE_ERROR_FAILED),
bytes_written_(0),
complete_(false),
weak_factory_(this) {
@@ -81,7 +81,7 @@
file_system_context_->operation_runner()->CreateFile(
URLForPath(virtual_path_), true /* exclusive */,
- base::Bind(&AssertStatusEq, base::PLATFORM_FILE_OK));
+ base::Bind(&AssertStatusEq, base::File::FILE_OK));
static_cast<TestFileSystemBackend*>(
file_system_context_->GetFileSystemBackend(kFileSystemType))
@@ -94,8 +94,8 @@
base::RunLoop().RunUntilIdle();
}
- base::PlatformFileError status() const { return status_; }
- base::PlatformFileError cancel_status() const { return cancel_status_; }
+ base::File::Error status() const { return status_; }
+ base::File::Error cancel_status() const { return cancel_status_; }
void add_bytes_written(int64 bytes, bool complete) {
bytes_written_ += bytes;
EXPECT_FALSE(complete_);
@@ -129,14 +129,14 @@
weak_factory_.GetWeakPtr());
}
- void DidWrite(base::PlatformFileError status, int64 bytes, bool complete) {
- if (status == base::PLATFORM_FILE_OK) {
+ void DidWrite(base::File::Error status, int64 bytes, bool complete) {
+ if (status == base::File::FILE_OK) {
add_bytes_written(bytes, complete);
if (complete)
base::MessageLoop::current()->Quit();
} else {
EXPECT_FALSE(complete_);
- EXPECT_EQ(status_, base::PLATFORM_FILE_OK);
+ EXPECT_EQ(status_, base::File::FILE_OK);
complete_ = true;
status_ = status;
if (base::MessageLoop::current()->is_running())
@@ -144,7 +144,7 @@
}
}
- void DidCancel(base::PlatformFileError status) {
+ void DidCancel(base::File::Error status) {
cancel_status_ = status;
}
@@ -161,8 +161,8 @@
base::FilePath virtual_path_;
// For post-operation status.
- base::PlatformFileError status_;
- base::PlatformFileError cancel_status_;
+ base::File::Error status_;
+ base::File::Error cancel_status_;
int64 bytes_written_;
bool complete_;
@@ -187,7 +187,7 @@
base::MessageLoop::current()->Run();
EXPECT_EQ(14, bytes_written());
- EXPECT_EQ(base::PLATFORM_FILE_OK, status());
+ EXPECT_EQ(base::File::FILE_OK, status());
EXPECT_TRUE(complete());
EXPECT_EQ(1, change_observer()->get_and_reset_modify_file_count());
@@ -201,7 +201,7 @@
base::MessageLoop::current()->Run();
EXPECT_EQ(0, bytes_written());
- EXPECT_EQ(base::PLATFORM_FILE_OK, status());
+ EXPECT_EQ(base::File::FILE_OK, status());
EXPECT_TRUE(complete());
EXPECT_EQ(1, change_observer()->get_and_reset_modify_file_count());
@@ -216,7 +216,7 @@
base::MessageLoop::current()->Run();
EXPECT_EQ(0, bytes_written());
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_FAILED, status());
+ EXPECT_EQ(base::File::FILE_ERROR_FAILED, status());
EXPECT_TRUE(complete());
EXPECT_EQ(0, change_observer()->get_and_reset_modify_file_count());
@@ -232,7 +232,7 @@
base::MessageLoop::current()->Run();
EXPECT_EQ(0, bytes_written());
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, status());
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND, status());
EXPECT_TRUE(complete());
EXPECT_EQ(1, change_observer()->get_and_reset_modify_file_count());
@@ -243,7 +243,7 @@
file_system_context_->operation_runner()->CreateDirectory(
URLForPath(virtual_dir_path),
true /* exclusive */, false /* recursive */,
- base::Bind(&AssertStatusEq, base::PLATFORM_FILE_OK));
+ base::Bind(&AssertStatusEq, base::File::FILE_OK));
ScopedTextBlob blob(url_request_context(), "blob:writedir",
"It\'ll not be written, too.");
@@ -254,10 +254,10 @@
EXPECT_EQ(0, bytes_written());
// TODO(kinuko): This error code is platform- or fileutil- dependent
- // right now. Make it return PLATFORM_FILE_ERROR_NOT_A_FILE in every case.
- EXPECT_TRUE(status() == base::PLATFORM_FILE_ERROR_NOT_A_FILE ||
- status() == base::PLATFORM_FILE_ERROR_ACCESS_DENIED ||
- status() == base::PLATFORM_FILE_ERROR_FAILED);
+ // right now. Make it return File::FILE_ERROR_NOT_A_FILE in every case.
+ EXPECT_TRUE(status() == base::File::FILE_ERROR_NOT_A_FILE ||
+ status() == base::File::FILE_ERROR_ACCESS_DENIED ||
+ status() == base::File::FILE_ERROR_FAILED);
EXPECT_TRUE(complete());
EXPECT_EQ(1, change_observer()->get_and_reset_modify_file_count());
@@ -274,7 +274,7 @@
base::MessageLoop::current()->Run();
EXPECT_EQ(10, bytes_written());
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NO_SPACE, status());
+ EXPECT_EQ(base::File::FILE_ERROR_NO_SPACE, status());
EXPECT_TRUE(complete());
EXPECT_EQ(1, change_observer()->get_and_reset_modify_file_count());
@@ -296,8 +296,8 @@
// Issued Cancel() before receiving any response from Write(),
// so nothing should have happen.
EXPECT_EQ(0, bytes_written());
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_ABORT, status());
- EXPECT_EQ(base::PLATFORM_FILE_OK, cancel_status());
+ EXPECT_EQ(base::File::FILE_ERROR_ABORT, status());
+ EXPECT_EQ(base::File::FILE_OK, cancel_status());
EXPECT_TRUE(complete());
EXPECT_EQ(0, change_observer()->get_and_reset_modify_file_count());
@@ -320,8 +320,8 @@
// Issued Cancel() before receiving any response from Write(),
// so nothing should have happen.
EXPECT_EQ(0, bytes_written());
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_ABORT, status());
- EXPECT_EQ(base::PLATFORM_FILE_OK, cancel_status());
+ EXPECT_EQ(base::File::FILE_ERROR_ABORT, status());
+ EXPECT_EQ(base::File::FILE_OK, cancel_status());
EXPECT_TRUE(complete());
EXPECT_EQ(0, change_observer()->get_and_reset_modify_file_count());
diff --git a/content/browser/fileapi/file_system_operation_runner_unittest.cc b/content/browser/fileapi/file_system_operation_runner_unittest.cc
index e2c4b48..571ddd1 100644
--- a/content/browser/fileapi/file_system_operation_runner_unittest.cc
+++ b/content/browser/fileapi/file_system_operation_runner_unittest.cc
@@ -20,8 +20,8 @@
namespace content {
void GetStatus(bool* done,
- base::PlatformFileError *status_out,
- base::PlatformFileError status) {
+ base::File::Error *status_out,
+ base::File::Error status) {
ASSERT_FALSE(*done);
*done = true;
*status_out = status;
@@ -29,8 +29,8 @@
void GetCancelStatus(bool* operation_done,
bool* cancel_done,
- base::PlatformFileError *status_out,
- base::PlatformFileError status) {
+ base::File::Error *status_out,
+ base::File::Error status) {
// Cancel callback must be always called after the operation's callback.
ASSERT_TRUE(*operation_done);
ASSERT_FALSE(*cancel_done);
@@ -75,7 +75,7 @@
TEST_F(FileSystemOperationRunnerTest, NotFoundError) {
bool done = false;
- base::PlatformFileError status = base::PLATFORM_FILE_ERROR_FAILED;
+ base::File::Error status = base::File::FILE_ERROR_FAILED;
// Regular NOT_FOUND error, which is called asynchronously.
operation_runner()->Truncate(URL("foo"), 0,
@@ -83,12 +83,12 @@
ASSERT_FALSE(done);
base::RunLoop().RunUntilIdle();
ASSERT_TRUE(done);
- ASSERT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, status);
+ ASSERT_EQ(base::File::FILE_ERROR_NOT_FOUND, status);
}
TEST_F(FileSystemOperationRunnerTest, InvalidURLError) {
bool done = false;
- base::PlatformFileError status = base::PLATFORM_FILE_ERROR_FAILED;
+ base::File::Error status = base::File::FILE_ERROR_FAILED;
// Invalid URL error, which calls DidFinish synchronously.
operation_runner()->Truncate(FileSystemURL(), 0,
@@ -98,14 +98,14 @@
base::RunLoop().RunUntilIdle();
ASSERT_TRUE(done);
- ASSERT_EQ(base::PLATFORM_FILE_ERROR_INVALID_URL, status);
+ ASSERT_EQ(base::File::FILE_ERROR_INVALID_URL, status);
}
TEST_F(FileSystemOperationRunnerTest, NotFoundErrorAndCancel) {
bool done = false;
bool cancel_done = false;
- base::PlatformFileError status = base::PLATFORM_FILE_ERROR_FAILED;
- base::PlatformFileError cancel_status = base::PLATFORM_FILE_ERROR_FAILED;
+ base::File::Error status = base::File::FILE_ERROR_FAILED;
+ base::File::Error cancel_status = base::File::FILE_ERROR_FAILED;
// Call Truncate with non-existent URL, and try to cancel it immediately
// after that (before its callback is fired).
@@ -122,15 +122,15 @@
ASSERT_TRUE(done);
ASSERT_TRUE(cancel_done);
- ASSERT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, status);
- ASSERT_EQ(base::PLATFORM_FILE_ERROR_INVALID_OPERATION, cancel_status);
+ ASSERT_EQ(base::File::FILE_ERROR_NOT_FOUND, status);
+ ASSERT_EQ(base::File::FILE_ERROR_INVALID_OPERATION, cancel_status);
}
TEST_F(FileSystemOperationRunnerTest, InvalidURLErrorAndCancel) {
bool done = false;
bool cancel_done = false;
- base::PlatformFileError status = base::PLATFORM_FILE_ERROR_FAILED;
- base::PlatformFileError cancel_status = base::PLATFORM_FILE_ERROR_FAILED;
+ base::File::Error status = base::File::FILE_ERROR_FAILED;
+ base::File::Error cancel_status = base::File::FILE_ERROR_FAILED;
// Call Truncate with invalid URL, and try to cancel it immediately
// after that (before its callback is fired).
@@ -147,21 +147,21 @@
ASSERT_TRUE(done);
ASSERT_TRUE(cancel_done);
- ASSERT_EQ(base::PLATFORM_FILE_ERROR_INVALID_URL, status);
- ASSERT_EQ(base::PLATFORM_FILE_ERROR_INVALID_OPERATION, cancel_status);
+ ASSERT_EQ(base::File::FILE_ERROR_INVALID_URL, status);
+ ASSERT_EQ(base::File::FILE_ERROR_INVALID_OPERATION, cancel_status);
}
TEST_F(FileSystemOperationRunnerTest, CancelWithInvalidId) {
const FileSystemOperationRunner::OperationID kInvalidId = -1;
bool done = true; // The operation is not running.
bool cancel_done = false;
- base::PlatformFileError cancel_status = base::PLATFORM_FILE_ERROR_FAILED;
+ base::File::Error cancel_status = base::File::FILE_ERROR_FAILED;
operation_runner()->Cancel(kInvalidId, base::Bind(&GetCancelStatus,
&done, &cancel_done,
&cancel_status));
ASSERT_TRUE(cancel_done);
- ASSERT_EQ(base::PLATFORM_FILE_ERROR_INVALID_OPERATION, cancel_status);
+ ASSERT_EQ(base::File::FILE_ERROR_INVALID_OPERATION, cancel_status);
}
} // namespace content
diff --git a/content/browser/fileapi/file_system_quota_client_unittest.cc b/content/browser/fileapi/file_system_quota_client_unittest.cc
index 20e2b5f0..e0ec282 100644
--- a/content/browser/fileapi/file_system_quota_client_unittest.cc
+++ b/content/browser/fileapi/file_system_quota_client_unittest.cc
@@ -126,9 +126,9 @@
FileSystemURL url = file_system_context_->CreateCrackedFileSystemURL(
GURL(origin_url), type, file_path);
- base::PlatformFileError result =
+ base::File::Error result =
AsyncFileTestHelper::CreateDirectory(file_system_context_, url);
- return result == base::PLATFORM_FILE_OK;
+ return result == base::File::FILE_OK;
}
bool CreateFileSystemFile(const base::FilePath& file_path,
@@ -143,14 +143,14 @@
FileSystemURL url = file_system_context_->CreateCrackedFileSystemURL(
GURL(origin_url), type, file_path);
- base::PlatformFileError result =
+ base::File::Error result =
AsyncFileTestHelper::CreateFile(file_system_context_, url);
- if (result != base::PLATFORM_FILE_OK)
+ if (result != base::File::FILE_OK)
return false;
result = AsyncFileTestHelper::TruncateFile(
file_system_context_, url, file_size);
- return result == base::PLATFORM_FILE_OK;
+ return result == base::File::FILE_OK;
}
void InitializeOriginFiles(FileSystemQuotaClient* quota_client,
diff --git a/content/browser/fileapi/file_system_url_request_job_unittest.cc b/content/browser/fileapi/file_system_url_request_job_unittest.cc
index e4fbc15..6fd36b7 100644
--- a/content/browser/fileapi/file_system_url_request_job_unittest.cc
+++ b/content/browser/fileapi/file_system_url_request_job_unittest.cc
@@ -92,8 +92,8 @@
void OnOpenFileSystem(const GURL& root_url,
const std::string& name,
- base::PlatformFileError result) {
- ASSERT_EQ(base::PLATFORM_FILE_OK, result);
+ base::File::Error result) {
+ ASSERT_EQ(base::File::FILE_OK, result);
}
void TestRequestHelper(const GURL& url,
@@ -142,7 +142,7 @@
GURL("http://remote"),
fileapi::kFileSystemTypeTemporary,
base::FilePath().AppendASCII(dir_name));
- ASSERT_EQ(base::PLATFORM_FILE_OK, AsyncFileTestHelper::CreateDirectory(
+ ASSERT_EQ(base::File::FILE_OK, AsyncFileTestHelper::CreateDirectory(
file_system_context_, url));
}
@@ -152,7 +152,7 @@
GURL("http://remote"),
fileapi::kFileSystemTypeTemporary,
base::FilePath().AppendASCII(file_name));
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
AsyncFileTestHelper::CreateFileWithData(
file_system_context_, url, buf, buf_size));
}
diff --git a/content/browser/fileapi/file_writer_delegate_unittest.cc b/content/browser/fileapi/file_writer_delegate_unittest.cc
index 08e720f..2a02f8f 100644
--- a/content/browser/fileapi/file_writer_delegate_unittest.cc
+++ b/content/browser/fileapi/file_writer_delegate_unittest.cc
@@ -43,25 +43,25 @@
class Result {
public:
Result()
- : status_(base::PLATFORM_FILE_OK),
+ : status_(base::File::FILE_OK),
bytes_written_(0),
write_status_(FileWriterDelegate::SUCCESS_IO_PENDING) {}
- base::PlatformFileError status() const { return status_; }
+ base::File::Error status() const { return status_; }
int64 bytes_written() const { return bytes_written_; }
FileWriterDelegate::WriteProgressStatus write_status() const {
return write_status_;
}
- void DidWrite(base::PlatformFileError status, int64 bytes,
+ void DidWrite(base::File::Error status, int64 bytes,
FileWriterDelegate::WriteProgressStatus write_status) {
write_status_ = write_status;
- if (status == base::PLATFORM_FILE_OK) {
+ if (status == base::File::FILE_OK) {
bytes_written_ += bytes;
if (write_status_ != FileWriterDelegate::SUCCESS_IO_PENDING)
base::MessageLoop::current()->Quit();
} else {
- EXPECT_EQ(base::PLATFORM_FILE_OK, status_);
+ EXPECT_EQ(base::File::FILE_OK, status_);
status_ = status;
base::MessageLoop::current()->Quit();
}
@@ -69,7 +69,7 @@
private:
// For post-operation status.
- base::PlatformFileError status_;
+ base::File::Error status_;
int64 bytes_written_;
FileWriterDelegate::WriteProgressStatus write_status_;
};
@@ -97,8 +97,8 @@
base::RunLoop().RunUntilIdle();
FileSystemURL url = GetFileSystemURL(test_file_path);
- base::PlatformFileInfo file_info;
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ base::File::Info file_info;
+ EXPECT_EQ(base::File::FILE_OK,
AsyncFileTestHelper::GetMetadata(
file_system_context_, url, &file_info));
return file_info.size;
@@ -223,7 +223,7 @@
file_system_context_ = CreateFileSystemContextForTesting(
NULL, dir_.path());
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
AsyncFileTestHelper::CreateFile(
file_system_context_, GetFileSystemURL("test")));
net::URLRequest::Deprecated::RegisterProtocolFactory("blob", &Factory);
@@ -252,7 +252,7 @@
ASSERT_EQ(kDataSize, usage());
EXPECT_EQ(GetFileSizeOnDisk("test"), usage());
EXPECT_EQ(kDataSize, result.bytes_written());
- EXPECT_EQ(base::PLATFORM_FILE_OK, result.status());
+ EXPECT_EQ(base::File::FILE_OK, result.status());
}
TEST_F(FileWriterDelegateTest, WriteSuccessWithJustQuota) {
@@ -272,7 +272,7 @@
EXPECT_EQ(GetFileSizeOnDisk("test"), usage());
EXPECT_EQ(kAllowedGrowth, result.bytes_written());
- EXPECT_EQ(base::PLATFORM_FILE_OK, result.status());
+ EXPECT_EQ(base::File::FILE_OK, result.status());
}
TEST_F(FileWriterDelegateTest, DISABLED_WriteFailureByQuota) {
@@ -292,7 +292,7 @@
EXPECT_EQ(GetFileSizeOnDisk("test"), usage());
EXPECT_EQ(kAllowedGrowth, result.bytes_written());
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NO_SPACE, result.status());
+ EXPECT_EQ(base::File::FILE_ERROR_NO_SPACE, result.status());
ASSERT_EQ(FileWriterDelegate::ERROR_WRITE_STARTED, result.write_status());
}
@@ -313,7 +313,7 @@
EXPECT_EQ(GetFileSizeOnDisk("test"), usage());
EXPECT_EQ(kAllowedGrowth, result.bytes_written());
- EXPECT_EQ(base::PLATFORM_FILE_OK, result.status());
+ EXPECT_EQ(base::File::FILE_OK, result.status());
ASSERT_EQ(FileWriterDelegate::SUCCESS_COMPLETED, result.write_status());
}
@@ -321,7 +321,7 @@
scoped_ptr<FileWriterDelegate> file_writer_delegate2;
scoped_ptr<net::URLRequest> request2;
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
AsyncFileTestHelper::CreateFile(
file_system_context_, GetFileSystemURL("test2")));
@@ -354,9 +354,9 @@
EXPECT_EQ(GetFileSizeOnDisk("test") + GetFileSizeOnDisk("test2"), usage());
EXPECT_EQ(kDataSize, result.bytes_written());
- EXPECT_EQ(base::PLATFORM_FILE_OK, result.status());
+ EXPECT_EQ(base::File::FILE_OK, result.status());
EXPECT_EQ(kDataSize, result2.bytes_written());
- EXPECT_EQ(base::PLATFORM_FILE_OK, result2.status());
+ EXPECT_EQ(base::File::FILE_OK, result2.status());
}
TEST_F(FileWriterDelegateTest, WritesWithQuotaAndOffset) {
@@ -380,7 +380,7 @@
ASSERT_EQ(kDataSize, usage());
EXPECT_EQ(GetFileSizeOnDisk("test"), usage());
EXPECT_EQ(kDataSize, result.bytes_written());
- EXPECT_EQ(base::PLATFORM_FILE_OK, result.status());
+ EXPECT_EQ(base::File::FILE_OK, result.status());
}
// Trying to overwrite kDataSize bytes data while allowed_growth is 20.
@@ -395,7 +395,7 @@
EXPECT_EQ(kDataSize, usage());
EXPECT_EQ(GetFileSizeOnDisk("test"), usage());
EXPECT_EQ(kDataSize, result.bytes_written());
- EXPECT_EQ(base::PLATFORM_FILE_OK, result.status());
+ EXPECT_EQ(base::File::FILE_OK, result.status());
ASSERT_EQ(FileWriterDelegate::SUCCESS_COMPLETED, result.write_status());
}
@@ -415,7 +415,7 @@
EXPECT_EQ(offset + kDataSize, usage());
EXPECT_EQ(GetFileSizeOnDisk("test"), usage());
EXPECT_EQ(kDataSize, result.bytes_written());
- EXPECT_EQ(base::PLATFORM_FILE_OK, result.status());
+ EXPECT_EQ(base::File::FILE_OK, result.status());
}
// Trying to overwrite 45 bytes data while allowed_growth is -20.
@@ -434,7 +434,7 @@
EXPECT_EQ(pre_write_usage, usage());
EXPECT_EQ(GetFileSizeOnDisk("test"), usage());
EXPECT_EQ(kDataSize, result.bytes_written());
- EXPECT_EQ(base::PLATFORM_FILE_OK, result.status());
+ EXPECT_EQ(base::File::FILE_OK, result.status());
}
// Trying to overwrite 45 bytes data with offset pre_write_usage - 20,
@@ -454,7 +454,7 @@
EXPECT_EQ(pre_write_usage + allowed_growth, usage());
EXPECT_EQ(GetFileSizeOnDisk("test"), usage());
EXPECT_EQ(kOverlap + allowed_growth, result.bytes_written());
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NO_SPACE, result.status());
+ EXPECT_EQ(base::File::FILE_ERROR_NO_SPACE, result.status());
}
}
diff --git a/content/browser/fileapi/fileapi_message_filter.cc b/content/browser/fileapi/fileapi_message_filter.cc
index 11b47942..5d0c27f 100644
--- a/content/browser/fileapi/fileapi_message_filter.cc
+++ b/content/browser/fileapi/fileapi_message_filter.cc
@@ -220,7 +220,7 @@
return;
if (!security_policy_->CanReadFileSystemFile(process_id_, url)) {
Send(new FileSystemMsg_DidFail(request_id,
- base::PLATFORM_FILE_ERROR_SECURITY));
+ base::File::FILE_ERROR_SECURITY));
return;
}
@@ -250,7 +250,7 @@
!security_policy_->CanDeleteFileSystemFile(process_id_, src_url) ||
!security_policy_->CanCreateFileSystemFile(process_id_, dest_url)) {
Send(new FileSystemMsg_DidFail(request_id,
- base::PLATFORM_FILE_ERROR_SECURITY));
+ base::File::FILE_ERROR_SECURITY));
return;
}
@@ -272,7 +272,7 @@
if (!security_policy_->CanReadFileSystemFile(process_id_, src_url) ||
!security_policy_->CanCopyIntoFileSystemFile(process_id_, dest_url)) {
Send(new FileSystemMsg_DidFail(request_id,
- base::PLATFORM_FILE_ERROR_SECURITY));
+ base::File::FILE_ERROR_SECURITY));
return;
}
@@ -291,7 +291,7 @@
return;
if (!security_policy_->CanDeleteFileSystemFile(process_id_, url)) {
Send(new FileSystemMsg_DidFail(request_id,
- base::PLATFORM_FILE_ERROR_SECURITY));
+ base::File::FILE_ERROR_SECURITY));
return;
}
@@ -308,7 +308,7 @@
return;
if (!security_policy_->CanReadFileSystemFile(process_id_, url)) {
Send(new FileSystemMsg_DidFail(request_id,
- base::PLATFORM_FILE_ERROR_SECURITY));
+ base::File::FILE_ERROR_SECURITY));
return;
}
@@ -325,7 +325,7 @@
return;
if (!security_policy_->CanCreateFileSystemFile(process_id_, url)) {
Send(new FileSystemMsg_DidFail(request_id,
- base::PLATFORM_FILE_ERROR_SECURITY));
+ base::File::FILE_ERROR_SECURITY));
return;
}
@@ -348,7 +348,7 @@
return;
if (!security_policy_->CanReadFileSystemFile(process_id_, url)) {
Send(new FileSystemMsg_DidFail(request_id,
- base::PLATFORM_FILE_ERROR_SECURITY));
+ base::File::FILE_ERROR_SECURITY));
return;
}
@@ -371,7 +371,7 @@
return;
if (!security_policy_->CanReadFileSystemFile(process_id_, url)) {
Send(new FileSystemMsg_DidFail(request_id,
- base::PLATFORM_FILE_ERROR_SECURITY));
+ base::File::FILE_ERROR_SECURITY));
return;
}
@@ -397,7 +397,7 @@
return;
if (!security_policy_->CanWriteFileSystemFile(process_id_, url)) {
Send(new FileSystemMsg_DidFail(request_id,
- base::PLATFORM_FILE_ERROR_SECURITY));
+ base::File::FILE_ERROR_SECURITY));
return;
}
@@ -418,7 +418,7 @@
return;
if (!security_policy_->CanWriteFileSystemFile(process_id_, url)) {
Send(new FileSystemMsg_DidFail(request_id,
- base::PLATFORM_FILE_ERROR_SECURITY));
+ base::File::FILE_ERROR_SECURITY));
return;
}
@@ -438,7 +438,7 @@
return;
if (!security_policy_->CanCreateFileSystemFile(process_id_, url)) {
Send(new FileSystemMsg_DidFail(request_id,
- base::PLATFORM_FILE_ERROR_SECURITY));
+ base::File::FILE_ERROR_SECURITY));
return;
}
@@ -462,7 +462,7 @@
} else {
// The write already finished; report that we failed to stop it.
Send(new FileSystemMsg_DidFail(
- request_id, base::PLATFORM_FILE_ERROR_INVALID_OPERATION));
+ request_id, base::File::FILE_ERROR_INVALID_OPERATION));
}
}
@@ -483,7 +483,7 @@
return;
if (!security_policy_->CanReadFileSystemFile(process_id_, url)) {
Send(new FileSystemMsg_DidFail(request_id,
- base::PLATFORM_FILE_ERROR_SECURITY));
+ base::File::FILE_ERROR_SECURITY));
return;
}
@@ -676,8 +676,8 @@
}
void FileAPIMessageFilter::DidFinish(int request_id,
- base::PlatformFileError result) {
- if (result == base::PLATFORM_FILE_OK)
+ base::File::Error result) {
+ if (result == base::File::FILE_OK)
Send(new FileSystemMsg_DidSucceed(request_id));
else
Send(new FileSystemMsg_DidFail(request_id, result));
@@ -686,9 +686,9 @@
void FileAPIMessageFilter::DidGetMetadata(
int request_id,
- base::PlatformFileError result,
- const base::PlatformFileInfo& info) {
- if (result == base::PLATFORM_FILE_OK)
+ base::File::Error result,
+ const base::File::Info& info) {
+ if (result == base::File::FILE_OK)
Send(new FileSystemMsg_DidReadMetadata(request_id, info));
else
Send(new FileSystemMsg_DidFail(request_id, result));
@@ -697,10 +697,10 @@
void FileAPIMessageFilter::DidReadDirectory(
int request_id,
- base::PlatformFileError result,
+ base::File::Error result,
const std::vector<fileapi::DirectoryEntry>& entries,
bool has_more) {
- if (result == base::PLATFORM_FILE_OK)
+ if (result == base::File::FILE_OK)
Send(new FileSystemMsg_DidReadDirectory(request_id, entries, has_more));
else
Send(new FileSystemMsg_DidFail(request_id, result));
@@ -708,10 +708,10 @@
}
void FileAPIMessageFilter::DidWrite(int request_id,
- base::PlatformFileError result,
+ base::File::Error result,
int64 bytes,
bool complete) {
- if (result == base::PLATFORM_FILE_OK) {
+ if (result == base::File::FILE_OK) {
Send(new FileSystemMsg_DidWrite(request_id, bytes, complete));
if (complete)
operations_.erase(request_id);
@@ -724,9 +724,9 @@
void FileAPIMessageFilter::DidOpenFileSystem(int request_id,
const GURL& root,
const std::string& filesystem_name,
- base::PlatformFileError result) {
+ base::File::Error result) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- if (result == base::PLATFORM_FILE_OK) {
+ if (result == base::File::FILE_OK) {
DCHECK(root.is_valid());
Send(new FileSystemMsg_DidOpenFileSystem(
request_id, filesystem_name, root));
@@ -737,12 +737,12 @@
}
void FileAPIMessageFilter::DidResolveURL(int request_id,
- base::PlatformFileError result,
+ base::File::Error result,
const fileapi::FileSystemInfo& info,
const base::FilePath& file_path,
bool is_directory) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- if (result == base::PLATFORM_FILE_OK) {
+ if (result == base::File::FILE_OK) {
DCHECK(info.root_url.is_valid());
Send(new FileSystemMsg_DidResolveURL(
request_id, info, file_path, is_directory));
@@ -754,8 +754,8 @@
void FileAPIMessageFilter::DidDeleteFileSystem(
int request_id,
- base::PlatformFileError result) {
- if (result == base::PLATFORM_FILE_OK)
+ base::File::Error result) {
+ if (result == base::File::FILE_OK)
Send(new FileSystemMsg_DidSucceed(request_id));
else
Send(new FileSystemMsg_DidFail(request_id, result));
@@ -766,14 +766,14 @@
void FileAPIMessageFilter::DidCreateSnapshot(
int request_id,
const fileapi::FileSystemURL& url,
- base::PlatformFileError result,
- const base::PlatformFileInfo& info,
+ base::File::Error result,
+ const base::File::Info& info,
const base::FilePath& platform_path,
const scoped_refptr<webkit_blob::ShareableFileReference>& /* unused */) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
operations_.erase(request_id);
- if (result != base::PLATFORM_FILE_OK) {
+ if (result != base::File::FILE_OK) {
Send(new FileSystemMsg_DidFail(request_id, result));
return;
}
@@ -826,7 +826,7 @@
int request_id, const fileapi::FileSystemURL& url) {
if (!FileSystemURLIsValid(context_, url)) {
Send(new FileSystemMsg_DidFail(request_id,
- base::PLATFORM_FILE_ERROR_INVALID_URL));
+ base::File::FILE_ERROR_INVALID_URL));
return false;
}
@@ -835,7 +835,7 @@
// validation.
if (url.type() == fileapi::kFileSystemTypePluginPrivate) {
Send(new FileSystemMsg_DidFail(request_id,
- base::PLATFORM_FILE_ERROR_SECURITY));
+ base::File::FILE_ERROR_SECURITY));
return false;
}
diff --git a/content/browser/fileapi/fileapi_message_filter.h b/content/browser/fileapi/fileapi_message_filter.h
index ee4c8d6..276382d 100644
--- a/content/browser/fileapi/fileapi_message_filter.h
+++ b/content/browser/fileapi/fileapi_message_filter.h
@@ -161,34 +161,34 @@
void OnRemoveStream(const GURL& url);
// Callback functions to be used when each file operation is finished.
- void DidFinish(int request_id, base::PlatformFileError result);
+ void DidFinish(int request_id, base::File::Error result);
void DidGetMetadata(int request_id,
- base::PlatformFileError result,
- const base::PlatformFileInfo& info);
+ base::File::Error result,
+ const base::File::Info& info);
void DidReadDirectory(int request_id,
- base::PlatformFileError result,
+ base::File::Error result,
const std::vector<fileapi::DirectoryEntry>& entries,
bool has_more);
void DidWrite(int request_id,
- base::PlatformFileError result,
+ base::File::Error result,
int64 bytes,
bool complete);
void DidOpenFileSystem(int request_id,
const GURL& root,
const std::string& filesystem_name,
- base::PlatformFileError result);
+ base::File::Error result);
void DidResolveURL(int request_id,
- base::PlatformFileError result,
+ base::File::Error result,
const fileapi::FileSystemInfo& info,
const base::FilePath& file_path,
bool is_directory);
void DidDeleteFileSystem(int request_id,
- base::PlatformFileError result);
+ base::File::Error result);
void DidCreateSnapshot(
int request_id,
const fileapi::FileSystemURL& url,
- base::PlatformFileError result,
- const base::PlatformFileInfo& info,
+ base::File::Error result,
+ const base::File::Info& info,
const base::FilePath& platform_path,
const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref);
diff --git a/content/browser/fileapi/local_file_util_unittest.cc b/content/browser/fileapi/local_file_util_unittest.cc
index dfde5a5..657ebab 100644
--- a/content/browser/fileapi/local_file_util_unittest.cc
+++ b/content/browser/fileapi/local_file_util_unittest.cc
@@ -5,6 +5,7 @@
#include <string>
#include "base/file_util.h"
+#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/files/scoped_temp_dir.h"
#include "base/message_loop/message_loop_proxy.h"
@@ -97,9 +98,9 @@
return info.size;
}
- base::PlatformFileError CreateFile(const char* file_name,
- base::PlatformFile* file_handle,
- bool* created) {
+ base::File::Error CreateFile(const char* file_name,
+ base::PlatformFile* file_handle,
+ bool* created) {
int file_flags = base::PLATFORM_FILE_CREATE |
base::PLATFORM_FILE_WRITE | base::PLATFORM_FILE_ASYNC;
@@ -110,7 +111,7 @@
file_flags, file_handle, created);
}
- base::PlatformFileError EnsureFileExists(const char* file_name,
+ base::File::Error EnsureFileExists(const char* file_name,
bool* created) {
scoped_ptr<FileSystemOperationContext> context(NewContext());
return file_util()->EnsureFileExists(
@@ -134,7 +135,7 @@
const char *file_name = "test_file";
base::PlatformFile file_handle;
bool created;
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
CreateFile(file_name, &file_handle, &created));
ASSERT_TRUE(created);
@@ -142,8 +143,8 @@
EXPECT_EQ(0, GetSize(file_name));
scoped_ptr<FileSystemOperationContext> context(NewContext());
- EXPECT_EQ(base::PLATFORM_FILE_OK,
- file_util()->Close(context.get(), file_handle));
+ EXPECT_EQ(base::File::FILE_OK,
+ file_util()->Close(context.get(), file_handle));
}
// base::CreateSymbolicLink is only supported on POSIX.
@@ -153,7 +154,7 @@
const char *target_name = "symlink_target";
base::PlatformFile target_handle;
bool symlink_target_created = false;
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
CreateFile(target_name, &target_handle, &symlink_target_created));
ASSERT_TRUE(symlink_target_created);
base::FilePath target_path = LocalPath(target_name);
@@ -170,8 +171,9 @@
int file_flags = base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ;
base::PlatformFile file_handle;
bool created = false;
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, file_util()->CreateOrOpen(
- context.get(), url, file_flags, &file_handle, &created));
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND,
+ file_util()->CreateOrOpen(context.get(), url, file_flags,
+ &file_handle, &created));
EXPECT_FALSE(created);
}
#endif
@@ -179,13 +181,13 @@
TEST_F(LocalFileUtilTest, EnsureFileExists) {
const char *file_name = "foobar";
bool created;
- ASSERT_EQ(base::PLATFORM_FILE_OK, EnsureFileExists(file_name, &created));
+ ASSERT_EQ(base::File::FILE_OK, EnsureFileExists(file_name, &created));
ASSERT_TRUE(created);
EXPECT_TRUE(FileExists(file_name));
EXPECT_EQ(0, GetSize(file_name));
- ASSERT_EQ(base::PLATFORM_FILE_OK, EnsureFileExists(file_name, &created));
+ ASSERT_EQ(base::File::FILE_OK, EnsureFileExists(file_name, &created));
EXPECT_FALSE(created);
}
@@ -193,7 +195,7 @@
const char *file_name = "test_file";
base::PlatformFile file_handle;
bool created;
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
CreateFile(file_name, &file_handle, &created));
ASSERT_TRUE(created);
@@ -206,7 +208,7 @@
const base::Time new_modified =
info.last_modified + base::TimeDelta::FromHours(5);
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_util()->Touch(context.get(), CreateURL(file_name),
new_accessed, new_modified));
@@ -214,14 +216,14 @@
EXPECT_EQ(new_accessed, info.last_accessed);
EXPECT_EQ(new_modified, info.last_modified);
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_util()->Close(context.get(), file_handle));
}
TEST_F(LocalFileUtilTest, TouchDirectory) {
const char *dir_name = "test_dir";
scoped_ptr<FileSystemOperationContext> context(NewContext());
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
file_util()->CreateDirectory(context.get(),
CreateURL(dir_name),
false /* exclusive */,
@@ -234,7 +236,7 @@
const base::Time new_modified =
info.last_modified + base::TimeDelta::FromHours(5);
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_util()->Touch(context.get(), CreateURL(dir_name),
new_accessed, new_modified));
@@ -246,14 +248,14 @@
TEST_F(LocalFileUtilTest, Truncate) {
const char *file_name = "truncated";
bool created;
- ASSERT_EQ(base::PLATFORM_FILE_OK, EnsureFileExists(file_name, &created));
+ ASSERT_EQ(base::File::FILE_OK, EnsureFileExists(file_name, &created));
ASSERT_TRUE(created);
scoped_ptr<FileSystemOperationContext> context;
context.reset(NewContext());
- ASSERT_EQ(base::PLATFORM_FILE_OK,
- file_util()->Truncate(context.get(), CreateURL(file_name), 1020));
+ ASSERT_EQ(base::File::FILE_OK,
+ file_util()->Truncate(context.get(), CreateURL(file_name), 1020));
EXPECT_TRUE(FileExists(file_name));
EXPECT_EQ(1020, GetSize(file_name));
@@ -264,24 +266,24 @@
const char *to_file1 = "tofile1";
const char *to_file2 = "tofile2";
bool created;
- ASSERT_EQ(base::PLATFORM_FILE_OK, EnsureFileExists(from_file, &created));
+ ASSERT_EQ(base::File::FILE_OK, EnsureFileExists(from_file, &created));
ASSERT_TRUE(created);
scoped_ptr<FileSystemOperationContext> context;
context.reset(NewContext());
- ASSERT_EQ(base::PLATFORM_FILE_OK,
- file_util()->Truncate(context.get(), CreateURL(from_file), 1020));
+ ASSERT_EQ(base::File::FILE_OK,
+ file_util()->Truncate(context.get(), CreateURL(from_file), 1020));
EXPECT_TRUE(FileExists(from_file));
EXPECT_EQ(1020, GetSize(from_file));
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
AsyncFileTestHelper::Copy(file_system_context(),
CreateURL(from_file),
CreateURL(to_file1)));
context.reset(NewContext());
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
AsyncFileTestHelper::Copy(file_system_context(),
CreateURL(from_file),
CreateURL(to_file2)));
@@ -303,15 +305,15 @@
scoped_ptr<FileSystemOperationContext> context;
context.reset(NewContext());
- ASSERT_EQ(base::PLATFORM_FILE_OK,
- file_util()->CreateDirectory(context.get(), CreateURL(from_dir),
- false, false));
- ASSERT_EQ(base::PLATFORM_FILE_OK, EnsureFileExists(from_file, &created));
+ ASSERT_EQ(base::File::FILE_OK,
+ file_util()->CreateDirectory(context.get(), CreateURL(from_dir),
+ false, false));
+ ASSERT_EQ(base::File::FILE_OK, EnsureFileExists(from_file, &created));
ASSERT_TRUE(created);
context.reset(NewContext());
- ASSERT_EQ(base::PLATFORM_FILE_OK,
- file_util()->Truncate(context.get(), CreateURL(from_file), 1020));
+ ASSERT_EQ(base::File::FILE_OK,
+ file_util()->Truncate(context.get(), CreateURL(from_file), 1020));
EXPECT_TRUE(DirectoryExists(from_dir));
EXPECT_TRUE(FileExists(from_file));
@@ -319,7 +321,7 @@
EXPECT_FALSE(DirectoryExists(to_dir));
context.reset(NewContext());
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
AsyncFileTestHelper::Copy(file_system_context(),
CreateURL(from_dir), CreateURL(to_dir)));
@@ -335,19 +337,19 @@
const char *from_file = "fromfile";
const char *to_file = "tofile";
bool created;
- ASSERT_EQ(base::PLATFORM_FILE_OK, EnsureFileExists(from_file, &created));
+ ASSERT_EQ(base::File::FILE_OK, EnsureFileExists(from_file, &created));
ASSERT_TRUE(created);
scoped_ptr<FileSystemOperationContext> context;
context.reset(NewContext());
- ASSERT_EQ(base::PLATFORM_FILE_OK,
- file_util()->Truncate(context.get(), CreateURL(from_file), 1020));
+ ASSERT_EQ(base::File::FILE_OK,
+ file_util()->Truncate(context.get(), CreateURL(from_file), 1020));
EXPECT_TRUE(FileExists(from_file));
EXPECT_EQ(1020, GetSize(from_file));
context.reset(NewContext());
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
AsyncFileTestHelper::Move(file_system_context(),
CreateURL(from_file),
CreateURL(to_file)));
@@ -366,15 +368,15 @@
scoped_ptr<FileSystemOperationContext> context;
context.reset(NewContext());
- ASSERT_EQ(base::PLATFORM_FILE_OK,
- file_util()->CreateDirectory(context.get(), CreateURL(from_dir),
- false, false));
- ASSERT_EQ(base::PLATFORM_FILE_OK, EnsureFileExists(from_file, &created));
+ ASSERT_EQ(base::File::FILE_OK,
+ file_util()->CreateDirectory(context.get(), CreateURL(from_dir),
+ false, false));
+ ASSERT_EQ(base::File::FILE_OK, EnsureFileExists(from_file, &created));
ASSERT_TRUE(created);
context.reset(NewContext());
- ASSERT_EQ(base::PLATFORM_FILE_OK,
- file_util()->Truncate(context.get(), CreateURL(from_file), 1020));
+ ASSERT_EQ(base::File::FILE_OK,
+ file_util()->Truncate(context.get(), CreateURL(from_file), 1020));
EXPECT_TRUE(DirectoryExists(from_dir));
EXPECT_TRUE(FileExists(from_file));
@@ -382,7 +384,7 @@
EXPECT_FALSE(DirectoryExists(to_dir));
context.reset(NewContext());
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
AsyncFileTestHelper::Move(file_system_context(),
CreateURL(from_dir),
CreateURL(to_dir)));
diff --git a/content/browser/fileapi/obfuscated_file_util_unittest.cc b/content/browser/fileapi/obfuscated_file_util_unittest.cc
index 58f99d9..a293bec 100644
--- a/content/browser/fileapi/obfuscated_file_util_unittest.cc
+++ b/content/browser/fileapi/obfuscated_file_util_unittest.cc
@@ -8,6 +8,7 @@
#include "base/bind.h"
#include "base/file_util.h"
+#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/files/scoped_temp_dir.h"
#include "base/memory/scoped_ptr.h"
@@ -293,11 +294,11 @@
bool PathExists(const FileSystemURL& url) {
scoped_ptr<FileSystemOperationContext> context(NewContext(NULL));
- base::PlatformFileInfo file_info;
+ base::File::Info file_info;
base::FilePath platform_path;
- base::PlatformFileError error = ofu()->GetFileInfo(
+ base::File::Error error = ofu()->GetFileInfo(
context.get(), url, &file_info, &platform_path);
- return error == base::PLATFORM_FILE_OK;
+ return error == base::File::FILE_OK;
}
bool DirectoryExists(const FileSystemURL& url) {
@@ -325,13 +326,13 @@
const FileSystemURL& url, base::PlatformFile file_handle) {
scoped_ptr<FileSystemOperationContext> context(NewContext(NULL));
base::FilePath local_path;
- EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->GetLocalFilePath(
- context.get(), url, &local_path));
+ EXPECT_EQ(base::File::FILE_OK,
+ ofu()->GetLocalFilePath(context.get(), url, &local_path));
- base::PlatformFileInfo file_info0;
+ base::File::Info file_info0;
base::FilePath data_path;
- EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->GetFileInfo(
- context.get(), url, &file_info0, &data_path));
+ EXPECT_EQ(base::File::FILE_OK,
+ ofu()->GetFileInfo(context.get(), url, &file_info0, &data_path));
EXPECT_EQ(data_path, local_path);
EXPECT_TRUE(FileExists(data_path));
EXPECT_EQ(0, GetSize(data_path));
@@ -340,25 +341,20 @@
const int length = arraysize(data) - 1;
if (base::kInvalidPlatformFileValue == file_handle) {
- bool created = true;
- base::PlatformFileError error;
- file_handle = base::CreatePlatformFile(
- data_path,
- base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_WRITE,
- &created,
- &error);
- ASSERT_NE(base::kInvalidPlatformFileValue, file_handle);
- ASSERT_EQ(base::PLATFORM_FILE_OK, error);
- EXPECT_FALSE(created);
+ base::File file(data_path,
+ base::File::FLAG_OPEN | base::File::FLAG_WRITE);
+ ASSERT_TRUE(file.IsValid());
+ EXPECT_FALSE(file.created());
+ file_handle = file.TakePlatformFile();
}
ASSERT_EQ(length, base::WritePlatformFile(file_handle, 0, data, length));
EXPECT_TRUE(base::ClosePlatformFile(file_handle));
- base::PlatformFileInfo file_info1;
+ base::File::Info file_info1;
EXPECT_EQ(length, GetSize(data_path));
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->GetFileInfo(
- context.get(), url, &file_info1, &data_path));
+ EXPECT_EQ(base::File::FILE_OK,
+ ofu()->GetFileInfo(context.get(), url, &file_info1, &data_path));
EXPECT_EQ(data_path, local_path);
EXPECT_FALSE(file_info0.is_directory);
@@ -370,13 +366,13 @@
EXPECT_LE(file_info0.last_modified, file_info1.last_modified);
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->Truncate(
- context.get(), url, length * 2));
+ EXPECT_EQ(base::File::FILE_OK,
+ ofu()->Truncate(context.get(), url, length * 2));
EXPECT_EQ(length * 2, GetSize(data_path));
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->Truncate(
- context.get(), url, 0));
+ EXPECT_EQ(base::File::FILE_OK,
+ ofu()->Truncate(context.get(), url, 0));
EXPECT_EQ(0, GetSize(data_path));
}
@@ -389,10 +385,10 @@
for (iter = files.begin(); iter != files.end(); ++iter) {
bool created = true;
context.reset(NewContext(NULL));
- ASSERT_EQ(base::PLATFORM_FILE_OK,
- ofu()->EnsureFileExists(
- context.get(), FileSystemURLAppend(root_url, *iter),
- &created));
+ ASSERT_EQ(base::File::FILE_OK,
+ ofu()->EnsureFileExists(context.get(),
+ FileSystemURLAppend(root_url, *iter),
+ &created));
ASSERT_FALSE(created);
}
for (iter = directories.begin(); iter != directories.end(); ++iter) {
@@ -450,9 +446,9 @@
std::set<base::FilePath::StringType>* directories) {
scoped_ptr<FileSystemOperationContext> context;
std::vector<fileapi::DirectoryEntry> entries;
- EXPECT_EQ(base::PLATFORM_FILE_OK,
- AsyncFileTestHelper::ReadDirectory(
- file_system_context(), root_url, &entries));
+ EXPECT_EQ(base::File::FILE_OK,
+ AsyncFileTestHelper::ReadDirectory(file_system_context(),
+ root_url, &entries));
EXPECT_EQ(0UL, entries.size());
files->clear();
@@ -467,22 +463,20 @@
for (iter = files->begin(); iter != files->end(); ++iter) {
bool created = false;
context.reset(NewContext(NULL));
- ASSERT_EQ(base::PLATFORM_FILE_OK,
- ofu()->EnsureFileExists(
- context.get(),
- FileSystemURLAppend(root_url, *iter),
- &created));
+ ASSERT_EQ(base::File::FILE_OK,
+ ofu()->EnsureFileExists(context.get(),
+ FileSystemURLAppend(root_url, *iter),
+ &created));
ASSERT_TRUE(created);
}
for (iter = directories->begin(); iter != directories->end(); ++iter) {
bool exclusive = true;
bool recursive = false;
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
- ofu()->CreateDirectory(
- context.get(),
- FileSystemURLAppend(root_url, *iter),
- exclusive, recursive));
+ EXPECT_EQ(base::File::FILE_OK,
+ ofu()->CreateDirectory(context.get(),
+ FileSystemURLAppend(root_url, *iter),
+ exclusive, recursive));
}
ValidateTestDirectory(root_url, *files, *directories);
}
@@ -495,7 +489,7 @@
scoped_ptr<FileSystemOperationContext> context;
std::vector<fileapi::DirectoryEntry> entries;
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
AsyncFileTestHelper::ReadDirectory(
file_system_context(), root_url, &entries));
std::vector<fileapi::DirectoryEntry>::iterator entry_iter;
@@ -523,15 +517,15 @@
base::Time last_modified_time = base::Time::Now();
scoped_ptr<FileSystemOperationContext> context(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
- ofu()->Touch(
- context.get(), url, last_access_time, last_modified_time));
+ EXPECT_EQ(base::File::FILE_OK,
+ ofu()->Touch(context.get(), url, last_access_time,
+ last_modified_time));
// Currently we fire no change notifications for Touch.
EXPECT_TRUE(change_observer()->HasNoChange());
base::FilePath local_path;
- base::PlatformFileInfo file_info;
+ base::File::Info file_info;
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->GetFileInfo(
+ EXPECT_EQ(base::File::FILE_OK, ofu()->GetFileInfo(
context.get(), url, &file_info, &local_path));
// We compare as time_t here to lower our resolution, to avoid false
// negatives caused by conversion to the local filesystem's native
@@ -541,13 +535,13 @@
context.reset(NewContext(NULL));
last_modified_time += base::TimeDelta::FromHours(1);
last_access_time += base::TimeDelta::FromHours(14);
- EXPECT_EQ(base::PLATFORM_FILE_OK,
- ofu()->Touch(
- context.get(), url, last_access_time, last_modified_time));
+ EXPECT_EQ(base::File::FILE_OK,
+ ofu()->Touch(context.get(), url, last_access_time,
+ last_modified_time));
EXPECT_TRUE(change_observer()->HasNoChange());
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->GetFileInfo(
- context.get(), url, &file_info, &local_path));
+ EXPECT_EQ(base::File::FILE_OK,
+ ofu()->GetFileInfo(context.get(), url, &file_info, &local_path));
EXPECT_EQ(file_info.last_modified.ToTimeT(), last_modified_time.ToTimeT());
if (is_file) // Directories in OFU don't support atime.
EXPECT_EQ(file_info.last_accessed.ToTimeT(), last_access_time.ToTimeT());
@@ -561,24 +555,20 @@
FileSystemURL dest_url = CreateURLFromUTF8("new file");
int64 src_file_length = 87;
- base::PlatformFileError error_code;
- bool created = false;
- int file_flags = base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_WRITE;
- base::PlatformFile file_handle =
- base::CreatePlatformFile(
- src_file_path, file_flags, &created, &error_code);
- EXPECT_TRUE(created);
- ASSERT_EQ(base::PLATFORM_FILE_OK, error_code);
- ASSERT_NE(base::kInvalidPlatformFileValue, file_handle);
- ASSERT_TRUE(base::TruncatePlatformFile(file_handle, src_file_length));
- EXPECT_TRUE(base::ClosePlatformFile(file_handle));
+ base::File file(src_file_path,
+ base::File::FLAG_CREATE | base::File::FLAG_WRITE);
+ ASSERT_TRUE(file.IsValid());
+ EXPECT_TRUE(file.created());
+ ASSERT_TRUE(file.SetLength(src_file_length));
+ file.Close();
scoped_ptr<FileSystemOperationContext> context;
if (overwrite) {
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
- ofu()->EnsureFileExists(context.get(), dest_url, &created));
+ bool created = false;
+ EXPECT_EQ(base::File::FILE_OK,
+ ofu()->EnsureFileExists(context.get(), dest_url, &created));
EXPECT_TRUE(created);
// We must have observed one (and only one) create_file_count.
@@ -592,14 +582,14 @@
// Verify that file creation requires sufficient quota for the path.
context.reset(NewContext(NULL));
context->set_allowed_bytes_growth(path_cost + src_file_length - 1);
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NO_SPACE,
+ EXPECT_EQ(base::File::FILE_ERROR_NO_SPACE,
ofu()->CopyInForeignFile(context.get(),
src_file_path, dest_url));
}
context.reset(NewContext(NULL));
context->set_allowed_bytes_growth(path_cost + src_file_length);
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
ofu()->CopyInForeignFile(context.get(),
src_file_path, dest_url));
@@ -607,21 +597,22 @@
EXPECT_FALSE(DirectoryExists(dest_url));
context.reset(NewContext(NULL));
- base::PlatformFileInfo file_info;
+ base::File::Info file_info;
base::FilePath data_path;
- EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->GetFileInfo(
- context.get(), dest_url, &file_info, &data_path));
+ EXPECT_EQ(base::File::FILE_OK,
+ ofu()->GetFileInfo(context.get(), dest_url, &file_info,
+ &data_path));
EXPECT_NE(data_path, src_file_path);
EXPECT_TRUE(FileExists(data_path));
EXPECT_EQ(src_file_length, GetSize(data_path));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
- ofu()->DeleteFile(context.get(), dest_url));
+ EXPECT_EQ(base::File::FILE_OK,
+ ofu()->DeleteFile(context.get(), dest_url));
}
void ClearTimestamp(const FileSystemURL& url) {
scoped_ptr<FileSystemOperationContext> context(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
ofu()->Touch(context.get(), url, base::Time(), base::Time()));
EXPECT_EQ(base::Time(), GetModifiedTime(url));
}
@@ -629,9 +620,9 @@
base::Time GetModifiedTime(const FileSystemURL& url) {
scoped_ptr<FileSystemOperationContext> context(NewContext(NULL));
base::FilePath data_path;
- base::PlatformFileInfo file_info;
+ base::File::Info file_info;
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
ofu()->GetFileInfo(context.get(), url, &file_info, &data_path));
EXPECT_TRUE(change_observer()->HasNoChange());
return file_info.last_modified;
@@ -652,19 +643,19 @@
FileSystemURLAppendUTF8(dest_dir_url, "fuga"));
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
ofu()->CreateDirectory(context.get(), src_dir_url, true, true));
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
ofu()->CreateDirectory(context.get(), dest_dir_url, true, true));
bool created = false;
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
ofu()->EnsureFileExists(context.get(), src_file_url, &created));
if (overwrite) {
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
ofu()->EnsureFileExists(context.get(),
dest_file_url, &created));
}
@@ -672,7 +663,7 @@
ClearTimestamp(src_dir_url);
ClearTimestamp(dest_dir_url);
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
ofu()->CopyOrMoveFile(context.get(),
src_file_url, dest_file_url,
FileSystemOperation::OPTION_NONE,
@@ -781,10 +772,10 @@
storage_policy_->AddIsolated(origin_);
scoped_ptr<ObfuscatedFileUtil> file_util = CreateObfuscatedFileUtil(
storage_policy_.get());
- base::PlatformFileError error = base::PLATFORM_FILE_ERROR_FAILED;
+ base::File::Error error = base::File::FILE_ERROR_FAILED;
base::FilePath origin_directory = file_util->GetDirectoryForOrigin(
origin_, true /* create */, &error);
- EXPECT_EQ(base::PLATFORM_FILE_OK, error);
+ EXPECT_EQ(base::File::FILE_OK, error);
// The database is migrated from the old one.
EXPECT_TRUE(base::DirectoryExists(origin_directory));
@@ -837,13 +828,12 @@
scoped_ptr<FileSystemOperationContext> context(NewContext(NULL));
int file_flags = base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_WRITE;
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND,
- ofu()->CreateOrOpen(
- context.get(), url, file_flags, &file_handle,
- &created));
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND,
+ ofu()->CreateOrOpen(context.get(), url, file_flags, &file_handle,
+ &created));
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND,
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND,
ofu()->DeleteFile(context.get(), url));
url = CreateURLFromUTF8("test file");
@@ -854,16 +844,16 @@
context.reset(NewContext(NULL));
context->set_allowed_bytes_growth(
ObfuscatedFileUtil::ComputeFilePathCost(url.path()) - 1);
- ASSERT_EQ(base::PLATFORM_FILE_ERROR_NO_SPACE,
- ofu()->CreateOrOpen(
- context.get(), url, file_flags, &file_handle, &created));
+ ASSERT_EQ(base::File::FILE_ERROR_NO_SPACE,
+ ofu()->CreateOrOpen(context.get(), url, file_flags,
+ &file_handle, &created));
context.reset(NewContext(NULL));
context->set_allowed_bytes_growth(
ObfuscatedFileUtil::ComputeFilePathCost(url.path()));
- ASSERT_EQ(base::PLATFORM_FILE_OK,
- ofu()->CreateOrOpen(
- context.get(), url, file_flags, &file_handle, &created));
+ ASSERT_EQ(base::File::FILE_OK,
+ ofu()->CreateOrOpen(context.get(), url, file_flags, &file_handle,
+ &created));
ASSERT_TRUE(created);
EXPECT_EQ(1, change_observer()->get_and_reset_create_file_count());
EXPECT_NE(base::kInvalidPlatformFileValue, file_handle);
@@ -872,20 +862,19 @@
context.reset(NewContext(NULL));
base::FilePath local_path;
- EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->GetLocalFilePath(
- context.get(), url, &local_path));
+ EXPECT_EQ(base::File::FILE_OK,
+ ofu()->GetLocalFilePath(context.get(), url, &local_path));
EXPECT_TRUE(base::PathExists(local_path));
// Verify that deleting a file isn't stopped by zero quota, and that it frees
// up quote from its path.
context.reset(NewContext(NULL));
context->set_allowed_bytes_growth(0);
- EXPECT_EQ(base::PLATFORM_FILE_OK,
- ofu()->DeleteFile(context.get(), url));
+ EXPECT_EQ(base::File::FILE_OK, ofu()->DeleteFile(context.get(), url));
EXPECT_EQ(1, change_observer()->get_and_reset_remove_file_count());
EXPECT_FALSE(base::PathExists(local_path));
EXPECT_EQ(ObfuscatedFileUtil::ComputeFilePathCost(url.path()),
- context->allowed_bytes_growth());
+ context->allowed_bytes_growth());
context.reset(NewContext(NULL));
bool exclusive = true;
@@ -893,16 +882,17 @@
FileSystemURL directory_url = CreateURLFromUTF8(
"series/of/directories");
url = FileSystemURLAppendUTF8(directory_url, "file name");
- EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->CreateDirectory(
- context.get(), directory_url, exclusive, recursive));
+ EXPECT_EQ(base::File::FILE_OK,
+ ofu()->CreateDirectory(context.get(), directory_url, exclusive,
+ recursive));
// The oepration created 3 directories recursively.
EXPECT_EQ(3, change_observer()->get_and_reset_create_directory_count());
context.reset(NewContext(NULL));
file_handle = base::kInvalidPlatformFileValue;
- ASSERT_EQ(base::PLATFORM_FILE_OK,
- ofu()->CreateOrOpen(
- context.get(), url, file_flags, &file_handle, &created));
+ ASSERT_EQ(base::File::FILE_OK,
+ ofu()->CreateOrOpen(context.get(), url, file_flags, &file_handle,
+ &created));
ASSERT_TRUE(created);
EXPECT_EQ(1, change_observer()->get_and_reset_create_file_count());
EXPECT_NE(base::kInvalidPlatformFileValue, file_handle);
@@ -910,13 +900,12 @@
CheckFileAndCloseHandle(url, file_handle);
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->GetLocalFilePath(
- context.get(), url, &local_path));
+ EXPECT_EQ(base::File::FILE_OK,
+ ofu()->GetLocalFilePath(context.get(), url, &local_path));
EXPECT_TRUE(base::PathExists(local_path));
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
- ofu()->DeleteFile(context.get(), url));
+ EXPECT_EQ(base::File::FILE_OK, ofu()->DeleteFile(context.get(), url));
EXPECT_EQ(1, change_observer()->get_and_reset_remove_file_count());
EXPECT_FALSE(base::PathExists(local_path));
@@ -929,30 +918,28 @@
FileSystemURL url = CreateURLFromUTF8("file");
scoped_ptr<FileSystemOperationContext> context(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND,
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND,
ofu()->Truncate(context.get(), url, 4));
context.reset(NewContext(NULL));
- ASSERT_EQ(base::PLATFORM_FILE_OK,
- ofu()->EnsureFileExists(context.get(), url, &created));
+ ASSERT_EQ(base::File::FILE_OK,
+ ofu()->EnsureFileExists(context.get(), url, &created));
ASSERT_TRUE(created);
EXPECT_EQ(1, change_observer()->get_and_reset_create_file_count());
context.reset(NewContext(NULL));
base::FilePath local_path;
- EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->GetLocalFilePath(
- context.get(), url, &local_path));
+ EXPECT_EQ(base::File::FILE_OK,
+ ofu()->GetLocalFilePath(context.get(), url, &local_path));
EXPECT_EQ(0, GetSize(local_path));
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->Truncate(
- context.get(), url, 10));
+ EXPECT_EQ(base::File::FILE_OK, ofu()->Truncate(context.get(), url, 10));
EXPECT_EQ(1, change_observer()->get_and_reset_modify_file_count());
EXPECT_EQ(10, GetSize(local_path));
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->Truncate(
- context.get(), url, 1));
+ EXPECT_EQ(base::File::FILE_OK, ofu()->Truncate(context.get(), url, 1));
EXPECT_EQ(1, GetSize(local_path));
EXPECT_EQ(1, change_observer()->get_and_reset_modify_file_count());
@@ -967,41 +954,32 @@
bool created = false;
FileSystemURL url = CreateURLFromUTF8("file");
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
ofu()->EnsureFileExists(
AllowUsageIncrease(PathCost(url))->context(),
url, &created));
ASSERT_TRUE(created);
ASSERT_EQ(0, ComputeTotalFileSize());
- ASSERT_EQ(base::PLATFORM_FILE_OK,
- ofu()->Truncate(
- AllowUsageIncrease(1020)->context(),
- url, 1020));
+ ASSERT_EQ(base::File::FILE_OK,
+ ofu()->Truncate(AllowUsageIncrease(1020)->context(), url, 1020));
ASSERT_EQ(1020, ComputeTotalFileSize());
- ASSERT_EQ(base::PLATFORM_FILE_OK,
- ofu()->Truncate(
- AllowUsageIncrease(-1020)->context(),
- url, 0));
+ ASSERT_EQ(base::File::FILE_OK,
+ ofu()->Truncate(AllowUsageIncrease(-1020)->context(), url, 0));
ASSERT_EQ(0, ComputeTotalFileSize());
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NO_SPACE,
- ofu()->Truncate(
- DisallowUsageIncrease(1021)->context(),
- url, 1021));
+ EXPECT_EQ(base::File::FILE_ERROR_NO_SPACE,
+ ofu()->Truncate(DisallowUsageIncrease(1021)->context(),
+ url, 1021));
ASSERT_EQ(0, ComputeTotalFileSize());
- EXPECT_EQ(base::PLATFORM_FILE_OK,
- ofu()->Truncate(
- AllowUsageIncrease(1020)->context(),
- url, 1020));
+ EXPECT_EQ(base::File::FILE_OK,
+ ofu()->Truncate(AllowUsageIncrease(1020)->context(), url, 1020));
ASSERT_EQ(1020, ComputeTotalFileSize());
- EXPECT_EQ(base::PLATFORM_FILE_OK,
- ofu()->Truncate(
- AllowUsageIncrease(0)->context(),
- url, 1020));
+ EXPECT_EQ(base::File::FILE_OK,
+ ofu()->Truncate(AllowUsageIncrease(0)->context(), url, 1020));
ASSERT_EQ(1020, ComputeTotalFileSize());
// quota exceeded
@@ -1009,24 +987,21 @@
scoped_ptr<UsageVerifyHelper> helper = AllowUsageIncrease(-1);
helper->context()->set_allowed_bytes_growth(
helper->context()->allowed_bytes_growth() - 1);
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
ofu()->Truncate(helper->context(), url, 1019));
ASSERT_EQ(1019, ComputeTotalFileSize());
}
// Delete backing file to make following truncation fail.
base::FilePath local_path;
- ASSERT_EQ(base::PLATFORM_FILE_OK,
- ofu()->GetLocalFilePath(
- UnlimitedContext().get(),
- url, &local_path));
+ ASSERT_EQ(base::File::FILE_OK,
+ ofu()->GetLocalFilePath(UnlimitedContext().get(), url,
+ &local_path));
ASSERT_FALSE(local_path.empty());
ASSERT_TRUE(base::DeleteFile(local_path, false));
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND,
- ofu()->Truncate(
- LimitedContext(1234).get(),
- url, 1234));
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND,
+ ofu()->Truncate(LimitedContext(1234).get(), url, 1234));
ASSERT_EQ(0, ComputeTotalFileSize());
}
@@ -1034,9 +1009,8 @@
FileSystemURL url = CreateURLFromUTF8("fake/file");
bool created = false;
scoped_ptr<FileSystemOperationContext> context(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND,
- ofu()->EnsureFileExists(
- context.get(), url, &created));
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND,
+ ofu()->EnsureFileExists(context.get(), url, &created));
EXPECT_TRUE(change_observer()->HasNoChange());
// Verify that file creation requires sufficient quota for the path.
@@ -1045,7 +1019,7 @@
created = false;
context->set_allowed_bytes_growth(
ObfuscatedFileUtil::ComputeFilePathCost(url.path()) - 1);
- ASSERT_EQ(base::PLATFORM_FILE_ERROR_NO_SPACE,
+ ASSERT_EQ(base::File::FILE_ERROR_NO_SPACE,
ofu()->EnsureFileExists(context.get(), url, &created));
ASSERT_FALSE(created);
EXPECT_TRUE(change_observer()->HasNoChange());
@@ -1053,7 +1027,7 @@
context.reset(NewContext(NULL));
context->set_allowed_bytes_growth(
ObfuscatedFileUtil::ComputeFilePathCost(url.path()));
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
ofu()->EnsureFileExists(context.get(), url, &created));
ASSERT_TRUE(created);
EXPECT_EQ(1, change_observer()->get_and_reset_create_file_count());
@@ -1061,7 +1035,7 @@
CheckFileAndCloseHandle(url, base::kInvalidPlatformFileValue);
context.reset(NewContext(NULL));
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
ofu()->EnsureFileExists(context.get(), url, &created));
ASSERT_FALSE(created);
EXPECT_TRUE(change_observer()->HasNoChange());
@@ -1071,15 +1045,14 @@
context.reset(NewContext(NULL));
bool exclusive = true;
bool recursive = true;
- EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->CreateDirectory(
- context.get(),
- FileSystemURLDirName(url),
- exclusive, recursive));
+ EXPECT_EQ(base::File::FILE_OK,
+ ofu()->CreateDirectory(context.get(), FileSystemURLDirName(url),
+ exclusive, recursive));
// 2 directories: path/ and path/to.
EXPECT_EQ(2, change_observer()->get_and_reset_create_directory_count());
context.reset(NewContext(NULL));
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
ofu()->EnsureFileExists(context.get(), url, &created));
ASSERT_TRUE(created);
EXPECT_FALSE(DirectoryExists(url));
@@ -1093,12 +1066,12 @@
bool exclusive = false;
bool recursive = false;
FileSystemURL url = CreateURLFromUTF8("foo/bar");
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, ofu()->CreateDirectory(
- context.get(), url, exclusive, recursive));
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND,
+ ofu()->CreateDirectory(context.get(), url, exclusive, recursive));
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND,
- ofu()->DeleteDirectory(context.get(), url));
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND,
+ ofu()->DeleteDirectory(context.get(), url));
FileSystemURL root = CreateURLFromUTF8(std::string());
EXPECT_FALSE(DirectoryExists(url));
@@ -1109,8 +1082,8 @@
context.reset(NewContext(NULL));
exclusive = false;
recursive = true;
- EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->CreateDirectory(
- context.get(), url, exclusive, recursive));
+ EXPECT_EQ(base::File::FILE_OK,
+ ofu()->CreateDirectory(context.get(), url, exclusive, recursive));
EXPECT_EQ(2, change_observer()->get_and_reset_create_directory_count());
EXPECT_TRUE(DirectoryExists(url));
@@ -1126,37 +1099,37 @@
// Can't remove a non-empty directory.
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_EMPTY,
- ofu()->DeleteDirectory(context.get(),
- FileSystemURLDirName(url)));
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_EMPTY,
+ ofu()->DeleteDirectory(context.get(),
+ FileSystemURLDirName(url)));
EXPECT_TRUE(change_observer()->HasNoChange());
- base::PlatformFileInfo file_info;
+ base::File::Info file_info;
base::FilePath local_path;
- EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->GetFileInfo(
- context.get(), url, &file_info, &local_path));
+ EXPECT_EQ(base::File::FILE_OK,
+ ofu()->GetFileInfo(context.get(), url, &file_info, &local_path));
EXPECT_TRUE(local_path.empty());
EXPECT_TRUE(file_info.is_directory);
EXPECT_FALSE(file_info.is_symbolic_link);
// Same create again should succeed, since exclusive is false.
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->CreateDirectory(
- context.get(), url, exclusive, recursive));
+ EXPECT_EQ(base::File::FILE_OK,
+ ofu()->CreateDirectory(context.get(), url, exclusive, recursive));
EXPECT_TRUE(change_observer()->HasNoChange());
exclusive = true;
recursive = true;
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_EXISTS, ofu()->CreateDirectory(
- context.get(), url, exclusive, recursive));
+ EXPECT_EQ(base::File::FILE_ERROR_EXISTS,
+ ofu()->CreateDirectory(context.get(), url, exclusive, recursive));
EXPECT_TRUE(change_observer()->HasNoChange());
// Verify that deleting a directory isn't stopped by zero quota, and that it
// frees up quota from its path.
context.reset(NewContext(NULL));
context->set_allowed_bytes_growth(0);
- EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->DeleteDirectory(context.get(), url));
+ EXPECT_EQ(base::File::FILE_OK, ofu()->DeleteDirectory(context.get(), url));
EXPECT_EQ(1, change_observer()->get_and_reset_remove_directory_count());
EXPECT_EQ(ObfuscatedFileUtil::ComputeFilePathCost(url.path()),
context->allowed_bytes_growth());
@@ -1168,8 +1141,8 @@
context.reset(NewContext(NULL));
EXPECT_TRUE(ofu()->IsDirectoryEmpty(context.get(), url));
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, ofu()->GetFileInfo(
- context.get(), url, &file_info, &local_path));
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND,
+ ofu()->GetFileInfo(context.get(), url, &file_info, &local_path));
// Verify that file creation requires sufficient quota for the path.
exclusive = true;
@@ -1177,15 +1150,15 @@
context.reset(NewContext(NULL));
context->set_allowed_bytes_growth(
ObfuscatedFileUtil::ComputeFilePathCost(url.path()) - 1);
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NO_SPACE, ofu()->CreateDirectory(
- context.get(), url, exclusive, recursive));
+ EXPECT_EQ(base::File::FILE_ERROR_NO_SPACE,
+ ofu()->CreateDirectory(context.get(), url, exclusive, recursive));
EXPECT_TRUE(change_observer()->HasNoChange());
context.reset(NewContext(NULL));
context->set_allowed_bytes_growth(
ObfuscatedFileUtil::ComputeFilePathCost(url.path()));
- EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->CreateDirectory(
- context.get(), url, exclusive, recursive));
+ EXPECT_EQ(base::File::FILE_OK,
+ ofu()->CreateDirectory(context.get(), url, exclusive, recursive));
EXPECT_EQ(1, change_observer()->get_and_reset_create_directory_count());
EXPECT_TRUE(DirectoryExists(url));
@@ -1194,16 +1167,16 @@
exclusive = true;
recursive = false;
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_EXISTS, ofu()->CreateDirectory(
- context.get(), url, exclusive, recursive));
+ EXPECT_EQ(base::File::FILE_ERROR_EXISTS,
+ ofu()->CreateDirectory(context.get(), url, exclusive, recursive));
EXPECT_TRUE(change_observer()->HasNoChange());
exclusive = true;
recursive = false;
url = CreateURLFromUTF8("foo");
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_EXISTS, ofu()->CreateDirectory(
- context.get(), url, exclusive, recursive));
+ EXPECT_EQ(base::File::FILE_ERROR_EXISTS,
+ ofu()->CreateDirectory(context.get(), url, exclusive, recursive));
EXPECT_TRUE(change_observer()->HasNoChange());
url = CreateURLFromUTF8("blah");
@@ -1214,8 +1187,8 @@
exclusive = true;
recursive = false;
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->CreateDirectory(
- context.get(), url, exclusive, recursive));
+ EXPECT_EQ(base::File::FILE_OK,
+ ofu()->CreateDirectory(context.get(), url, exclusive, recursive));
EXPECT_EQ(1, change_observer()->get_and_reset_create_directory_count());
EXPECT_TRUE(DirectoryExists(url));
@@ -1224,8 +1197,8 @@
exclusive = true;
recursive = false;
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_EXISTS, ofu()->CreateDirectory(
- context.get(), url, exclusive, recursive));
+ EXPECT_EQ(base::File::FILE_ERROR_EXISTS,
+ ofu()->CreateDirectory(context.get(), url, exclusive, recursive));
EXPECT_TRUE(change_observer()->HasNoChange());
}
@@ -1234,8 +1207,8 @@
bool exclusive = true;
bool recursive = true;
FileSystemURL url = CreateURLFromUTF8("directory/to/use");
- EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->CreateDirectory(
- context.get(), url, exclusive, recursive));
+ EXPECT_EQ(base::File::FILE_OK,
+ ofu()->CreateDirectory(context.get(), url, exclusive, recursive));
TestReadDirectoryHelper(url);
}
@@ -1252,14 +1225,14 @@
scoped_ptr<FileSystemOperationContext> context(NewContext(NULL));
bool created = false;
- ASSERT_EQ(base::PLATFORM_FILE_OK,
- ofu()->EnsureFileExists(context.get(), url, &created));
+ ASSERT_EQ(base::File::FILE_OK,
+ ofu()->EnsureFileExists(context.get(), url, &created));
ASSERT_TRUE(created);
std::vector<fileapi::DirectoryEntry> entries;
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY,
- AsyncFileTestHelper::ReadDirectory(
- file_system_context(), url, &entries));
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_A_DIRECTORY,
+ AsyncFileTestHelper::ReadDirectory(file_system_context(), url,
+ &entries));
EXPECT_TRUE(ofu()->IsDirectoryEmpty(context.get(), url));
}
@@ -1272,14 +1245,14 @@
base::Time last_modified_time = base::Time::Now();
// It's not there yet.
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND,
- ofu()->Touch(
- context.get(), url, last_access_time, last_modified_time));
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND,
+ ofu()->Touch(context.get(), url, last_access_time,
+ last_modified_time));
// OK, now create it.
context.reset(NewContext(NULL));
bool created = false;
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
ofu()->EnsureFileExists(context.get(), url, &created));
ASSERT_TRUE(created);
TestTouchHelper(url, true);
@@ -1289,8 +1262,8 @@
bool exclusive = true;
bool recursive = false;
url = CreateURLFromUTF8("dir");
- ASSERT_EQ(base::PLATFORM_FILE_OK, ofu()->CreateDirectory(context.get(),
- url, exclusive, recursive));
+ ASSERT_EQ(base::File::FILE_OK,
+ ofu()->CreateDirectory(context.get(), url, exclusive, recursive));
TestTouchHelper(url, false);
}
@@ -1301,12 +1274,12 @@
url = CreateURLFromUTF8("file name");
context->set_allowed_bytes_growth(5);
bool created = false;
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NO_SPACE,
- ofu()->EnsureFileExists(context.get(), url, &created));
+ EXPECT_EQ(base::File::FILE_ERROR_NO_SPACE,
+ ofu()->EnsureFileExists(context.get(), url, &created));
EXPECT_FALSE(created);
context->set_allowed_bytes_growth(1024);
- EXPECT_EQ(base::PLATFORM_FILE_OK,
- ofu()->EnsureFileExists(context.get(), url, &created));
+ EXPECT_EQ(base::File::FILE_OK,
+ ofu()->EnsureFileExists(context.get(), url, &created));
EXPECT_TRUE(created);
int64 path_cost = ObfuscatedFileUtil::ComputeFilePathCost(url.path());
EXPECT_EQ(1024 - path_cost, context->allowed_bytes_growth());
@@ -1326,8 +1299,8 @@
}
context.reset(NewContext(NULL));
context->set_allowed_bytes_growth(1024);
- EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->CreateDirectory(
- context.get(), url, exclusive, recursive));
+ EXPECT_EQ(base::File::FILE_OK,
+ ofu()->CreateDirectory(context.get(), url, exclusive, recursive));
EXPECT_EQ(1024 - path_cost, context->allowed_bytes_growth());
}
@@ -1337,39 +1310,39 @@
scoped_ptr<FileSystemOperationContext> context(NewContext(NULL));
bool is_copy_not_move = false;
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND,
- ofu()->CopyOrMoveFile(context.get(), source_url, dest_url,
- FileSystemOperation::OPTION_NONE,
- is_copy_not_move));
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND,
+ ofu()->CopyOrMoveFile(context.get(), source_url, dest_url,
+ 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,
- FileSystemOperation::OPTION_NONE,
- is_copy_not_move));
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND,
+ ofu()->CopyOrMoveFile(context.get(), source_url, dest_url,
+ FileSystemOperation::OPTION_NONE,
+ is_copy_not_move));
EXPECT_TRUE(change_observer()->HasNoChange());
source_url = CreateURLFromUTF8("dir/dir/file");
bool exclusive = true;
bool recursive = true;
context.reset(NewContext(NULL));
- ASSERT_EQ(base::PLATFORM_FILE_OK, ofu()->CreateDirectory(
- context.get(),
- FileSystemURLDirName(source_url),
- exclusive, recursive));
+ ASSERT_EQ(base::File::FILE_OK,
+ ofu()->CreateDirectory(context.get(),
+ FileSystemURLDirName(source_url),
+ exclusive, recursive));
EXPECT_EQ(2, change_observer()->get_and_reset_create_directory_count());
is_copy_not_move = false;
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND,
- ofu()->CopyOrMoveFile(context.get(), source_url, dest_url,
- FileSystemOperation::OPTION_NONE,
- is_copy_not_move));
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND,
+ ofu()->CopyOrMoveFile(context.get(), source_url, dest_url,
+ 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,
- FileSystemOperation::OPTION_NONE,
- is_copy_not_move));
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND,
+ ofu()->CopyOrMoveFile(context.get(), source_url, dest_url,
+ FileSystemOperation::OPTION_NONE,
+ is_copy_not_move));
EXPECT_TRUE(change_observer()->HasNoChange());
}
@@ -1396,64 +1369,68 @@
FileSystemURL dest_url = CreateURLFromUTF8(test_case.dest_path);
context.reset(NewContext(NULL));
- ASSERT_EQ(base::PLATFORM_FILE_OK, ofu()->CreateDirectory(
- context.get(),
- FileSystemURLDirName(source_url),
- exclusive, recursive));
+ ASSERT_EQ(base::File::FILE_OK,
+ ofu()->CreateDirectory(context.get(),
+ FileSystemURLDirName(source_url),
+ exclusive, recursive));
context.reset(NewContext(NULL));
- ASSERT_EQ(base::PLATFORM_FILE_OK, ofu()->CreateDirectory(
- context.get(),
- FileSystemURLDirName(dest_url),
- exclusive, recursive));
+ ASSERT_EQ(base::File::FILE_OK,
+ ofu()->CreateDirectory(context.get(),
+ FileSystemURLDirName(dest_url),
+ exclusive, recursive));
bool created = false;
context.reset(NewContext(NULL));
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
ofu()->EnsureFileExists(context.get(), source_url, &created));
ASSERT_TRUE(created);
context.reset(NewContext(NULL));
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
ofu()->Truncate(context.get(), source_url, kSourceLength));
if (test_case.cause_overwrite) {
context.reset(NewContext(NULL));
created = false;
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
ofu()->EnsureFileExists(context.get(), dest_url, &created));
ASSERT_TRUE(created);
context.reset(NewContext(NULL));
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
ofu()->Truncate(context.get(), dest_url, kDestLength));
}
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->CopyOrMoveFile(
- context.get(), source_url, dest_url, FileSystemOperation::OPTION_NONE,
- test_case.is_copy_not_move));
+ EXPECT_EQ(base::File::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;
+ base::File::Info file_info;
base::FilePath local_path;
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->GetFileInfo(
- context.get(), source_url, &file_info, &local_path));
+ EXPECT_EQ(base::File::FILE_OK,
+ ofu()->GetFileInfo(context.get(), source_url, &file_info,
+ &local_path));
EXPECT_EQ(kSourceLength, file_info.size);
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
ofu()->DeleteFile(context.get(), source_url));
} else {
- base::PlatformFileInfo file_info;
+ base::File::Info file_info;
base::FilePath local_path;
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, ofu()->GetFileInfo(
- context.get(), source_url, &file_info, &local_path));
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND,
+ ofu()->GetFileInfo(context.get(), source_url, &file_info,
+ &local_path));
}
- base::PlatformFileInfo file_info;
+ base::File::Info file_info;
base::FilePath local_path;
- EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->GetFileInfo(
- context.get(), dest_url, &file_info, &local_path));
+ EXPECT_EQ(base::File::FILE_OK,
+ ofu()->GetFileInfo(context.get(), dest_url, &file_info,
+ &local_path));
EXPECT_EQ(kSourceLength, file_info.size);
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
ofu()->DeleteFile(context.get(), dest_url));
}
}
@@ -1463,32 +1440,29 @@
FileSystemURL dest_url = CreateURLFromUTF8("destination path");
scoped_ptr<FileSystemOperationContext> context(NewContext(NULL));
bool created = false;
- ASSERT_EQ(base::PLATFORM_FILE_OK, ofu()->EnsureFileExists(
- context.get(), src_url, &created));
+ ASSERT_EQ(base::File::FILE_OK,
+ ofu()->EnsureFileExists(context.get(), src_url, &created));
bool is_copy = true;
// Copy, no overwrite.
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, FileSystemOperation::OPTION_NONE, is_copy));
+ EXPECT_EQ(base::File::FILE_ERROR_NO_SPACE,
+ 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, FileSystemOperation::OPTION_NONE, is_copy));
+ EXPECT_EQ(base::File::FILE_OK,
+ 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, FileSystemOperation::OPTION_NONE, is_copy));
+ EXPECT_EQ(base::File::FILE_OK,
+ ofu()->CopyOrMoveFile(context.get(), src_url, dest_url,
+ FileSystemOperation::OPTION_NONE, is_copy));
}
TEST_F(ObfuscatedFileUtilTest, TestMovePathQuotasWithRename) {
@@ -1496,8 +1470,8 @@
FileSystemURL dest_url = CreateURLFromUTF8("destination path");
scoped_ptr<FileSystemOperationContext> context(NewContext(NULL));
bool created = false;
- ASSERT_EQ(base::PLATFORM_FILE_OK, ofu()->EnsureFileExists(
- context.get(), src_url, &created));
+ ASSERT_EQ(base::File::FILE_OK,
+ ofu()->EnsureFileExists(context.get(), src_url, &created));
bool is_copy = false;
// Move, rename, no overwrite.
@@ -1505,45 +1479,43 @@
context->set_allowed_bytes_growth(
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, FileSystemOperation::OPTION_NONE, is_copy));
+ EXPECT_EQ(base::File::FILE_ERROR_NO_SPACE,
+ 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, FileSystemOperation::OPTION_NONE, is_copy));
+ EXPECT_EQ(base::File::FILE_OK,
+ 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(
- context.get(), src_url, &created));
+ ASSERT_EQ(base::File::FILE_OK,
+ ofu()->EnsureFileExists(context.get(), src_url, &created));
// Move, rename, 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, FileSystemOperation::OPTION_NONE, is_copy));
+ EXPECT_EQ(base::File::FILE_OK,
+ ofu()->CopyOrMoveFile(context.get(), src_url, dest_url,
+ FileSystemOperation::OPTION_NONE, is_copy));
}
TEST_F(ObfuscatedFileUtilTest, TestMovePathQuotasWithoutRename) {
FileSystemURL src_url = CreateURLFromUTF8("src path");
scoped_ptr<FileSystemOperationContext> context(NewContext(NULL));
bool created = false;
- ASSERT_EQ(base::PLATFORM_FILE_OK, ofu()->EnsureFileExists(
- context.get(), src_url, &created));
+ ASSERT_EQ(base::File::FILE_OK,
+ ofu()->EnsureFileExists(context.get(), src_url, &created));
bool exclusive = true;
bool recursive = false;
FileSystemURL dir_url = CreateURLFromUTF8("directory path");
context.reset(NewContext(NULL));
- ASSERT_EQ(base::PLATFORM_FILE_OK, ofu()->CreateDirectory(
- context.get(), dir_url, exclusive, recursive));
+ ASSERT_EQ(base::File::FILE_OK,
+ ofu()->CreateDirectory(context.get(), dir_url, exclusive,
+ recursive));
FileSystemURL dest_url = FileSystemURLAppend(
dir_url, src_url.path().value());
@@ -1553,22 +1525,20 @@
// Move, no rename, no overwrite.
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, FileSystemOperation::OPTION_NONE, is_copy));
+ EXPECT_EQ(base::File::FILE_OK,
+ 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.
context.reset(NewContext(NULL));
- ASSERT_EQ(base::PLATFORM_FILE_OK, ofu()->EnsureFileExists(
- context.get(), src_url, &created));
+ ASSERT_EQ(base::File::FILE_OK,
+ ofu()->EnsureFileExists(context.get(), src_url, &created));
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, FileSystemOperation::OPTION_NONE, is_copy));
+ EXPECT_EQ(base::File::FILE_OK,
+ ofu()->CopyOrMoveFile(context.get(), src_url, dest_url,
+ FileSystemOperation::OPTION_NONE, is_copy));
EXPECT_EQ(
allowed_bytes_growth +
ObfuscatedFileUtil::ComputeFilePathCost(src_url.path()),
@@ -1585,8 +1555,9 @@
FileSystemURL src_url = CreateURLFromUTF8("source dir");
bool exclusive = true;
bool recursive = false;
- ASSERT_EQ(base::PLATFORM_FILE_OK, ofu()->CreateDirectory(
- context.get(), src_url, exclusive, recursive));
+ ASSERT_EQ(base::File::FILE_OK,
+ ofu()->CreateDirectory(context.get(), src_url, exclusive,
+ recursive));
std::set<base::FilePath::StringType> files;
std::set<base::FilePath::StringType> directories;
@@ -1595,7 +1566,7 @@
FileSystemURL dest_url = CreateURLFromUTF8("destination dir");
EXPECT_FALSE(DirectoryExists(dest_url));
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
AsyncFileTestHelper::Copy(
file_system_context(), src_url, dest_url));
@@ -1603,7 +1574,7 @@
EXPECT_TRUE(DirectoryExists(src_url));
EXPECT_TRUE(DirectoryExists(dest_url));
recursive = true;
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
AsyncFileTestHelper::Remove(
file_system_context(), dest_url, recursive));
EXPECT_FALSE(DirectoryExists(dest_url));
@@ -1638,7 +1609,7 @@
scoped_ptr<FileSystemOperationContext> context(
NewContext(file_system.get()));
bool created = false;
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
ofu()->EnsureFileExists(
context.get(),
file_system->CreateURLFromUTF8("file"),
@@ -1651,7 +1622,7 @@
scoped_ptr<FileSystemOperationContext> context(
NewContext(file_system.get()));
bool created = false;
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
ofu()->EnsureFileExists(
context.get(),
file_system->CreateURLFromUTF8("file"),
@@ -1712,19 +1683,18 @@
if (test_case.is_directory) {
bool exclusive = true;
bool recursive = false;
- ASSERT_EQ(base::PLATFORM_FILE_OK,
- ofu()->CreateDirectory(context.get(), CreateURL(file_path),
- exclusive, recursive));
+ ASSERT_EQ(base::File::FILE_OK,
+ ofu()->CreateDirectory(context.get(), CreateURL(file_path),
+ exclusive, recursive));
} else {
bool created = false;
- ASSERT_EQ(base::PLATFORM_FILE_OK,
- ofu()->EnsureFileExists(context.get(), CreateURL(file_path),
- &created));
+ ASSERT_EQ(base::File::FILE_OK,
+ ofu()->EnsureFileExists(context.get(), CreateURL(file_path),
+ &created));
ASSERT_TRUE(created);
- ASSERT_EQ(base::PLATFORM_FILE_OK,
- ofu()->Truncate(context.get(),
- CreateURL(file_path),
- test_case.data_file_size));
+ ASSERT_EQ(base::File::FILE_OK,
+ ofu()->Truncate(context.get(), CreateURL(file_path),
+ test_case.data_file_size));
expected_quota += test_case.data_file_size;
}
}
@@ -1751,20 +1721,20 @@
scoped_ptr<FileSystemOperationContext> context;
base::PlatformFile file;
- base::PlatformFileInfo file_info;
+ base::File::Info file_info;
base::FilePath data_path;
bool created = false;
// Create a non-empty file.
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
ofu()->EnsureFileExists(context.get(), kPath1, &created));
EXPECT_TRUE(created);
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
ofu()->Truncate(context.get(), kPath1, 10));
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
ofu()->GetFileInfo(
context.get(), kPath1, &file_info, &data_path));
EXPECT_EQ(10, file_info.size);
@@ -1775,18 +1745,18 @@
// Try to get file info of broken file.
EXPECT_FALSE(PathExists(kPath1));
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
ofu()->EnsureFileExists(context.get(), kPath1, &created));
EXPECT_TRUE(created);
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
ofu()->GetFileInfo(
context.get(), kPath1, &file_info, &data_path));
EXPECT_EQ(0, file_info.size);
// Make another broken file to |kPath2|.
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
ofu()->EnsureFileExists(context.get(), kPath2, &created));
EXPECT_TRUE(created);
@@ -1795,31 +1765,32 @@
// Repair broken |kPath1|.
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND,
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND,
ofu()->Touch(context.get(), kPath1, base::Time::Now(),
base::Time::Now()));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
ofu()->EnsureFileExists(context.get(), kPath1, &created));
EXPECT_TRUE(created);
// Copy from sound |kPath1| to broken |kPath2|.
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
ofu()->CopyOrMoveFile(context.get(), kPath1, kPath2,
FileSystemOperation::OPTION_NONE,
true /* copy */));
ofu()->DestroyDirectoryDatabase(origin(), type_string());
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
ofu()->CreateOrOpen(
context.get(), kPath1,
base::PLATFORM_FILE_READ | base::PLATFORM_FILE_CREATE,
&file, &created));
EXPECT_TRUE(created);
- EXPECT_TRUE(base::GetPlatformFileInfo(file, &file_info));
+
+ base::File base_file(file);
+ EXPECT_TRUE(base_file.GetInfo(&file_info));
EXPECT_EQ(0, file_info.size);
- EXPECT_TRUE(base::ClosePlatformFile(file));
}
TEST_F(ObfuscatedFileUtilTest, TestIncompleteDirectoryReading) {
@@ -1834,24 +1805,24 @@
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kPath); ++i) {
bool created = false;
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
ofu()->EnsureFileExists(context.get(), kPath[i], &created));
EXPECT_TRUE(created);
}
std::vector<fileapi::DirectoryEntry> entries;
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
AsyncFileTestHelper::ReadDirectory(
file_system_context(), empty_path, &entries));
EXPECT_EQ(3u, entries.size());
base::FilePath local_path;
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
ofu()->GetLocalFilePath(context.get(), kPath[0], &local_path));
EXPECT_TRUE(base::DeleteFile(local_path, false));
entries.clear();
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
AsyncFileTestHelper::ReadDirectory(
file_system_context(), empty_path, &entries));
EXPECT_EQ(ARRAYSIZE_UNSAFE(kPath) - 1, entries.size());
@@ -1862,7 +1833,7 @@
const FileSystemURL dir_url = CreateURLFromUTF8("foo_dir");
// Create working directory.
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
ofu()->CreateDirectory(context.get(), dir_url, false, false));
// EnsureFileExists, create case.
@@ -1871,7 +1842,7 @@
bool created = false;
ClearTimestamp(dir_url);
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
ofu()->EnsureFileExists(context.get(), url, &created));
EXPECT_TRUE(created);
EXPECT_NE(base::Time(), GetModifiedTime(dir_url));
@@ -1880,7 +1851,7 @@
created = true;
ClearTimestamp(dir_url);
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
ofu()->EnsureFileExists(context.get(), url, &created));
EXPECT_FALSE(created);
EXPECT_EQ(base::Time(), GetModifiedTime(dir_url));
@@ -1888,12 +1859,12 @@
// fail case.
url = FileSystemURLAppendUTF8(dir_url, "EnsureFileExists_dir");
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
ofu()->CreateDirectory(context.get(), url, false, false));
ClearTimestamp(dir_url);
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_A_FILE,
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_A_FILE,
ofu()->EnsureFileExists(context.get(), url, &created));
EXPECT_EQ(base::Time(), GetModifiedTime(dir_url));
@@ -1903,7 +1874,7 @@
created = false;
ClearTimestamp(dir_url);
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
ofu()->CreateOrOpen(
context.get(), url,
base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_WRITE,
@@ -1918,7 +1889,7 @@
created = true;
ClearTimestamp(dir_url);
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
ofu()->CreateOrOpen(
context.get(), url,
base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_WRITE,
@@ -1932,7 +1903,7 @@
file_handle = base::kInvalidPlatformFileValue;
ClearTimestamp(dir_url);
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_EXISTS,
+ EXPECT_EQ(base::File::FILE_ERROR_EXISTS,
ofu()->CreateOrOpen(
context.get(), url,
base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_WRITE,
@@ -1946,7 +1917,7 @@
FileSystemURL subdir_url(FileSystemURLAppendUTF8(url, "subdir"));
ClearTimestamp(dir_url);
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
ofu()->CreateDirectory(context.get(), subdir_url,
true /* exclusive */, true /* recursive */));
EXPECT_NE(base::Time(), GetModifiedTime(dir_url));
@@ -1957,7 +1928,7 @@
ClearTimestamp(dir_url);
ClearTimestamp(url);
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
ofu()->CreateDirectory(context.get(), subdir_url,
true /* exclusive */, true /* recursive */));
EXPECT_EQ(base::Time(), GetModifiedTime(dir_url));
@@ -1967,7 +1938,7 @@
url = FileSystemURLAppendUTF8(dir_url, "CreateDirectory_dir");
ClearTimestamp(dir_url);
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_EXISTS,
+ EXPECT_EQ(base::File::FILE_ERROR_EXISTS,
ofu()->CreateDirectory(context.get(), url,
true /* exclusive */, true /* recursive */));
EXPECT_EQ(base::Time(), GetModifiedTime(dir_url));
@@ -1977,17 +1948,17 @@
FileSystemURL src_path = FileSystemURLAppendUTF8(
dir_url, "CopyInForeignFile_src_file");
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
ofu()->EnsureFileExists(context.get(), src_path, &created));
EXPECT_TRUE(created);
base::FilePath src_local_path;
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
ofu()->GetLocalFilePath(context.get(), src_path, &src_local_path));
ClearTimestamp(dir_url);
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
ofu()->CopyInForeignFile(context.get(),
src_local_path,
url));
@@ -1999,7 +1970,7 @@
const FileSystemURL dir_url = CreateURLFromUTF8("foo_dir");
// Create working directory.
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
ofu()->CreateDirectory(context.get(), dir_url, false, false));
// DeleteFile, delete case.
@@ -2007,20 +1978,20 @@
dir_url, "DeleteFile_file");
bool created = false;
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
ofu()->EnsureFileExists(context.get(), url, &created));
EXPECT_TRUE(created);
ClearTimestamp(dir_url);
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
ofu()->DeleteFile(context.get(), url));
EXPECT_NE(base::Time(), GetModifiedTime(dir_url));
// fail case.
ClearTimestamp(dir_url);
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND,
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND,
ofu()->DeleteFile(context.get(), url));
EXPECT_EQ(base::Time(), GetModifiedTime(dir_url));
@@ -2028,28 +1999,28 @@
url = FileSystemURLAppendUTF8(dir_url, "DeleteDirectory_dir");
FileSystemURL file_path(FileSystemURLAppendUTF8(url, "pakeratta"));
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
ofu()->CreateDirectory(context.get(), url, true, true));
created = false;
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
ofu()->EnsureFileExists(context.get(), file_path, &created));
EXPECT_TRUE(created);
ClearTimestamp(dir_url);
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_EMPTY,
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_EMPTY,
ofu()->DeleteDirectory(context.get(), url));
EXPECT_EQ(base::Time(), GetModifiedTime(dir_url));
// delete case.
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
ofu()->DeleteFile(context.get(), file_path));
ClearTimestamp(dir_url);
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->DeleteDirectory(context.get(), url));
+ EXPECT_EQ(base::File::FILE_OK, ofu()->DeleteDirectory(context.get(), url));
EXPECT_NE(base::Time(), GetModifiedTime(dir_url));
}
@@ -2070,27 +2041,27 @@
FileSystemURL url2 = FileSystemURLAppendUTF8(dir, "baz");
scoped_ptr<FileSystemOperationContext> context(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
ofu()->CreateDirectory(context.get(), dir, false, false));
bool created = false;
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
ofu()->EnsureFileExists(context.get(), url1, &created));
EXPECT_TRUE(created);
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
ofu()->CreateDirectory(context.get(), url2, false, false));
base::FilePath file_path;
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
ofu()->GetLocalFilePath(context.get(), url1, &file_path));
EXPECT_FALSE(file_path.empty());
context.reset(NewContext(NULL));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
ofu()->Touch(context.get(), url1,
base::Time::Now() + base::TimeDelta::FromHours(1),
base::Time()));
@@ -2103,9 +2074,9 @@
base::FilePath file_path_each;
while (!(file_path_each = file_enum->Next()).empty()) {
context.reset(NewContext(NULL));
- base::PlatformFileInfo file_info;
+ base::File::Info file_info;
base::FilePath file_path;
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
ofu()->GetFileInfo(context.get(),
FileSystemURL::CreateForTest(
dir.origin(),
@@ -2134,14 +2105,14 @@
bool created;
int64 expected_total_file_size = 0;
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
ofu()->EnsureFileExists(
AllowUsageIncrease(PathCost(from_file))->context(),
from_file, &created));
ASSERT_TRUE(created);
ASSERT_EQ(expected_total_file_size, ComputeTotalFileSize());
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
ofu()->EnsureFileExists(
AllowUsageIncrease(PathCost(obstacle_file))->context(),
obstacle_file, &created));
@@ -2150,7 +2121,7 @@
int64 from_file_size = 1020;
expected_total_file_size += from_file_size;
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
ofu()->Truncate(
AllowUsageIncrease(from_file_size)->context(),
from_file, from_file_size));
@@ -2158,7 +2129,7 @@
int64 obstacle_file_size = 1;
expected_total_file_size += obstacle_file_size;
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
ofu()->Truncate(
AllowUsageIncrease(obstacle_file_size)->context(),
obstacle_file, obstacle_file_size));
@@ -2166,7 +2137,7 @@
int64 to_file1_size = from_file_size;
expected_total_file_size += to_file1_size;
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
ofu()->CopyOrMoveFile(
AllowUsageIncrease(
PathCost(to_file1) + to_file1_size)->context(),
@@ -2175,7 +2146,7 @@
true /* copy */));
ASSERT_EQ(expected_total_file_size, ComputeTotalFileSize());
- ASSERT_EQ(base::PLATFORM_FILE_ERROR_NO_SPACE,
+ ASSERT_EQ(base::File::FILE_ERROR_NO_SPACE,
ofu()->CopyOrMoveFile(
DisallowUsageIncrease(
PathCost(to_file2) + from_file_size)->context(),
@@ -2186,7 +2157,7 @@
int64 old_obstacle_file_size = obstacle_file_size;
obstacle_file_size = from_file_size;
expected_total_file_size += obstacle_file_size - old_obstacle_file_size;
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
ofu()->CopyOrMoveFile(
AllowUsageIncrease(
obstacle_file_size - old_obstacle_file_size)->context(),
@@ -2198,7 +2169,7 @@
int64 old_from_file_size = from_file_size;
from_file_size = old_from_file_size - 1;
expected_total_file_size += from_file_size - old_from_file_size;
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
ofu()->Truncate(
AllowUsageIncrease(
from_file_size - old_from_file_size)->context(),
@@ -2214,7 +2185,7 @@
obstacle_file_size - old_obstacle_file_size);
helper->context()->set_allowed_bytes_growth(
helper->context()->allowed_bytes_growth() - 1);
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
ofu()->CopyOrMoveFile(
helper->context(),
from_file, obstacle_file,
@@ -2231,7 +2202,7 @@
bool created;
int64 expected_total_file_size = 0;
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
ofu()->EnsureFileExists(
AllowUsageIncrease(PathCost(from_file))->context(),
from_file, &created));
@@ -2240,7 +2211,7 @@
int64 from_file_size = 1020;
expected_total_file_size += from_file_size;
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
ofu()->Truncate(
AllowUsageIncrease(from_file_size)->context(),
from_file, from_file_size));
@@ -2248,7 +2219,7 @@
int64 to_file_size ALLOW_UNUSED = from_file_size;
from_file_size = 0;
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
ofu()->CopyOrMoveFile(
AllowUsageIncrease(-PathCost(from_file) +
PathCost(to_file))->context(),
@@ -2257,14 +2228,14 @@
false /* move */));
ASSERT_EQ(expected_total_file_size, ComputeTotalFileSize());
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
ofu()->EnsureFileExists(
AllowUsageIncrease(PathCost(from_file))->context(),
from_file, &created));
ASSERT_TRUE(created);
ASSERT_EQ(expected_total_file_size, ComputeTotalFileSize());
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
ofu()->EnsureFileExists(
AllowUsageIncrease(PathCost(obstacle_file))->context(),
obstacle_file, &created));
@@ -2273,7 +2244,7 @@
from_file_size = 1020;
expected_total_file_size += from_file_size;
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
ofu()->Truncate(
AllowUsageIncrease(from_file_size)->context(),
from_file, from_file_size));
@@ -2281,7 +2252,7 @@
int64 obstacle_file_size = 1;
expected_total_file_size += obstacle_file_size;
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
ofu()->Truncate(
AllowUsageIncrease(1)->context(),
obstacle_file, obstacle_file_size));
@@ -2291,7 +2262,7 @@
obstacle_file_size = from_file_size;
from_file_size = 0;
expected_total_file_size -= old_obstacle_file_size;
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
ofu()->CopyOrMoveFile(
AllowUsageIncrease(
-old_obstacle_file_size - PathCost(from_file))->context(),
@@ -2300,7 +2271,7 @@
false /* move */));
ASSERT_EQ(expected_total_file_size, ComputeTotalFileSize());
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
ofu()->EnsureFileExists(
AllowUsageIncrease(PathCost(from_file))->context(),
from_file, &created));
@@ -2309,7 +2280,7 @@
from_file_size = 10;
expected_total_file_size += from_file_size;
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
ofu()->Truncate(
AllowUsageIncrease(from_file_size)->context(),
from_file, from_file_size));
@@ -2322,7 +2293,7 @@
expected_total_file_size -= old_obstacle_file_size;
scoped_ptr<FileSystemOperationContext> context =
LimitedContext(-old_obstacle_file_size - PathCost(from_file) - 1);
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
ofu()->CopyOrMoveFile(
context.get(), from_file, obstacle_file,
FileSystemOperation::OPTION_NONE,
@@ -2338,58 +2309,58 @@
FileSystemURL dfile2(CreateURLFromUTF8("dir/dfile2"));
bool created;
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
ofu()->EnsureFileExists(
AllowUsageIncrease(PathCost(file))->context(),
file, &created));
ASSERT_TRUE(created);
ASSERT_EQ(0, ComputeTotalFileSize());
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
ofu()->CreateDirectory(
AllowUsageIncrease(PathCost(dir))->context(),
dir, false, false));
ASSERT_EQ(0, ComputeTotalFileSize());
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
ofu()->EnsureFileExists(
AllowUsageIncrease(PathCost(dfile1))->context(),
dfile1, &created));
ASSERT_TRUE(created);
ASSERT_EQ(0, ComputeTotalFileSize());
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
ofu()->EnsureFileExists(
AllowUsageIncrease(PathCost(dfile2))->context(),
dfile2, &created));
ASSERT_TRUE(created);
ASSERT_EQ(0, ComputeTotalFileSize());
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
ofu()->Truncate(
AllowUsageIncrease(340)->context(),
file, 340));
ASSERT_EQ(340, ComputeTotalFileSize());
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
ofu()->Truncate(
AllowUsageIncrease(1020)->context(),
dfile1, 1020));
ASSERT_EQ(1360, ComputeTotalFileSize());
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
ofu()->Truncate(
AllowUsageIncrease(120)->context(),
dfile2, 120));
ASSERT_EQ(1480, ComputeTotalFileSize());
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
ofu()->DeleteFile(
AllowUsageIncrease(-PathCost(file) - 340)->context(),
file));
ASSERT_EQ(1140, ComputeTotalFileSize());
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
AsyncFileTestHelper::Remove(
file_system_context(), dir, true /* recursive */));
ASSERT_EQ(0, ComputeTotalFileSize());
@@ -2401,7 +2372,7 @@
bool created;
// Creating a file.
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
ofu()->EnsureFileExists(
AllowUsageIncrease(PathCost(file))->context(),
file, &created));
@@ -2409,7 +2380,7 @@
ASSERT_EQ(0, ComputeTotalFileSize());
// Opening it, which shouldn't change the usage.
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
ofu()->CreateOrOpen(
AllowUsageIncrease(0)->context(), file,
base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_WRITE,
@@ -2418,13 +2389,13 @@
EXPECT_TRUE(base::ClosePlatformFile(file_handle));
const int length = 33;
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
ofu()->Truncate(
AllowUsageIncrease(length)->context(), file, length));
ASSERT_EQ(length, ComputeTotalFileSize());
// Opening it with CREATE_ALWAYS flag, which should truncate the file size.
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
ofu()->CreateOrOpen(
AllowUsageIncrease(-length)->context(), file,
base::PLATFORM_FILE_CREATE_ALWAYS | base::PLATFORM_FILE_WRITE,
@@ -2433,13 +2404,13 @@
EXPECT_TRUE(base::ClosePlatformFile(file_handle));
// Extending the file again.
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
ofu()->Truncate(
AllowUsageIncrease(length)->context(), file, length));
ASSERT_EQ(length, ComputeTotalFileSize());
// Opening it with TRUNCATED flag, which should truncate the file size.
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
ofu()->CreateOrOpen(
AllowUsageIncrease(-length)->context(), file,
base::PLATFORM_FILE_OPEN_TRUNCATED | base::PLATFORM_FILE_WRITE,
@@ -2473,14 +2444,14 @@
FileSystemURL path_in_file(CreateURLFromUTF8("file/file"));
bool created;
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
ofu()->EnsureFileExists(UnlimitedContext().get(), file, &created));
ASSERT_TRUE(created);
created = false;
base::PlatformFile file_handle = base::kInvalidPlatformFileValue;
int file_flags = base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_WRITE;
- ASSERT_EQ(base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY,
+ ASSERT_EQ(base::File::FILE_ERROR_NOT_A_DIRECTORY,
ofu()->CreateOrOpen(UnlimitedContext().get(),
path_in_file,
file_flags,
@@ -2489,7 +2460,7 @@
ASSERT_FALSE(created);
ASSERT_EQ(base::kInvalidPlatformFileValue, file_handle);
- ASSERT_EQ(base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY,
+ ASSERT_EQ(base::File::FILE_ERROR_NOT_A_DIRECTORY,
ofu()->CreateDirectory(UnlimitedContext().get(),
path_in_file,
false /* exclusive */,
@@ -2503,16 +2474,16 @@
CreateURLFromUTF8("file/child/grandchild"));
bool created;
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
ofu()->EnsureFileExists(UnlimitedContext().get(), file, &created));
ASSERT_TRUE(created);
- ASSERT_EQ(base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY,
+ ASSERT_EQ(base::File::FILE_ERROR_NOT_A_DIRECTORY,
ofu()->CreateDirectory(UnlimitedContext().get(),
path_in_file,
false /* exclusive */,
true /* recursive */));
- ASSERT_EQ(base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY,
+ ASSERT_EQ(base::File::FILE_ERROR_NOT_A_DIRECTORY,
ofu()->CreateDirectory(UnlimitedContext().get(),
path_in_file_in_file,
false /* exclusive */,
diff --git a/content/browser/fileapi/plugin_private_file_system_backend_unittest.cc b/content/browser/fileapi/plugin_private_file_system_backend_unittest.cc
index efd0a77e..7aafff24 100644
--- a/content/browser/fileapi/plugin_private_file_system_backend_unittest.cc
+++ b/content/browser/fileapi/plugin_private_file_system_backend_unittest.cc
@@ -34,8 +34,8 @@
const fileapi::FileSystemType kType = fileapi::kFileSystemTypePluginPrivate;
const std::string kRootName = "pluginprivate";
-void DidOpenFileSystem(base::PlatformFileError* error_out,
- base::PlatformFileError error) {
+void DidOpenFileSystem(base::File::Error* error_out,
+ base::File::Error error) {
*error_out = error;
}
@@ -77,32 +77,32 @@
TEST_F(PluginPrivateFileSystemBackendTest, OpenFileSystemBasic) {
const std::string filesystem_id1 = RegisterFileSystem();
- base::PlatformFileError error = base::PLATFORM_FILE_ERROR_FAILED;
+ base::File::Error error = base::File::FILE_ERROR_FAILED;
backend()->OpenPrivateFileSystem(
kOrigin, kType, filesystem_id1, kPlugin1,
fileapi::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT,
base::Bind(&DidOpenFileSystem, &error));
base::RunLoop().RunUntilIdle();
- ASSERT_EQ(base::PLATFORM_FILE_OK, error);
+ ASSERT_EQ(base::File::FILE_OK, error);
// Run this again with FAIL_IF_NONEXISTENT to see if it succeeds.
const std::string filesystem_id2 = RegisterFileSystem();
- error = base::PLATFORM_FILE_ERROR_FAILED;
+ error = base::File::FILE_ERROR_FAILED;
backend()->OpenPrivateFileSystem(
kOrigin, kType, filesystem_id2, kPlugin1,
fileapi::OPEN_FILE_SYSTEM_FAIL_IF_NONEXISTENT,
base::Bind(&DidOpenFileSystem, &error));
base::RunLoop().RunUntilIdle();
- ASSERT_EQ(base::PLATFORM_FILE_OK, error);
+ ASSERT_EQ(base::File::FILE_OK, error);
const GURL root_url(
fileapi::GetIsolatedFileSystemRootURIString(
kOrigin, filesystem_id1, kRootName));
FileSystemURL file = CreateURL(root_url, "foo");
base::FilePath platform_path;
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
AsyncFileTestHelper::CreateFile(context_.get(), file));
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
AsyncFileTestHelper::GetPlatformPath(context_.get(), file,
&platform_path));
EXPECT_TRUE(base_path().AppendASCII("000").AppendASCII(kPlugin1).IsParent(
@@ -112,22 +112,22 @@
TEST_F(PluginPrivateFileSystemBackendTest, PluginIsolation) {
// Open filesystem for kPlugin1 and kPlugin2.
const std::string filesystem_id1 = RegisterFileSystem();
- base::PlatformFileError error = base::PLATFORM_FILE_ERROR_FAILED;
+ base::File::Error error = base::File::FILE_ERROR_FAILED;
backend()->OpenPrivateFileSystem(
kOrigin, kType, filesystem_id1, kPlugin1,
fileapi::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT,
base::Bind(&DidOpenFileSystem, &error));
base::RunLoop().RunUntilIdle();
- ASSERT_EQ(base::PLATFORM_FILE_OK, error);
+ ASSERT_EQ(base::File::FILE_OK, error);
const std::string filesystem_id2 = RegisterFileSystem();
- error = base::PLATFORM_FILE_ERROR_FAILED;
+ error = base::File::FILE_ERROR_FAILED;
backend()->OpenPrivateFileSystem(
kOrigin, kType, filesystem_id2, kPlugin2,
fileapi::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT,
base::Bind(&DidOpenFileSystem, &error));
base::RunLoop().RunUntilIdle();
- ASSERT_EQ(base::PLATFORM_FILE_OK, error);
+ ASSERT_EQ(base::File::FILE_OK, error);
// Create 'foo' in kPlugin1.
const GURL root_url1(
@@ -135,7 +135,7 @@
kOrigin, filesystem_id1, kRootName));
FileSystemURL file1 = CreateURL(root_url1, "foo");
base::FilePath platform_path;
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
AsyncFileTestHelper::CreateFile(context_.get(), file1));
EXPECT_TRUE(AsyncFileTestHelper::FileExists(
context_.get(), file1, AsyncFileTestHelper::kDontCheckSize));
diff --git a/content/browser/fileapi/recursive_operation_delegate_unittest.cc b/content/browser/fileapi/recursive_operation_delegate_unittest.cc
index 397041f..a96a212 100644
--- a/content/browser/fileapi/recursive_operation_delegate_unittest.cc
+++ b/content/browser/fileapi/recursive_operation_delegate_unittest.cc
@@ -71,13 +71,13 @@
virtual void ProcessDirectory(const FileSystemURL& url,
const StatusCallback& callback) OVERRIDE {
RecordLogEntry(LogEntry::PROCESS_DIRECTORY, url);
- callback.Run(base::PLATFORM_FILE_OK);
+ callback.Run(base::File::FILE_OK);
}
virtual void PostProcessDirectory(const FileSystemURL& url,
const StatusCallback& callback) OVERRIDE {
RecordLogEntry(LogEntry::POST_PROCESS_DIRECTORY, url);
- callback.Run(base::PLATFORM_FILE_OK);
+ callback.Run(base::File::FILE_OK);
}
private:
@@ -89,16 +89,16 @@
}
void DidGetMetadata(const StatusCallback& callback,
- base::PlatformFileError result,
- const base::PlatformFileInfo& file_info) {
- if (result != base::PLATFORM_FILE_OK) {
+ base::File::Error result,
+ const base::File::Info& file_info) {
+ if (result != base::File::FILE_OK) {
callback.Run(result);
return;
}
callback.Run(file_info.is_directory ?
- base::PLATFORM_FILE_ERROR_NOT_A_FILE :
- base::PLATFORM_FILE_OK);
+ base::File::FILE_ERROR_NOT_A_FILE :
+ base::File::FILE_OK);
}
FileSystemURL root_;
@@ -109,8 +109,8 @@
DISALLOW_COPY_AND_ASSIGN(LoggingRecursiveOperation);
};
-void ReportStatus(base::PlatformFileError* out_error,
- base::PlatformFileError error) {
+void ReportStatus(base::File::Error* out_error,
+ base::File::Error error) {
DCHECK(out_error);
*out_error = error;
}
@@ -161,7 +161,7 @@
FileSystemURL CreateFile(const std::string& path) {
FileSystemURL url = URLForPath(path);
bool created = false;
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_util()->EnsureFileExists(NewContext().get(),
url, &created));
EXPECT_TRUE(created);
@@ -170,7 +170,7 @@
FileSystemURL CreateDirectory(const std::string& path) {
FileSystemURL url = URLForPath(path);
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
file_util()->CreateDirectory(NewContext().get(), url,
false /* exclusive */, true));
return url;
@@ -187,7 +187,7 @@
TEST_F(RecursiveOperationDelegateTest, RootIsFile) {
FileSystemURL src_file(CreateFile("src"));
- base::PlatformFileError error = base::PLATFORM_FILE_ERROR_FAILED;
+ base::File::Error error = base::File::FILE_ERROR_FAILED;
scoped_ptr<FileSystemOperationContext> context = NewContext();
scoped_ptr<LoggingRecursiveOperation> operation(
new LoggingRecursiveOperation(
@@ -195,7 +195,7 @@
base::Bind(&ReportStatus, &error)));
operation->RunRecursively();
base::RunLoop().RunUntilIdle();
- ASSERT_EQ(base::PLATFORM_FILE_OK, error);
+ ASSERT_EQ(base::File::FILE_OK, error);
const std::vector<LoggingRecursiveOperation::LogEntry>& log_entries =
operation->log_entries();
@@ -212,7 +212,7 @@
FileSystemURL src_file2(CreateFile("src/dir1/file2"));
FileSystemURL src_file3(CreateFile("src/dir1/file3"));
- base::PlatformFileError error = base::PLATFORM_FILE_ERROR_FAILED;
+ base::File::Error error = base::File::FILE_ERROR_FAILED;
scoped_ptr<FileSystemOperationContext> context = NewContext();
scoped_ptr<LoggingRecursiveOperation> operation(
new LoggingRecursiveOperation(
@@ -220,7 +220,7 @@
base::Bind(&ReportStatus, &error)));
operation->RunRecursively();
base::RunLoop().RunUntilIdle();
- ASSERT_EQ(base::PLATFORM_FILE_OK, error);
+ ASSERT_EQ(base::File::FILE_OK, error);
const std::vector<LoggingRecursiveOperation::LogEntry>& log_entries =
operation->log_entries();
@@ -268,7 +268,7 @@
FileSystemURL src_file1(CreateFile("src/file1"));
FileSystemURL src_file2(CreateFile("src/dir1/file2"));
- base::PlatformFileError error = base::PLATFORM_FILE_ERROR_FAILED;
+ base::File::Error error = base::File::FILE_ERROR_FAILED;
scoped_ptr<FileSystemOperationContext> context = NewContext();
scoped_ptr<LoggingRecursiveOperation> operation(
new LoggingRecursiveOperation(
@@ -279,7 +279,7 @@
// Invoke Cancel(), after 5 times message posting.
CallCancelLater(operation.get(), 5);
base::RunLoop().RunUntilIdle();
- ASSERT_EQ(base::PLATFORM_FILE_ERROR_ABORT, error);
+ ASSERT_EQ(base::File::FILE_ERROR_ABORT, error);
}
} // namespace content
diff --git a/content/browser/fileapi/sandbox_file_system_backend_unittest.cc b/content/browser/fileapi/sandbox_file_system_backend_unittest.cc
index 8b695ec..caca5b8 100644
--- a/content/browser/fileapi/sandbox_file_system_backend_unittest.cc
+++ b/content/browser/fileapi/sandbox_file_system_backend_unittest.cc
@@ -69,10 +69,10 @@
"000" PS "p", NULL },
};
-void DidOpenFileSystem(base::PlatformFileError* error_out,
+void DidOpenFileSystem(base::File::Error* error_out,
const GURL& origin_url,
const std::string& name,
- base::PlatformFileError error) {
+ base::File::Error error) {
*error_out = error;
}
@@ -116,12 +116,12 @@
fileapi::FileSystemType type,
fileapi::OpenFileSystemMode mode,
base::FilePath* root_path) {
- base::PlatformFileError error = base::PLATFORM_FILE_OK;
+ base::File::Error error = base::File::FILE_OK;
backend_->OpenFileSystem(
origin_url, type, mode,
base::Bind(&DidOpenFileSystem, &error));
base::RunLoop().RunUntilIdle();
- if (error != base::PLATFORM_FILE_OK)
+ if (error != base::File::FILE_OK)
return false;
base::FilePath returned_root_path =
delegate_->GetBaseDirectoryForOriginAndType(
diff --git a/content/browser/fileapi/transient_file_util_unittest.cc b/content/browser/fileapi/transient_file_util_unittest.cc
index 66d4ad5..4df102a 100644
--- a/content/browser/fileapi/transient_file_util_unittest.cc
+++ b/content/browser/fileapi/transient_file_util_unittest.cc
@@ -83,8 +83,8 @@
CreateAndRegisterTemporaryFile(&temp_url, &temp_path);
- base::PlatformFileError error;
- base::PlatformFileInfo file_info;
+ base::File::Error error;
+ base::File::Info file_info;
base::FilePath path;
// Make sure the file is there.
@@ -100,13 +100,13 @@
&error,
&file_info,
&path);
- ASSERT_EQ(base::PLATFORM_FILE_OK, error);
+ ASSERT_EQ(base::File::FILE_OK, error);
ASSERT_EQ(temp_path, path);
ASSERT_FALSE(file_info.is_directory);
// The file should be still there.
ASSERT_TRUE(base::PathExists(temp_path));
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
file_util()->GetFileInfo(NewOperationContext().get(),
temp_url, &file_info, &path));
ASSERT_EQ(temp_path, path);
@@ -118,7 +118,7 @@
// Now the temporary file and the transient filesystem must be gone too.
ASSERT_FALSE(base::PathExists(temp_path));
- ASSERT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND,
+ ASSERT_EQ(base::File::FILE_ERROR_NOT_FOUND,
file_util()->GetFileInfo(NewOperationContext().get(),
temp_url, &file_info, &path));
}
diff --git a/content/browser/fileapi/upload_file_system_file_element_reader_unittest.cc b/content/browser/fileapi/upload_file_system_file_element_reader_unittest.cc
index b0973d3..7450ef27 100644
--- a/content/browser/fileapi/upload_file_system_file_element_reader_unittest.cc
+++ b/content/browser/fileapi/upload_file_system_file_element_reader_unittest.cc
@@ -95,12 +95,12 @@
kFileSystemType,
base::FilePath().AppendASCII(filename));
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
AsyncFileTestHelper::CreateFileWithData(
file_system_context_, url, buf, buf_size));
- base::PlatformFileInfo file_info;
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ base::File::Info file_info;
+ ASSERT_EQ(base::File::FILE_OK,
AsyncFileTestHelper::GetMetadata(
file_system_context_, url, &file_info));
*modification_time = file_info.last_modified;
@@ -108,8 +108,8 @@
void OnOpenFileSystem(const GURL& root,
const std::string& name,
- base::PlatformFileError result) {
- ASSERT_EQ(base::PLATFORM_FILE_OK, result);
+ base::File::Error result) {
+ ASSERT_EQ(base::File::FILE_OK, result);
ASSERT_TRUE(root.is_valid());
file_system_root_url_ = root;
}
diff --git a/content/browser/loader/redirect_to_file_resource_handler.cc b/content/browser/loader/redirect_to_file_resource_handler.cc
index 37372af..74848b6 100644
--- a/content/browser/loader/redirect_to_file_resource_handler.cc
+++ b/content/browser/loader/redirect_to_file_resource_handler.cc
@@ -163,7 +163,7 @@
}
void RedirectToFileResourceHandler::DidCreateTemporaryFile(
- base::PlatformFileError /*error_code*/,
+ base::File::Error /*error_code*/,
base::PassPlatformFile file_handle,
const base::FilePath& file_path) {
deletable_file_ = ShareableFileReference::GetOrCreate(
diff --git a/content/browser/loader/redirect_to_file_resource_handler.h b/content/browser/loader/redirect_to_file_resource_handler.h
index 3d62835e..f83dd545 100644
--- a/content/browser/loader/redirect_to_file_resource_handler.h
+++ b/content/browser/loader/redirect_to_file_resource_handler.h
@@ -5,6 +5,7 @@
#ifndef CONTENT_BROWSER_LOADER_REDIRECT_TO_FILE_RESOURCE_HANDLER_H_
#define CONTENT_BROWSER_LOADER_REDIRECT_TO_FILE_RESOURCE_HANDLER_H_
+#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
@@ -56,7 +57,7 @@
bool* defer) OVERRIDE;
private:
- void DidCreateTemporaryFile(base::PlatformFileError error_code,
+ void DidCreateTemporaryFile(base::File::Error error_code,
base::PassPlatformFile file_handle,
const base::FilePath& file_path);
void DidWriteToFile(int result);
diff --git a/content/browser/renderer_host/file_utilities_message_filter.cc b/content/browser/renderer_host/file_utilities_message_filter.cc
index 85edc34a..577653e 100644
--- a/content/browser/renderer_host/file_utilities_message_filter.cc
+++ b/content/browser/renderer_host/file_utilities_message_filter.cc
@@ -36,10 +36,10 @@
void FileUtilitiesMessageFilter::OnGetFileInfo(
const base::FilePath& path,
- base::PlatformFileInfo* result,
- base::PlatformFileError* status) {
- *result = base::PlatformFileInfo();
- *status = base::PLATFORM_FILE_OK;
+ base::File::Info* result,
+ base::File::Error* status) {
+ *result = base::File::Info();
+ *status = base::File::FILE_OK;
// Get file metadata only when the child process has been granted
// permission to read the file.
@@ -48,9 +48,8 @@
return;
}
- // TODO(rvargas): convert this code to use base::File.
- if (!base::GetFileInfo(path, reinterpret_cast<base::File::Info*>(result)))
- *status = base::PLATFORM_FILE_ERROR_FAILED;
+ if (!base::GetFileInfo(path, result))
+ *status = base::File::FILE_ERROR_FAILED;
}
} // namespace content
diff --git a/content/browser/renderer_host/file_utilities_message_filter.h b/content/browser/renderer_host/file_utilities_message_filter.h
index 948e6c2..e067f2e 100644
--- a/content/browser/renderer_host/file_utilities_message_filter.h
+++ b/content/browser/renderer_host/file_utilities_message_filter.h
@@ -6,13 +6,9 @@
#define CONTENT_BROWSER_RENDERER_HOST_FILE_UTILITIES_MESSAGE_FILTER_H_
#include "base/basictypes.h"
+#include "base/files/file.h"
#include "base/files/file_path.h"
#include "content/public/browser/browser_message_filter.h"
-#include "ipc/ipc_platform_file.h"
-
-namespace base {
-struct PlatformFileInfo;
-}
namespace IPC {
class Message;
@@ -34,11 +30,11 @@
virtual ~FileUtilitiesMessageFilter();
typedef void (*FileInfoWriteFunc)(IPC::Message* reply_msg,
- const base::PlatformFileInfo& file_info);
+ const base::File::Info& file_info);
void OnGetFileInfo(const base::FilePath& path,
- base::PlatformFileInfo* result,
- base::PlatformFileError* status);
+ base::File::Info* result,
+ base::File::Error* status);
// The ID of this process.
int process_id_;
diff --git a/content/browser/renderer_host/pepper/pepper_external_file_ref_backend.cc b/content/browser/renderer_host/pepper/pepper_external_file_ref_backend.cc
index 4cea3d8..72eecd49 100644
--- a/content/browser/renderer_host/pepper/pepper_external_file_ref_backend.cc
+++ b/content/browser/renderer_host/pepper/pepper_external_file_ref_backend.cc
@@ -133,21 +133,21 @@
void PepperExternalFileRefBackend::DidFinish(
ppapi::host::ReplyMessageContext reply_context,
const IPC::Message& msg,
- base::PlatformFileError error) {
- reply_context.params.set_result(ppapi::PlatformFileErrorToPepperError(error));
+ base::File::Error error) {
+ reply_context.params.set_result(ppapi::FileErrorToPepperError(error));
host_->SendReply(reply_context, msg);
}
void PepperExternalFileRefBackend::GetMetadataComplete(
ppapi::host::ReplyMessageContext reply_context,
- const base::PlatformFileError error,
- const base::PlatformFileInfo& file_info) {
- reply_context.params.set_result(ppapi::PlatformFileErrorToPepperError(error));
+ const base::File::Error error,
+ const base::File::Info& file_info) {
+ reply_context.params.set_result(ppapi::FileErrorToPepperError(error));
PP_FileInfo pp_file_info;
- if (error == base::PLATFORM_FILE_OK) {
- ppapi::PlatformFileInfoToPepperFileInfo(
- file_info, PP_FILESYSTEMTYPE_EXTERNAL, &pp_file_info);
+ if (error == base::File::FILE_OK) {
+ ppapi::FileInfoToPepperFileInfo(file_info, PP_FILESYSTEMTYPE_EXTERNAL,
+ &pp_file_info);
} else {
memset(&pp_file_info, 0, sizeof(pp_file_info));
}
diff --git a/content/browser/renderer_host/pepper/pepper_external_file_ref_backend.h b/content/browser/renderer_host/pepper/pepper_external_file_ref_backend.h
index 70cacb5..31dc45a9 100644
--- a/content/browser/renderer_host/pepper/pepper_external_file_ref_backend.h
+++ b/content/browser/renderer_host/pepper/pepper_external_file_ref_backend.h
@@ -7,6 +7,7 @@
#include <string>
+#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/memory/ref_counted.h"
#include "base/task_runner.h"
@@ -52,13 +53,13 @@
// Generic reply callback.
void DidFinish(ppapi::host::ReplyMessageContext reply_context,
const IPC::Message& msg,
- base::PlatformFileError error);
+ base::File::Error error);
// Operation specific callbacks.
void GetMetadataComplete(
ppapi::host::ReplyMessageContext reply_context,
- base::PlatformFileError error,
- const base::PlatformFileInfo& file_info);
+ base::File::Error error,
+ const base::File::Info& file_info);
ppapi::host::PpapiHost* host_;
base::FilePath path_;
diff --git a/content/browser/renderer_host/pepper/pepper_file_io_host.cc b/content/browser/renderer_host/pepper/pepper_file_io_host.cc
index be7640b..e66219b 100644
--- a/content/browser/renderer_host/pepper/pepper_file_io_host.cc
+++ b/content/browser/renderer_host/pepper/pepper_file_io_host.cc
@@ -225,10 +225,10 @@
void PepperFileIOHost::DidOpenInternalFile(
ppapi::host::ReplyMessageContext reply_context,
- base::PlatformFileError result,
+ base::File::Error result,
base::PlatformFile file,
const base::Closure& on_close_callback) {
- if (result == base::PLATFORM_FILE_OK) {
+ if (result == base::File::FILE_OK) {
on_close_callback_ = on_close_callback;
if (FileOpenForWrite(open_flags_) && file_system_host_->ChecksQuota()) {
@@ -360,11 +360,11 @@
max_written_offset_ = max_written_offset;
ExecutePlatformOpenFileCallback(
- reply_context, base::PLATFORM_FILE_OK, base::PassPlatformFile(&file),
+ reply_context, base::File::FILE_OK, base::PassPlatformFile(&file),
true);
}
-void PepperFileIOHost::DidCloseFile(base::PlatformFileError error) {
+void PepperFileIOHost::DidCloseFile(base::File::Error error) {
// Silently ignore if we fail to close the file.
if (!on_close_callback_.is_null()) {
on_close_callback_.Run();
@@ -409,19 +409,19 @@
void PepperFileIOHost::ExecutePlatformGeneralCallback(
ppapi::host::ReplyMessageContext reply_context,
- base::PlatformFileError error_code) {
+ base::File::Error error_code) {
reply_context.params.set_result(
- ppapi::PlatformFileErrorToPepperError(error_code));
+ ppapi::FileErrorToPepperError(error_code));
host()->SendReply(reply_context, PpapiPluginMsg_FileIO_GeneralReply());
state_manager_.SetOperationFinished();
}
void PepperFileIOHost::ExecutePlatformOpenFileCallback(
ppapi::host::ReplyMessageContext reply_context,
- base::PlatformFileError error_code,
+ base::File::Error error_code,
base::PassPlatformFile file,
bool unused_created) {
- int32_t pp_error = ppapi::PlatformFileErrorToPepperError(error_code);
+ int32_t pp_error = ppapi::FileErrorToPepperError(error_code);
DCHECK(file_ == base::kInvalidPlatformFileValue);
file_ = file.ReleaseValue();
diff --git a/content/browser/renderer_host/pepper/pepper_file_io_host.h b/content/browser/renderer_host/pepper/pepper_file_io_host.h
index 4fa4bc2..76991a9 100644
--- a/content/browser/renderer_host/pepper/pepper_file_io_host.h
+++ b/content/browser/renderer_host/pepper/pepper_file_io_host.h
@@ -9,6 +9,7 @@
#include "base/basictypes.h"
#include "base/callback_forward.h"
+#include "base/files/file.h"
#include "base/memory/weak_ptr.h"
#include "base/platform_file.h"
#include "content/browser/renderer_host/pepper/browser_ppapi_host_impl.h"
@@ -28,7 +29,7 @@
class PepperFileIOHost : public ppapi::host::ResourceHost,
public base::SupportsWeakPtr<PepperFileIOHost> {
public:
- typedef base::Callback<void (base::PlatformFileError)>
+ typedef base::Callback<void (base::File::Error)>
NotifyCloseFileCallback;
PepperFileIOHost(BrowserPpapiHostImpl* host,
@@ -66,16 +67,16 @@
ppapi::host::ReplyMessageContext reply_context,
bool plugin_allowed);
- // Callback handlers. These mostly convert the PlatformFileError to the
+ // Callback handlers. These mostly convert the File::Error to the
// PP_Error code and send back the reply. Note that the argument
// ReplyMessageContext is copied so that we have a closure containing all
// necessary information to reply.
void ExecutePlatformGeneralCallback(
ppapi::host::ReplyMessageContext reply_context,
- base::PlatformFileError error_code);
+ base::File::Error error_code);
void ExecutePlatformOpenFileCallback(
ppapi::host::ReplyMessageContext reply_context,
- base::PlatformFileError error_code,
+ base::File::Error error_code,
base::PassPlatformFile file,
bool unused_created);
@@ -85,7 +86,7 @@
UIThreadStuff ui_thread_stuff);
void DidOpenInternalFile(
ppapi::host::ReplyMessageContext reply_context,
- base::PlatformFileError result,
+ base::File::Error result,
base::PlatformFile file,
const base::Closure& on_close_callback);
void GotResolvedRenderProcessId(
@@ -100,7 +101,7 @@
bool CallSetLength(ppapi::host::ReplyMessageContext reply_context,
int64_t length);
- void DidCloseFile(base::PlatformFileError error);
+ void DidCloseFile(base::File::Error error);
void SendOpenErrorReply(ppapi::host::ReplyMessageContext reply_context);
diff --git a/content/browser/renderer_host/pepper/pepper_file_system_browser_host.cc b/content/browser/renderer_host/pepper/pepper_file_system_browser_host.cc
index 89d7d68..0430b6b 100644
--- a/content/browser/renderer_host/pepper/pepper_file_system_browser_host.cc
+++ b/content/browser/renderer_host/pepper/pepper_file_system_browser_host.cc
@@ -220,7 +220,7 @@
scoped_refptr<fileapi::FileSystemContext> file_system_context) {
if (!file_system_context.get()) {
OpenFileSystemComplete(
- reply_context, GURL(), std::string(), base::PLATFORM_FILE_ERROR_FAILED);
+ reply_context, GURL(), std::string(), base::File::FILE_ERROR_FAILED);
return;
}
@@ -239,8 +239,8 @@
ppapi::host::ReplyMessageContext reply_context,
const GURL& root,
const std::string& /* unused */,
- base::PlatformFileError error) {
- int32 pp_error = ppapi::PlatformFileErrorToPepperError(error);
+ base::File::Error error) {
+ int32 pp_error = ppapi::FileErrorToPepperError(error);
if (pp_error == PP_OK) {
opened_ = true;
root_url_ = root;
@@ -319,8 +319,8 @@
void PepperFileSystemBrowserHost::OpenPluginPrivateFileSystemComplete(
ppapi::host::ReplyMessageContext reply_context,
const std::string& fsid,
- base::PlatformFileError error) {
- int32 pp_error = ppapi::PlatformFileErrorToPepperError(error);
+ base::File::Error error) {
+ int32 pp_error = ppapi::FileErrorToPepperError(error);
if (pp_error == PP_OK)
opened_ = true;
SendReplyForIsolatedFileSystem(reply_context, fsid, pp_error);
diff --git a/content/browser/renderer_host/pepper/pepper_file_system_browser_host.h b/content/browser/renderer_host/pepper/pepper_file_system_browser_host.h
index 6194a757..30b9df9 100644
--- a/content/browser/renderer_host/pepper/pepper_file_system_browser_host.h
+++ b/content/browser/renderer_host/pepper/pepper_file_system_browser_host.h
@@ -90,7 +90,7 @@
ppapi::host::ReplyMessageContext reply_context,
const GURL& root,
const std::string& name,
- base::PlatformFileError error);
+ base::File::Error error);
void OpenIsolatedFileSystem(
ppapi::host::ReplyMessageContext reply_context,
const std::string& fsid,
@@ -103,7 +103,7 @@
void OpenPluginPrivateFileSystemComplete(
ppapi::host::ReplyMessageContext reply_context,
const std::string& fsid,
- base::PlatformFileError error);
+ base::File::Error error);
int32_t OnHostMsgOpen(
ppapi::host::HostMessageContext* context,
diff --git a/content/browser/renderer_host/pepper/pepper_flash_file_message_filter.cc b/content/browser/renderer_host/pepper/pepper_flash_file_message_filter.cc
index c3ec26c..cc6fc57 100644
--- a/content/browser/renderer_host/pepper/pepper_flash_file_message_filter.cc
+++ b/content/browser/renderer_host/pepper/pepper_flash_file_message_filter.cc
@@ -113,22 +113,23 @@
path,
base::Bind(&CanOpenWithPepperFlags, pp_open_flags));
if (full_path.empty()) {
- return ppapi::PlatformFileErrorToPepperError(
- base::PLATFORM_FILE_ERROR_ACCESS_DENIED);
+ return ppapi::FileErrorToPepperError(
+ base::File::FILE_ERROR_ACCESS_DENIED);
}
int platform_file_flags = 0;
if (!ppapi::PepperFileOpenFlagsToPlatformFileFlags(
pp_open_flags, &platform_file_flags)) {
- return base::PLATFORM_FILE_ERROR_FAILED;
+ return base::File::FILE_ERROR_FAILED;
}
+ // TODO(rvargas): Convert this code to base::File.
base::PlatformFileError error = base::PLATFORM_FILE_ERROR_FAILED;
base::PlatformFile file_handle = base::CreatePlatformFile(
full_path, platform_file_flags, NULL, &error);
if (error != base::PLATFORM_FILE_OK) {
DCHECK_EQ(file_handle, base::kInvalidPlatformFileValue);
- return ppapi::PlatformFileErrorToPepperError(error);
+ return ppapi::FileErrorToPepperError(static_cast<base::File::Error>(error));
}
// Make sure we didn't try to open a directory: directory fd shouldn't be
@@ -137,8 +138,8 @@
if (!base::GetPlatformFileInfo(file_handle, &info) || info.is_directory) {
// When in doubt, throw it out.
base::ClosePlatformFile(file_handle);
- return ppapi::PlatformFileErrorToPepperError(
- base::PLATFORM_FILE_ERROR_ACCESS_DENIED);
+ return ppapi::FileErrorToPepperError(
+ base::File::FILE_ERROR_ACCESS_DENIED);
}
IPC::PlatformFileForTransit file = IPC::GetFileHandleForProcess(file_handle,
@@ -160,13 +161,13 @@
base::FilePath to_full_path = ValidateAndConvertPepperFilePath(
to_path, base::Bind(&CanCreateReadWrite));
if (from_full_path.empty() || to_full_path.empty()) {
- return ppapi::PlatformFileErrorToPepperError(
- base::PLATFORM_FILE_ERROR_ACCESS_DENIED);
+ return ppapi::FileErrorToPepperError(
+ base::File::FILE_ERROR_ACCESS_DENIED);
}
bool result = base::Move(from_full_path, to_full_path);
- return ppapi::PlatformFileErrorToPepperError(result ?
- base::PLATFORM_FILE_OK : base::PLATFORM_FILE_ERROR_ACCESS_DENIED);
+ return ppapi::FileErrorToPepperError(result ?
+ base::File::FILE_OK : base::File::FILE_ERROR_ACCESS_DENIED);
}
int32_t PepperFlashFileMessageFilter::OnDeleteFileOrDir(
@@ -176,13 +177,13 @@
base::FilePath full_path = ValidateAndConvertPepperFilePath(
path, base::Bind(&CanCreateReadWrite));
if (full_path.empty()) {
- return ppapi::PlatformFileErrorToPepperError(
- base::PLATFORM_FILE_ERROR_ACCESS_DENIED);
+ return ppapi::FileErrorToPepperError(
+ base::File::FILE_ERROR_ACCESS_DENIED);
}
bool result = base::DeleteFile(full_path, recursive);
- return ppapi::PlatformFileErrorToPepperError(result ?
- base::PLATFORM_FILE_OK : base::PLATFORM_FILE_ERROR_ACCESS_DENIED);
+ return ppapi::FileErrorToPepperError(result ?
+ base::File::FILE_OK : base::File::FILE_ERROR_ACCESS_DENIED);
}
int32_t PepperFlashFileMessageFilter::OnCreateDir(
ppapi::host::HostMessageContext* context,
@@ -190,13 +191,13 @@
base::FilePath full_path = ValidateAndConvertPepperFilePath(
path, base::Bind(&CanCreateReadWrite));
if (full_path.empty()) {
- return ppapi::PlatformFileErrorToPepperError(
- base::PLATFORM_FILE_ERROR_ACCESS_DENIED);
+ return ppapi::FileErrorToPepperError(
+ base::File::FILE_ERROR_ACCESS_DENIED);
}
bool result = base::CreateDirectory(full_path);
- return ppapi::PlatformFileErrorToPepperError(result ?
- base::PLATFORM_FILE_OK : base::PLATFORM_FILE_ERROR_ACCESS_DENIED);
+ return ppapi::FileErrorToPepperError(result ?
+ base::File::FILE_OK : base::File::FILE_ERROR_ACCESS_DENIED);
}
int32_t PepperFlashFileMessageFilter::OnQueryFile(
@@ -205,17 +206,15 @@
base::FilePath full_path = ValidateAndConvertPepperFilePath(
path, base::Bind(&CanRead));
if (full_path.empty()) {
- return ppapi::PlatformFileErrorToPepperError(
- base::PLATFORM_FILE_ERROR_ACCESS_DENIED);
+ return ppapi::FileErrorToPepperError(
+ base::File::FILE_ERROR_ACCESS_DENIED);
}
- // TODO(rvargas): convert this code to use base::File::Info.
- base::PlatformFileInfo info;
- bool result = base::GetFileInfo(full_path,
- reinterpret_cast<base::File::Info*>(&info));
+ base::File::Info info;
+ bool result = base::GetFileInfo(full_path, &info);
context->reply_msg = PpapiPluginMsg_FlashFile_QueryFileReply(info);
- return ppapi::PlatformFileErrorToPepperError(result ?
- base::PLATFORM_FILE_OK : base::PLATFORM_FILE_ERROR_ACCESS_DENIED);
+ return ppapi::FileErrorToPepperError(result ?
+ base::File::FILE_OK : base::File::FILE_ERROR_ACCESS_DENIED);
}
int32_t PepperFlashFileMessageFilter::OnGetDirContents(
@@ -224,8 +223,8 @@
base::FilePath full_path = ValidateAndConvertPepperFilePath(
path, base::Bind(&CanRead));
if (full_path.empty()) {
- return ppapi::PlatformFileErrorToPepperError(
- base::PLATFORM_FILE_ERROR_ACCESS_DENIED);
+ return ppapi::FileErrorToPepperError(
+ base::File::FILE_ERROR_ACCESS_DENIED);
}
ppapi::DirContents contents;
@@ -256,27 +255,27 @@
if (validated_dir_path.empty() ||
(!base::DirectoryExists(validated_dir_path) &&
!base::CreateDirectory(validated_dir_path))) {
- return ppapi::PlatformFileErrorToPepperError(
- base::PLATFORM_FILE_ERROR_ACCESS_DENIED);
+ return ppapi::FileErrorToPepperError(
+ base::File::FILE_ERROR_ACCESS_DENIED);
}
base::FilePath file_path;
if (!base::CreateTemporaryFileInDir(validated_dir_path, &file_path)) {
- return ppapi::PlatformFileErrorToPepperError(
- base::PLATFORM_FILE_ERROR_FAILED);
+ return ppapi::FileErrorToPepperError(
+ base::File::FILE_ERROR_FAILED);
}
+ // TODO(rvargas): Convert this code to base::File.
base::PlatformFileError error = base::PLATFORM_FILE_ERROR_FAILED;
base::PlatformFile file_handle = base::CreatePlatformFile(
file_path,
base::PLATFORM_FILE_CREATE_ALWAYS | base::PLATFORM_FILE_READ |
base::PLATFORM_FILE_WRITE | base::PLATFORM_FILE_TEMPORARY |
- base::PLATFORM_FILE_DELETE_ON_CLOSE,
- NULL, &error);
+ base::PLATFORM_FILE_DELETE_ON_CLOSE, NULL, &error);
if (error != base::PLATFORM_FILE_OK) {
DCHECK_EQ(file_handle, base::kInvalidPlatformFileValue);
- return ppapi::PlatformFileErrorToPepperError(error);
+ return ppapi::FileErrorToPepperError(static_cast<base::File::Error>(error));
}
IPC::PlatformFileForTransit file = IPC::GetFileHandleForProcess(file_handle,
diff --git a/content/browser/renderer_host/pepper/pepper_internal_file_ref_backend.cc b/content/browser/renderer_host/pepper/pepper_internal_file_ref_backend.cc
index 3d19146..79c312d 100644
--- a/content/browser/renderer_host/pepper/pepper_internal_file_ref_backend.cc
+++ b/content/browser/renderer_host/pepper/pepper_internal_file_ref_backend.cc
@@ -86,8 +86,8 @@
void PepperInternalFileRefBackend::DidFinish(
ppapi::host::ReplyMessageContext context,
const IPC::Message& msg,
- base::PlatformFileError error) {
- context.params.set_result(ppapi::PlatformFileErrorToPepperError(error));
+ base::File::Error error) {
+ context.params.set_result(ppapi::FileErrorToPepperError(error));
host_->SendReply(context, msg);
}
@@ -179,13 +179,13 @@
void PepperInternalFileRefBackend::GetMetadataComplete(
ppapi::host::ReplyMessageContext reply_context,
- base::PlatformFileError error,
- const base::PlatformFileInfo& file_info) {
- reply_context.params.set_result(ppapi::PlatformFileErrorToPepperError(error));
+ base::File::Error error,
+ const base::File::Info& file_info) {
+ reply_context.params.set_result(ppapi::FileErrorToPepperError(error));
PP_FileInfo pp_file_info;
- if (error == base::PLATFORM_FILE_OK)
- ppapi::PlatformFileInfoToPepperFileInfo(file_info, fs_type_, &pp_file_info);
+ if (error == base::File::FILE_OK)
+ ppapi::FileInfoToPepperFileInfo(file_info, fs_type_, &pp_file_info);
else
memset(&pp_file_info, 0, sizeof(pp_file_info));
@@ -208,17 +208,17 @@
void PepperInternalFileRefBackend::ReadDirectoryComplete(
ppapi::host::ReplyMessageContext context,
- base::PlatformFileError error,
+ base::File::Error error,
const fileapi::FileSystemOperation::FileEntryList& file_list,
bool has_more) {
// The current filesystem backend always returns false.
DCHECK(!has_more);
- context.params.set_result(ppapi::PlatformFileErrorToPepperError(error));
+ context.params.set_result(ppapi::FileErrorToPepperError(error));
std::vector<ppapi::FileRefCreateInfo> infos;
std::vector<PP_FileType> file_types;
- if (error == base::PLATFORM_FILE_OK && fs_host_.get()) {
+ if (error == base::File::FILE_OK && fs_host_.get()) {
std::string dir_path = path_;
if (dir_path.empty() || dir_path[dir_path.size() - 1] != '/')
dir_path += '/';
diff --git a/content/browser/renderer_host/pepper/pepper_internal_file_ref_backend.h b/content/browser/renderer_host/pepper/pepper_internal_file_ref_backend.h
index f75e32a..0e70270b 100644
--- a/content/browser/renderer_host/pepper/pepper_internal_file_ref_backend.h
+++ b/content/browser/renderer_host/pepper/pepper_internal_file_ref_backend.h
@@ -56,16 +56,16 @@
// Generic reply callback.
void DidFinish(ppapi::host::ReplyMessageContext reply_context,
const IPC::Message& msg,
- base::PlatformFileError error);
+ base::File::Error error);
// Operation specific callbacks.
void GetMetadataComplete(
ppapi::host::ReplyMessageContext reply_context,
- base::PlatformFileError error,
- const base::PlatformFileInfo& file_info);
+ base::File::Error error,
+ const base::File::Info& file_info);
void ReadDirectoryComplete(
ppapi::host::ReplyMessageContext context,
- base::PlatformFileError error,
+ base::File::Error error,
const fileapi::FileSystemOperation::FileEntryList& file_list,
bool has_more);
diff --git a/content/browser/renderer_host/pepper/quota_reservation.cc b/content/browser/renderer_host/pepper/quota_reservation.cc
index 0b0b3c1..2dd5caab 100644
--- a/content/browser/renderer_host/pepper/quota_reservation.cc
+++ b/content/browser/renderer_host/pepper/quota_reservation.cc
@@ -53,10 +53,10 @@
const fileapi::FileSystemURL& url) {
base::FilePath platform_file_path;
if (file_system_context_) {
- base::PlatformFileError error =
+ base::File::Error error =
file_system_context_->operation_runner()->SyncGetPlatformPath(
url, &platform_file_path);
- if (error != base::PLATFORM_FILE_OK) {
+ if (error != base::File::FILE_OK) {
NOTREACHED();
return 0;
}
@@ -120,7 +120,7 @@
void QuotaReservation::GotReservedQuota(
const ReserveQuotaCallback& callback,
- base::PlatformFileError error) {
+ base::File::Error error) {
ppapi::FileSizeMap max_written_offsets;
for (FileMap::iterator it = files_.begin(); it != files_.end(); ++ it) {
max_written_offsets.insert(
diff --git a/content/browser/renderer_host/pepper/quota_reservation.h b/content/browser/renderer_host/pepper/quota_reservation.h
index 700bb63..ddc5e29 100644
--- a/content/browser/renderer_host/pepper/quota_reservation.h
+++ b/content/browser/renderer_host/pepper/quota_reservation.h
@@ -80,7 +80,7 @@
~QuotaReservation();
void GotReservedQuota(const ReserveQuotaCallback& callback,
- base::PlatformFileError error);
+ base::File::Error error);
void DeleteOnCorrectThread() const;
diff --git a/content/browser/renderer_host/pepper/quota_reservation_unittest.cc b/content/browser/renderer_host/pepper/quota_reservation_unittest.cc
index 3a07cbb..58305eb 100644
--- a/content/browser/renderer_host/pepper/quota_reservation_unittest.cc
+++ b/content/browser/renderer_host/pepper/quota_reservation_unittest.cc
@@ -7,6 +7,7 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/file_util.h"
+#include "base/files/file.h"
#include "base/files/scoped_temp_dir.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
@@ -42,7 +43,7 @@
const QuotaReservationManager::ReserveQuotaCallback& callback) OVERRIDE {
base::MessageLoopProxy::current()->PostTask(
FROM_HERE,
- base::Bind(base::IgnoreResult(callback), base::PLATFORM_FILE_OK));
+ base::Bind(base::IgnoreResult(callback), base::File::FILE_OK));
}
virtual void ReleaseReservedQuota(const GURL& origin,
@@ -103,15 +104,10 @@
}
void SetFileSize(const base::FilePath::StringType& file_name, int64 size) {
- bool created = false;
- base::PlatformFileError error = base::PLATFORM_FILE_ERROR_FAILED;
- base::PlatformFile file = CreatePlatformFile(
- MakeFilePath(file_name),
- base::PLATFORM_FILE_OPEN_ALWAYS | base::PLATFORM_FILE_WRITE,
- &created, &error);
- ASSERT_EQ(base::PLATFORM_FILE_OK, error);
- ASSERT_TRUE(base::TruncatePlatformFile(file, size));
- ASSERT_TRUE(base::ClosePlatformFile(file));
+ base::File file(MakeFilePath(file_name),
+ base::File::FLAG_OPEN_ALWAYS | base::File::FLAG_WRITE);
+ ASSERT_TRUE(file.IsValid());
+ ASSERT_TRUE(file.SetLength(size));
}
QuotaReservationManager* reservation_manager() {
diff --git a/content/child/fileapi/file_system_dispatcher.cc b/content/child/fileapi/file_system_dispatcher.cc
index 3abc6fc..d6c6303 100644
--- a/content/child/fileapi/file_system_dispatcher.cc
+++ b/content/child/fileapi/file_system_dispatcher.cc
@@ -77,20 +77,20 @@
~CallbackDispatcher() {}
void DidSucceed() {
- status_callback_.Run(base::PLATFORM_FILE_OK);
+ status_callback_.Run(base::File::FILE_OK);
}
- void DidFail(base::PlatformFileError error_code) {
+ void DidFail(base::File::Error error_code) {
error_callback_.Run(error_code);
}
void DidReadMetadata(
- const base::PlatformFileInfo& file_info) {
+ const base::File::Info& file_info) {
metadata_callback_.Run(file_info);
}
void DidCreateSnapshotFile(
- const base::PlatformFileInfo& file_info,
+ const base::File::Info& file_info,
const base::FilePath& platform_path,
int request_id) {
snapshot_callback_.Run(file_info, platform_path, request_id);
@@ -150,7 +150,7 @@
int request_id = iter.GetCurrentKey();
CallbackDispatcher* dispatcher = iter.GetCurrentValue();
DCHECK(dispatcher);
- dispatcher->DidFail(base::PLATFORM_FILE_ERROR_ABORT);
+ dispatcher->DidFail(base::File::FILE_ERROR_ABORT);
dispatchers_.Remove(request_id);
}
}
@@ -367,7 +367,7 @@
}
void FileSystemDispatcher::OnDidReadMetadata(
- int request_id, const base::PlatformFileInfo& file_info) {
+ int request_id, const base::File::Info& file_info) {
CallbackDispatcher* dispatcher = dispatchers_.Lookup(request_id);
DCHECK(dispatcher);
dispatcher->DidReadMetadata(file_info);
@@ -375,7 +375,7 @@
}
void FileSystemDispatcher::OnDidCreateSnapshotFile(
- int request_id, const base::PlatformFileInfo& file_info,
+ int request_id, const base::File::Info& file_info,
const base::FilePath& platform_path) {
CallbackDispatcher* dispatcher = dispatchers_.Lookup(request_id);
DCHECK(dispatcher);
@@ -394,7 +394,7 @@
}
void FileSystemDispatcher::OnDidFail(
- int request_id, base::PlatformFileError error_code) {
+ int request_id, base::File::Error error_code) {
CallbackDispatcher* dispatcher = dispatchers_.Lookup(request_id);
DCHECK(dispatcher);
dispatcher->DidFail(error_code);
diff --git a/content/child/fileapi/file_system_dispatcher.h b/content/child/fileapi/file_system_dispatcher.h
index b3d427f..6d098b6f 100644
--- a/content/child/fileapi/file_system_dispatcher.h
+++ b/content/child/fileapi/file_system_dispatcher.h
@@ -19,7 +19,6 @@
namespace base {
class FilePath;
-struct PlatformFileInfo;
}
namespace fileapi {
@@ -36,11 +35,11 @@
// per child process. Messages are dispatched on the main child thread.
class FileSystemDispatcher : public IPC::Listener {
public:
- typedef base::Callback<void(base::PlatformFileError error)> StatusCallback;
+ typedef base::Callback<void(base::File::Error error)> StatusCallback;
typedef base::Callback<void(
- const base::PlatformFileInfo& file_info)> MetadataCallback;
+ const base::File::Info& file_info)> MetadataCallback;
typedef base::Callback<void(
- const base::PlatformFileInfo& file_info,
+ const base::File::Info& file_info,
const base::FilePath& platform_path,
int request_id)> CreateSnapshotFileCallback;
typedef base::Callback<void(
@@ -139,14 +138,14 @@
bool is_directory);
void OnDidSucceed(int request_id);
void OnDidReadMetadata(int request_id,
- const base::PlatformFileInfo& file_info);
+ const base::File::Info& file_info);
void OnDidCreateSnapshotFile(int request_id,
- const base::PlatformFileInfo& file_info,
+ const base::File::Info& file_info,
const base::FilePath& platform_path);
void OnDidReadDirectory(int request_id,
const std::vector<fileapi::DirectoryEntry>& entries,
bool has_more);
- void OnDidFail(int request_id, base::PlatformFileError error_code);
+ void OnDidFail(int request_id, base::File::Error error_code);
void OnDidWrite(int request_id, int64 bytes, bool complete);
void OnDidOpenFile(
int request_id,
diff --git a/content/child/fileapi/webfilesystem_impl.cc b/content/child/fileapi/webfilesystem_impl.cc
index 59e9d56..902c12d 100644
--- a/content/child/fileapi/webfilesystem_impl.cc
+++ b/content/child/fileapi/webfilesystem_impl.cc
@@ -171,8 +171,8 @@
void StatusCallbackAdapter(int thread_id, int callbacks_id,
WaitableCallbackResults* waitable_results,
- base::PlatformFileError error) {
- if (error == base::PLATFORM_FILE_OK) {
+ base::File::Error error) {
+ if (error == base::File::FILE_OK) {
CallbackFileSystemCallbacks(
thread_id, callbacks_id, waitable_results,
&WebFileSystemCallbacks::didSucceed, MakeTuple());
@@ -180,15 +180,15 @@
CallbackFileSystemCallbacks(
thread_id, callbacks_id, waitable_results,
&WebFileSystemCallbacks::didFail,
- MakeTuple(fileapi::PlatformFileErrorToWebFileError(error)));
+ MakeTuple(fileapi::FileErrorToWebFileError(error)));
}
}
void ReadMetadataCallbackAdapter(int thread_id, int callbacks_id,
WaitableCallbackResults* waitable_results,
- const base::PlatformFileInfo& file_info) {
+ const base::File::Info& file_info) {
WebFileInfo web_file_info;
- webkit_glue::PlatformFileInfoToWebFileInfo(file_info, &web_file_info);
+ webkit_glue::FileInfoToWebFileInfo(file_info, &web_file_info);
CallbackFileSystemCallbacks(
thread_id, callbacks_id, waitable_results,
&WebFileSystemCallbacks::didReadMetadata,
@@ -216,7 +216,7 @@
const GURL& path,
blink::WebFileWriterClient* client,
base::MessageLoopProxy* main_thread_loop,
- const base::PlatformFileInfo& file_info) {
+ const base::File::Info& file_info) {
WebFileSystemImpl* filesystem =
WebFileSystemImpl::ThreadSpecificInstance(NULL);
if (!filesystem)
@@ -243,7 +243,7 @@
base::MessageLoopProxy* main_thread_loop,
const GURL& path,
blink::WebFileWriterClient* client,
- const base::PlatformFileInfo& file_info) {
+ const base::File::Info& file_info) {
DispatchResultsClosure(
thread_id, callbacks_id, waitable_results,
base::Bind(&DidCreateFileWriter, callbacks_id, path, client,
@@ -253,7 +253,7 @@
void DidCreateSnapshotFile(
int callbacks_id,
base::MessageLoopProxy* main_thread_loop,
- const base::PlatformFileInfo& file_info,
+ const base::File::Info& file_info,
const base::FilePath& platform_path,
int request_id) {
WebFileSystemImpl* filesystem =
@@ -265,7 +265,7 @@
filesystem->GetAndUnregisterCallbacks(callbacks_id);
WebFileInfo web_file_info;
- webkit_glue::PlatformFileInfoToWebFileInfo(file_info, &web_file_info);
+ webkit_glue::FileInfoToWebFileInfo(file_info, &web_file_info);
web_file_info.platformPath = platform_path.AsUTF16Unsafe();
callbacks.didCreateSnapshotFile(web_file_info);
@@ -279,7 +279,7 @@
int thread_id, int callbacks_id,
WaitableCallbackResults* waitable_results,
base::MessageLoopProxy* main_thread_loop,
- const base::PlatformFileInfo& file_info,
+ const base::File::Info& file_info,
const base::FilePath& platform_path,
int request_id) {
DispatchResultsClosure(
diff --git a/content/child/fileapi/webfilewriter_base.cc b/content/child/fileapi/webfilewriter_base.cc
index cde644b..a0ede79 100644
--- a/content/child/fileapi/webfilewriter_base.cc
+++ b/content/child/fileapi/webfilewriter_base.cc
@@ -10,7 +10,7 @@
#include "third_party/WebKit/public/platform/WebURL.h"
#include "webkit/common/fileapi/file_system_util.h"
-using fileapi::PlatformFileErrorToWebFileError;
+using fileapi::FileErrorToWebFileError;
namespace content {
@@ -63,8 +63,8 @@
DoCancel();
}
-void WebFileWriterBase::DidFinish(base::PlatformFileError error_code) {
- if (error_code == base::PLATFORM_FILE_OK)
+void WebFileWriterBase::DidFinish(base::File::Error error_code) {
+ if (error_code == base::File::FILE_OK)
DidSucceed();
else
DidFail(error_code);
@@ -117,13 +117,13 @@
}
}
-void WebFileWriterBase::DidFail(base::PlatformFileError error_code) {
+void WebFileWriterBase::DidFail(base::File::Error error_code) {
DCHECK(kOperationNone != operation_);
switch (cancel_state_) {
case kCancelNotInProgress:
// A write or truncate failed.
operation_ = kOperationNone;
- client_->didFail(PlatformFileErrorToWebFileError(error_code));
+ client_->didFail(FileErrorToWebFileError(error_code));
break;
case kCancelSent:
// This is the failure of a write or truncate; the next message should be
diff --git a/content/child/fileapi/webfilewriter_base.h b/content/child/fileapi/webfilewriter_base.h
index 5168e3c..7371e63 100644
--- a/content/child/fileapi/webfilewriter_base.h
+++ b/content/child/fileapi/webfilewriter_base.h
@@ -5,7 +5,7 @@
#ifndef CONTENT_CHILD_FILEAPI_WEBFILEWRITER_BASE_H_
#define CONTENT_CHILD_FILEAPI_WEBFILEWRITER_BASE_H_
-#include "base/platform_file.h"
+#include "base/files/file.h"
#include "content/common/content_export.h"
#include "third_party/WebKit/public/platform/WebFileWriter.h"
#include "url/gurl.h"
@@ -30,11 +30,11 @@
protected:
// This calls DidSucceed() or DidFail() based on the value of |error_code|.
- void DidFinish(base::PlatformFileError error_code);
+ void DidFinish(base::File::Error error_code);
void DidWrite(int64 bytes, bool complete);
void DidSucceed();
- void DidFail(base::PlatformFileError error_code);
+ void DidFail(base::File::Error error_code);
// Derived classes must provide these methods to asynchronously perform
// the requested operation, and they must call the appropiate DidSomething
diff --git a/content/child/fileapi/webfilewriter_base_unittest.cc b/content/child/fileapi/webfilewriter_base_unittest.cc
index 95e0ba5..1c3448a 100644
--- a/content/child/fileapi/webfilewriter_base_unittest.cc
+++ b/content/child/fileapi/webfilewriter_base_unittest.cc
@@ -73,14 +73,14 @@
if (offset == kBasicFileTruncate_Offset) {
DidSucceed();
} else if (offset == kErrorFileTruncate_Offset) {
- DidFail(base::PLATFORM_FILE_ERROR_NOT_FOUND);
+ DidFail(base::File::FILE_ERROR_NOT_FOUND);
} else if (offset == kCancelFileTruncate_Offset) {
cancel();
DidSucceed(); // truncate completion
DidSucceed(); // cancel completion
} else if (offset == kCancelFailedTruncate_Offset) {
cancel();
- DidFail(base::PLATFORM_FILE_ERROR_NOT_FOUND); // truncate completion
+ DidFail(base::File::FILE_ERROR_NOT_FOUND); // truncate completion
DidSucceed(); // cancel completion
} else {
FAIL();
@@ -98,7 +98,7 @@
if (offset == kBasicFileWrite_Offset) {
DidWrite(1, true);
} else if (offset == kErrorFileWrite_Offset) {
- DidFail(base::PLATFORM_FILE_ERROR_NOT_FOUND);
+ DidFail(base::File::FILE_ERROR_NOT_FOUND);
} else if (offset == kMultiFileWrite_Offset) {
DidWrite(1, false);
DidWrite(1, false);
@@ -108,7 +108,7 @@
cancel();
DidWrite(1, false);
DidWrite(1, false);
- DidFail(base::PLATFORM_FILE_ERROR_FAILED); // write completion
+ DidFail(base::File::FILE_ERROR_FAILED); // write completion
DidSucceed(); // cancel completion
} else if (offset == kCancelFileWriteAfterCompletion_Offset) {
DidWrite(1, false);
@@ -116,7 +116,7 @@
DidWrite(1, false);
DidWrite(1, false);
DidWrite(1, true); // write completion
- DidFail(base::PLATFORM_FILE_ERROR_FAILED); // cancel completion
+ DidFail(base::File::FILE_ERROR_FAILED); // cancel completion
} else {
FAIL();
}
diff --git a/content/child/fileapi/webfilewriter_impl.cc b/content/child/fileapi/webfilewriter_impl.cc
index 7077e9a2..d93289f 100644
--- a/content/child/fileapi/webfilewriter_impl.cc
+++ b/content/child/fileapi/webfilewriter_impl.cc
@@ -93,7 +93,7 @@
PostTaskToWorker(base::Bind(write_callback_, written_bytes_, complete));
}
- void DidFinish(base::PlatformFileError status) {
+ void DidFinish(base::File::Error status) {
PostTaskToWorker(base::Bind(status_callback_, status));
}
diff --git a/content/common/file_utilities_messages.h b/content/common/file_utilities_messages.h
index 5d73470..09e37b0 100644
--- a/content/common/file_utilities_messages.h
+++ b/content/common/file_utilities_messages.h
@@ -15,5 +15,5 @@
IPC_SYNC_MESSAGE_CONTROL1_2(FileUtilitiesMsg_GetFileInfo,
base::FilePath /* path */,
- base::PlatformFileInfo /* result */,
- base::PlatformFileError /* status */)
+ base::File::Info /* result */,
+ base::File::Error /* status */)
diff --git a/content/common/fileapi/file_system_messages.h b/content/common/fileapi/file_system_messages.h
index eb9d1c0..933423aa 100644
--- a/content/common/fileapi/file_system_messages.h
+++ b/content/common/fileapi/file_system_messages.h
@@ -49,10 +49,10 @@
int /* request_id */)
IPC_MESSAGE_CONTROL2(FileSystemMsg_DidReadMetadata,
int /* request_id */,
- base::PlatformFileInfo)
+ base::File::Info)
IPC_MESSAGE_CONTROL3(FileSystemMsg_DidCreateSnapshotFile,
int /* request_id */,
- base::PlatformFileInfo,
+ base::File::Info,
base::FilePath /* true platform path */)
IPC_MESSAGE_CONTROL3(FileSystemMsg_DidReadDirectory,
int /* request_id */,
@@ -69,7 +69,7 @@
quota::QuotaLimitType /* quota_policy */)
IPC_MESSAGE_CONTROL2(FileSystemMsg_DidFail,
int /* request_id */,
- base::PlatformFileError /* error_code */)
+ base::File::Error /* error_code */)
// File system messages sent from the child process to the browser.
diff --git a/content/public/test/test_file_system_backend.cc b/content/public/test/test_file_system_backend.cc
index c2a29fa..a6b0276 100644
--- a/content/public/test/test_file_system_backend.cc
+++ b/content/public/test/test_file_system_backend.cc
@@ -40,12 +40,12 @@
virtual ~TestFileUtil() {}
// LocalFileUtil overrides.
- virtual base::PlatformFileError GetLocalFilePath(
+ virtual base::File::Error GetLocalFilePath(
FileSystemOperationContext* context,
const FileSystemURL& file_system_url,
base::FilePath* local_file_path) OVERRIDE {
*local_file_path = base_path_.Append(file_system_url.path());
- return base::PLATFORM_FILE_OK;
+ return base::File::FILE_OK;
}
private:
@@ -67,13 +67,13 @@
virtual ~QuotaUtil() {}
// FileSystemQuotaUtil overrides.
- virtual base::PlatformFileError DeleteOriginDataOnFileTaskRunner(
+ virtual base::File::Error DeleteOriginDataOnFileTaskRunner(
FileSystemContext* context,
quota::QuotaManagerProxy* proxy,
const GURL& origin_url,
FileSystemType type) OVERRIDE {
NOTREACHED();
- return base::PLATFORM_FILE_OK;
+ return base::File::FILE_OK;
}
virtual scoped_refptr<fileapi::QuotaReservation>
@@ -186,7 +186,7 @@
const OpenFileSystemCallback& callback) {
callback.Run(GetFileSystemRootURI(origin_url, type),
GetFileSystemName(origin_url, type),
- base::PLATFORM_FILE_OK);
+ base::File::FILE_OK);
}
fileapi::AsyncFileUtil* TestFileSystemBackend::GetAsyncFileUtil(
@@ -196,12 +196,12 @@
fileapi::CopyOrMoveFileValidatorFactory*
TestFileSystemBackend::GetCopyOrMoveFileValidatorFactory(
- FileSystemType type, base::PlatformFileError* error_code) {
+ FileSystemType type, base::File::Error* error_code) {
DCHECK(error_code);
- *error_code = base::PLATFORM_FILE_OK;
+ *error_code = base::File::FILE_OK;
if (require_copy_or_move_validator_) {
if (!copy_or_move_file_validator_factory_)
- *error_code = base::PLATFORM_FILE_ERROR_SECURITY;
+ *error_code = base::File::FILE_ERROR_SECURITY;
return copy_or_move_file_validator_factory_.get();
}
return NULL;
@@ -216,7 +216,7 @@
FileSystemOperation* TestFileSystemBackend::CreateFileSystemOperation(
const FileSystemURL& url,
FileSystemContext* context,
- base::PlatformFileError* error_code) const {
+ base::File::Error* error_code) const {
scoped_ptr<FileSystemOperationContext> operation_context(
new FileSystemOperationContext(context));
operation_context->set_update_observers(*GetUpdateObservers(url.type()));
diff --git a/content/public/test/test_file_system_backend.h b/content/public/test/test_file_system_backend.h
index 4b49747f..9ce56fb 100644
--- a/content/public/test/test_file_system_backend.h
+++ b/content/public/test/test_file_system_backend.h
@@ -46,11 +46,11 @@
virtual fileapi::CopyOrMoveFileValidatorFactory*
GetCopyOrMoveFileValidatorFactory(
fileapi::FileSystemType type,
- base::PlatformFileError* error_code) OVERRIDE;
+ base::File::Error* error_code) OVERRIDE;
virtual fileapi::FileSystemOperation* CreateFileSystemOperation(
const fileapi::FileSystemURL& url,
fileapi::FileSystemContext* context,
- base::PlatformFileError* error_code) const OVERRIDE;
+ base::File::Error* error_code) const OVERRIDE;
virtual scoped_ptr<webkit_blob::FileStreamReader> CreateFileStreamReader(
const fileapi::FileSystemURL& url,
int64 offset,
diff --git a/content/renderer/pepper/pepper_file_system_host.cc b/content/renderer/pepper/pepper_file_system_host.cc
index be5cead8..36000fd 100644
--- a/content/renderer/pepper/pepper_file_system_host.cc
+++ b/content/renderer/pepper/pepper_file_system_host.cc
@@ -81,9 +81,8 @@
reply_context_ = ppapi::host::ReplyMessageContext();
}
-void PepperFileSystemHost::DidFailOpenFileSystem(
- base::PlatformFileError error) {
- int32 pp_error = ppapi::PlatformFileErrorToPepperError(error);
+void PepperFileSystemHost::DidFailOpenFileSystem(base::File::Error error) {
+ int32 pp_error = ppapi::FileErrorToPepperError(error);
opened_ = (pp_error == PP_OK);
reply_context_.params.set_result(pp_error);
host()->SendReply(reply_context_, PpapiPluginMsg_FileSystem_OpenReply());
diff --git a/content/renderer/pepper/pepper_file_system_host.h b/content/renderer/pepper/pepper_file_system_host.h
index 0e0be31..e1657a1d 100644
--- a/content/renderer/pepper/pepper_file_system_host.h
+++ b/content/renderer/pepper/pepper_file_system_host.h
@@ -8,6 +8,7 @@
#include <string>
#include "base/basictypes.h"
+#include "base/files/file.h"
#include "base/memory/weak_ptr.h"
#include "ppapi/c/pp_file_info.h"
#include "ppapi/c/private/ppb_isolated_file_system_private.h"
@@ -54,7 +55,7 @@
private:
// Callback for OpenFileSystem.
void DidOpenFileSystem(const std::string& name_unused, const GURL& root);
- void DidFailOpenFileSystem(base::PlatformFileError error);
+ void DidFailOpenFileSystem(base::File::Error error);
int32_t OnHostMsgOpen(ppapi::host::HostMessageContext* context,
int64_t expected_size);
diff --git a/content/renderer/renderer_webkitplatformsupport_impl.cc b/content/renderer/renderer_webkitplatformsupport_impl.cc
index 86a2931..1d3e4717 100644
--- a/content/renderer/renderer_webkitplatformsupport_impl.cc
+++ b/content/renderer/renderer_webkitplatformsupport_impl.cc
@@ -479,14 +479,14 @@
bool RendererWebKitPlatformSupportImpl::FileUtilities::getFileInfo(
const WebString& path,
WebFileInfo& web_file_info) {
- base::PlatformFileInfo file_info;
- base::PlatformFileError status;
+ base::File::Info file_info;
+ base::File::Error status;
if (!SendSyncMessageFromAnyThread(new FileUtilitiesMsg_GetFileInfo(
base::FilePath::FromUTF16Unsafe(path), &file_info, &status)) ||
- status != base::PLATFORM_FILE_OK) {
+ status != base::File::FILE_OK) {
return false;
}
- webkit_glue::PlatformFileInfoToWebFileInfo(file_info, &web_file_info);
+ webkit_glue::FileInfoToWebFileInfo(file_info, &web_file_info);
web_file_info.platformPath = path;
return true;
}
diff --git a/content/worker/worker_webkitplatformsupport_impl.cc b/content/worker/worker_webkitplatformsupport_impl.cc
index 23fb80ea..a83cd34 100644
--- a/content/worker/worker_webkitplatformsupport_impl.cc
+++ b/content/worker/worker_webkitplatformsupport_impl.cc
@@ -61,15 +61,15 @@
bool WorkerWebKitPlatformSupportImpl::FileUtilities::getFileInfo(
const WebString& path,
WebFileInfo& web_file_info) {
- base::PlatformFileInfo file_info;
- base::PlatformFileError status;
+ base::File::Info file_info;
+ base::File::Error status;
if (!thread_safe_sender_.get() ||
!thread_safe_sender_->Send(new FileUtilitiesMsg_GetFileInfo(
base::FilePath::FromUTF16Unsafe(path), &file_info, &status)) ||
- status != base::PLATFORM_FILE_OK) {
+ status != base::File::FILE_OK) {
return false;
}
- webkit_glue::PlatformFileInfoToWebFileInfo(file_info, &web_file_info);
+ webkit_glue::FileInfoToWebFileInfo(file_info, &web_file_info);
web_file_info.platformPath = path;
return true;
}
diff --git a/ipc/ipc_message_utils.cc b/ipc/ipc_message_utils.cc
index b652443..a67c5f5 100644
--- a/ipc/ipc_message_utils.cc
+++ b/ipc/ipc_message_utils.cc
@@ -555,8 +555,8 @@
l->append(")");
}
-void ParamTraits<base::PlatformFileInfo>::Write(Message* m,
- const param_type& p) {
+void ParamTraits<base::File::Info>::Write(Message* m,
+ const param_type& p) {
WriteParam(m, p.size);
WriteParam(m, p.is_directory);
WriteParam(m, p.last_modified.ToDoubleT());
@@ -564,9 +564,9 @@
WriteParam(m, p.creation_time.ToDoubleT());
}
-bool ParamTraits<base::PlatformFileInfo>::Read(const Message* m,
- PickleIterator* iter,
- param_type* p) {
+bool ParamTraits<base::File::Info>::Read(const Message* m,
+ PickleIterator* iter,
+ param_type* p) {
double last_modified;
double last_accessed;
double creation_time;
@@ -584,8 +584,8 @@
return result;
}
-void ParamTraits<base::PlatformFileInfo>::Log(const param_type& p,
- std::string* l) {
+void ParamTraits<base::File::Info>::Log(const param_type& p,
+ std::string* l) {
l->append("(");
LogParam(p.size, l);
l->append(",");
diff --git a/ipc/ipc_message_utils.h b/ipc/ipc_message_utils.h
index 24b38af..b05f76d 100644
--- a/ipc/ipc_message_utils.h
+++ b/ipc/ipc_message_utils.h
@@ -11,9 +11,9 @@
#include <string>
#include <vector>
+#include "base/files/file.h"
#include "base/format_macros.h"
#include "base/memory/scoped_vector.h"
-#include "base/platform_file.h"
#include "base/strings/string16.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
@@ -474,15 +474,15 @@
};
template <>
-struct IPC_EXPORT ParamTraits<base::PlatformFileInfo> {
- typedef base::PlatformFileInfo param_type;
+struct IPC_EXPORT ParamTraits<base::File::Info> {
+ typedef base::File::Info param_type;
static void Write(Message* m, const param_type& p);
static bool Read(const Message* m, PickleIterator* iter, param_type* r);
static void Log(const param_type& p, std::string* l);
};
template <>
-struct SimilarTypeTraits<base::PlatformFileError> {
+struct SimilarTypeTraits<base::File::Error> {
typedef int Type;
};
diff --git a/ipc/ipc_platform_file.h b/ipc/ipc_platform_file.h
index 553c78c5..d3a605e 100644
--- a/ipc/ipc_platform_file.h
+++ b/ipc/ipc_platform_file.h
@@ -6,6 +6,7 @@
#define IPC_IPC_PLATFORM_FILE_H_
#include "base/basictypes.h"
+#include "base/files/file.h"
#include "base/platform_file.h"
#include "base/process/process.h"
#include "ipc/ipc_export.h"
diff --git a/net/base/directory_lister_unittest.cc b/net/base/directory_lister_unittest.cc
index 1df0226..005ce0d5 100644
--- a/net/base/directory_lister_unittest.cc
+++ b/net/base/directory_lister_unittest.cc
@@ -109,13 +109,9 @@
for (int i = 0; i < kFilesPerDirectory; i++) {
std::string file_name = base::StringPrintf("file_id_%d", i);
base::FilePath file_path = dir_data.first.AppendASCII(file_name);
- base::PlatformFile file = base::CreatePlatformFile(
- file_path,
- base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_WRITE,
- NULL,
- NULL);
- ASSERT_NE(base::kInvalidPlatformFileValue, file);
- ASSERT_TRUE(base::ClosePlatformFile(file));
+ base::File file(file_path,
+ base::File::FLAG_CREATE | base::File::FLAG_WRITE);
+ ASSERT_TRUE(file.IsValid());
}
if (dir_data.second < kMaxDepth - 1) {
for (int i = 0; i < kBranchingFactor; i++) {
diff --git a/net/base/net_errors.cc b/net/base/net_errors.cc
index 01fda390..a9d1443 100644
--- a/net/base/net_errors.cc
+++ b/net/base/net_errors.cc
@@ -44,16 +44,15 @@
kAllErrorCodes, arraysize(kAllErrorCodes));
}
-Error PlatformFileErrorToNetError(
- base::PlatformFileError file_error) {
+Error FileErrorToNetError(base::File::Error file_error) {
switch (file_error) {
- case base::PLATFORM_FILE_OK:
+ case base::File::FILE_OK:
return net::OK;
- case base::PLATFORM_FILE_ERROR_ACCESS_DENIED:
+ case base::File::FILE_ERROR_ACCESS_DENIED:
return net::ERR_ACCESS_DENIED;
- case base::PLATFORM_FILE_ERROR_INVALID_URL:
+ case base::File::FILE_ERROR_INVALID_URL:
return net::ERR_INVALID_URL;
- case base::PLATFORM_FILE_ERROR_NOT_FOUND:
+ case base::File::FILE_ERROR_NOT_FOUND:
return net::ERR_FILE_NOT_FOUND;
default:
return net::ERR_FAILED;
diff --git a/net/base/net_errors.h b/net/base/net_errors.h
index 34e355e..c8742a81 100644
--- a/net/base/net_errors.h
+++ b/net/base/net_errors.h
@@ -8,7 +8,7 @@
#include <vector>
#include "base/basictypes.h"
-#include "base/platform_file.h"
+#include "base/files/file.h"
#include "net/base/net_export.h"
namespace net {
@@ -53,9 +53,8 @@
// error code that is not followed immediately by a valid error code.
NET_EXPORT std::vector<int> GetAllErrorCodesForUma();
-// A convenient function to translate platform file error to net error code.
-NET_EXPORT Error PlatformFileErrorToNetError(
- base::PlatformFileError file_error);
+// A convenient function to translate file error to net error code.
+NET_EXPORT Error FileErrorToNetError(base::File::Error file_error);
} // namespace net
diff --git a/net/disk_cache/simple/simple_index_file_unittest.cc b/net/disk_cache/simple/simple_index_file_unittest.cc
index 17aa595..3f4b56f3 100644
--- a/net/disk_cache/simple/simple_index_file_unittest.cc
+++ b/net/disk_cache/simple/simple_index_file_unittest.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "base/file_util.h"
+#include "base/files/file.h"
#include "base/files/scoped_temp_dir.h"
#include "base/hash.h"
#include "base/logging.h"
@@ -269,19 +270,16 @@
const base::FilePath cache_path = cache_dir.path();
// Write an old fake index file.
- base::PlatformFileError error;
- base::PlatformFile file = base::CreatePlatformFile(
- cache_path.AppendASCII("index"),
- base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_WRITE,
- NULL,
- &error);
+ base::File file(cache_path.AppendASCII("index"),
+ base::File::FLAG_CREATE | base::File::FLAG_WRITE);
+ ASSERT_TRUE(file.IsValid());
disk_cache::FakeIndexData file_contents;
file_contents.initial_magic_number = disk_cache::kSimpleInitialMagicNumber;
file_contents.version = 5;
- int bytes_written = base::WritePlatformFile(
- file, 0, reinterpret_cast<char*>(&file_contents), sizeof(file_contents));
- ASSERT_TRUE(base::ClosePlatformFile(file));
+ int bytes_written = file.Write(0, reinterpret_cast<char*>(&file_contents),
+ sizeof(file_contents));
ASSERT_EQ((int)sizeof(file_contents), bytes_written);
+ file.Close();
// Write the index file. The format is incorrect, but for transitioning from
// v5 it does not matter.
diff --git a/net/disk_cache/simple/simple_synchronous_entry.cc b/net/disk_cache/simple/simple_synchronous_entry.cc
index 4357e6e..14be1d4 100644
--- a/net/disk_cache/simple/simple_synchronous_entry.cc
+++ b/net/disk_cache/simple/simple_synchronous_entry.cc
@@ -768,16 +768,16 @@
cache_type_, OPEN_ENTRY_PLATFORM_FILE_ERROR, had_index);
SIMPLE_CACHE_UMA(ENUMERATION,
"SyncOpenPlatformFileError", cache_type_,
- -error, -base::PLATFORM_FILE_ERROR_MAX);
+ -error, -base::File::FILE_ERROR_MAX);
if (had_index) {
SIMPLE_CACHE_UMA(ENUMERATION,
"SyncOpenPlatformFileError_WithIndex", cache_type_,
- -error, -base::PLATFORM_FILE_ERROR_MAX);
+ -error, -base::File::FILE_ERROR_MAX);
} else {
SIMPLE_CACHE_UMA(ENUMERATION,
"SyncOpenPlatformFileError_WithoutIndex",
cache_type_,
- -error, -base::PLATFORM_FILE_ERROR_MAX);
+ -error, -base::File::FILE_ERROR_MAX);
}
while (--i >= 0)
CloseFile(i);
@@ -847,16 +847,16 @@
RecordSyncCreateResult(CREATE_ENTRY_PLATFORM_FILE_ERROR, had_index);
SIMPLE_CACHE_UMA(ENUMERATION,
"SyncCreatePlatformFileError", cache_type_,
- -error, -base::PLATFORM_FILE_ERROR_MAX);
+ -error, -base::File::FILE_ERROR_MAX);
if (had_index) {
SIMPLE_CACHE_UMA(ENUMERATION,
"SyncCreatePlatformFileError_WithIndex", cache_type_,
- -error, -base::PLATFORM_FILE_ERROR_MAX);
+ -error, -base::File::FILE_ERROR_MAX);
} else {
SIMPLE_CACHE_UMA(ENUMERATION,
"SyncCreatePlatformFileError_WithoutIndex",
cache_type_,
- -error, -base::PLATFORM_FILE_ERROR_MAX);
+ -error, -base::File::FILE_ERROR_MAX);
}
while (--i >= 0)
CloseFile(i);
diff --git a/ppapi/proxy/file_io_resource.cc b/ppapi/proxy/file_io_resource.cc
index f4fa6a5..a35c9ec 100644
--- a/ppapi/proxy/file_io_resource.cc
+++ b/ppapi/proxy/file_io_resource.cc
@@ -57,8 +57,11 @@
}
int32_t FileIOResource::QueryOp::DoWork() {
- return base::GetPlatformFileInfo(file_handle_->raw_handle(), &file_info_) ?
- PP_OK : PP_ERROR_FAILED;
+ // TODO(rvargas): Convert this code to use base::File.
+ base::File file(file_handle_->raw_handle());
+ bool success = file.GetInfo(&file_info_);
+ file.TakePlatformFile();
+ return success ? PP_OK : PP_ERROR_FAILED;
}
FileIOResource::ReadOp::ReadOp(scoped_refptr<FileHandleHolder> file_handle,
@@ -188,21 +191,25 @@
// If the callback is blocking, perform the task on the calling thread.
if (callback->is_blocking()) {
int32_t result = PP_ERROR_FAILED;
- base::PlatformFileInfo file_info;
+ base::File::Info file_info;
// The plugin could release its reference to this instance when we release
// the proxy lock below.
scoped_refptr<FileIOResource> protect(this);
{
// Release the proxy lock while making a potentially slow file call.
ProxyAutoUnlock unlock;
- if (base::GetPlatformFileInfo(file_handle_->raw_handle(), &file_info))
+ // TODO(rvargas): Convert this code to base::File.
+ base::File file(file_handle_->raw_handle());
+ bool success = file.GetInfo(&file_info);
+ file.TakePlatformFile();
+ if (success)
result = PP_OK;
}
if (result == PP_OK) {
// This writes the file info into the plugin's PP_FileInfo struct.
- ppapi::PlatformFileInfoToPepperFileInfo(file_info,
- file_system_type_,
- info);
+ ppapi::FileInfoToPepperFileInfo(file_info,
+ file_system_type_,
+ info);
}
state_manager_.SetOperationFinished();
return result;
@@ -547,9 +554,9 @@
if (result == PP_OK) {
// This writes the file info into the plugin's PP_FileInfo struct.
- ppapi::PlatformFileInfoToPepperFileInfo(query_op->file_info(),
- file_system_type_,
- info);
+ ppapi::FileInfoToPepperFileInfo(query_op->file_info(),
+ file_system_type_,
+ info);
}
state_manager_.SetOperationFinished();
return result;
diff --git a/ppapi/proxy/file_io_resource.h b/ppapi/proxy/file_io_resource.h
index 38ac683..d6465fd4 100644
--- a/ppapi/proxy/file_io_resource.h
+++ b/ppapi/proxy/file_io_resource.h
@@ -7,6 +7,7 @@
#include <string>
+#include "base/files/file.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "ppapi/c/private/pp_file_handle.h"
@@ -111,14 +112,14 @@
// thread (blocking). This should not be called when we hold the proxy lock.
int32_t DoWork();
- const base::PlatformFileInfo& file_info() const { return file_info_; }
+ const base::File::Info& file_info() const { return file_info_; }
private:
friend class base::RefCountedThreadSafe<QueryOp>;
~QueryOp();
scoped_refptr<FileHandleHolder> file_handle_;
- base::PlatformFileInfo file_info_;
+ base::File::Info file_info_;
};
// Class to perform file read operations across multiple threads.
diff --git a/ppapi/proxy/flash_file_resource.cc b/ppapi/proxy/flash_file_resource.cc
index ce7a2ce..6b8fc6c 100644
--- a/ppapi/proxy/flash_file_resource.cc
+++ b/ppapi/proxy/flash_file_resource.cc
@@ -206,7 +206,7 @@
if (path.empty() || !info)
return PP_ERROR_BADARGUMENT;
- base::PlatformFileInfo file_info;
+ base::File::Info file_info;
PepperFilePath pepper_path(domain_type, base::FilePath::FromUTF8Unsafe(path));
int32_t error = SyncCall<PpapiPluginMsg_FlashFile_QueryFileReply>(BROWSER,
diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h
index 1cd3e14..76fa380 100644
--- a/ppapi/proxy/ppapi_messages.h
+++ b/ppapi/proxy/ppapi_messages.h
@@ -1926,7 +1926,7 @@
IPC_MESSAGE_CONTROL1(PpapiHostMsg_FlashFile_QueryFile,
ppapi::PepperFilePath /* path */)
IPC_MESSAGE_CONTROL1(PpapiPluginMsg_FlashFile_QueryFileReply,
- base::PlatformFileInfo /* file_info */)
+ base::File::Info /* file_info */)
IPC_MESSAGE_CONTROL1(PpapiHostMsg_FlashFile_GetDirContents,
ppapi::PepperFilePath /* path */)
IPC_MESSAGE_CONTROL1(PpapiPluginMsg_FlashFile_GetDirContentsReply,
diff --git a/ppapi/shared_impl/file_type_conversion.cc b/ppapi/shared_impl/file_type_conversion.cc
index 1a4bb16..0b94725 100644
--- a/ppapi/shared_impl/file_type_conversion.cc
+++ b/ppapi/shared_impl/file_type_conversion.cc
@@ -5,30 +5,31 @@
#include "ppapi/shared_impl/file_type_conversion.h"
#include "base/logging.h"
+#include "base/platform_file.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/ppb_file_io.h"
#include "ppapi/shared_impl/time_conversion.h"
namespace ppapi {
-int PlatformFileErrorToPepperError(base::PlatformFileError error_code) {
+int FileErrorToPepperError(base::File::Error error_code) {
switch (error_code) {
- case base::PLATFORM_FILE_OK:
+ case base::File::FILE_OK:
return PP_OK;
- case base::PLATFORM_FILE_ERROR_EXISTS:
+ case base::File::FILE_ERROR_EXISTS:
return PP_ERROR_FILEEXISTS;
- case base::PLATFORM_FILE_ERROR_NOT_FOUND:
+ case base::File::FILE_ERROR_NOT_FOUND:
return PP_ERROR_FILENOTFOUND;
- case base::PLATFORM_FILE_ERROR_ACCESS_DENIED:
- case base::PLATFORM_FILE_ERROR_SECURITY:
+ case base::File::FILE_ERROR_ACCESS_DENIED:
+ case base::File::FILE_ERROR_SECURITY:
return PP_ERROR_NOACCESS;
- case base::PLATFORM_FILE_ERROR_NO_MEMORY:
+ case base::File::FILE_ERROR_NO_MEMORY:
return PP_ERROR_NOMEMORY;
- case base::PLATFORM_FILE_ERROR_NO_SPACE:
+ case base::File::FILE_ERROR_NO_SPACE:
return PP_ERROR_NOSPACE;
- case base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY:
+ case base::File::FILE_ERROR_NOT_A_DIRECTORY:
return PP_ERROR_FAILED;
- case base::PLATFORM_FILE_ERROR_NOT_A_FILE:
+ case base::File::FILE_ERROR_NOT_A_FILE:
return PP_ERROR_NOTAFILE;
default:
return PP_ERROR_FAILED;
@@ -80,9 +81,9 @@
return true;
}
-void PlatformFileInfoToPepperFileInfo(const base::PlatformFileInfo& info,
- PP_FileSystemType fs_type,
- PP_FileInfo* info_out) {
+void FileInfoToPepperFileInfo(const base::File::Info& info,
+ PP_FileSystemType fs_type,
+ PP_FileInfo* info_out) {
DCHECK(info_out);
info_out->size = info.size;
info_out->creation_time = TimeToPPTime(info.creation_time);
diff --git a/ppapi/shared_impl/file_type_conversion.h b/ppapi/shared_impl/file_type_conversion.h
index c41b79b..7c5454d 100644
--- a/ppapi/shared_impl/file_type_conversion.h
+++ b/ppapi/shared_impl/file_type_conversion.h
@@ -5,7 +5,7 @@
#ifndef PPAPI_SHARED_IMPL_FILE_TYPE_CONVERSION_H_
#define PPAPI_SHARED_IMPL_FILE_TYPE_CONVERSION_H_
-#include "base/platform_file.h"
+#include "base/files/file.h"
#include "ppapi/c/pp_file_info.h"
#include "ppapi/c/pp_stdint.h"
#include "ppapi/c/ppb_file_system.h"
@@ -13,8 +13,7 @@
namespace ppapi {
-PPAPI_SHARED_EXPORT int PlatformFileErrorToPepperError(
- base::PlatformFileError error_code);
+PPAPI_SHARED_EXPORT int FileErrorToPepperError(base::File::Error error_code);
// Converts a PP_FileOpenFlags_Dev flag combination into a corresponding
// PlatformFileFlags flag combination.
@@ -23,8 +22,8 @@
int32_t pp_open_flags,
int* flags_out);
-PPAPI_SHARED_EXPORT void PlatformFileInfoToPepperFileInfo(
- const base::PlatformFileInfo& info,
+PPAPI_SHARED_EXPORT void FileInfoToPepperFileInfo(
+ const base::File::Info& info,
PP_FileSystemType fs_type,
PP_FileInfo* info_out);
diff --git a/webkit/browser/blob/blob_url_request_job.h b/webkit/browser/blob/blob_url_request_job.h
index 238958ff..81a5a3e6 100644
--- a/webkit/browser/blob/blob_url_request_job.h
+++ b/webkit/browser/blob/blob_url_request_job.h
@@ -9,7 +9,6 @@
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
-#include "base/platform_file.h"
#include "net/http/http_byte_range.h"
#include "net/http/http_status_code.h"
#include "net/url_request/url_request_job.h"
@@ -18,7 +17,6 @@
namespace base {
class MessageLoopProxy;
-struct PlatformFileInfo;
}
namespace fileapi {
diff --git a/webkit/browser/blob/file_stream_reader.cc b/webkit/browser/blob/file_stream_reader.cc
index 1b56287..6b66478d 100644
--- a/webkit/browser/blob/file_stream_reader.cc
+++ b/webkit/browser/blob/file_stream_reader.cc
@@ -4,7 +4,6 @@
#include "webkit/browser/blob/file_stream_reader.h"
-#include "base/platform_file.h"
#include "base/time/time.h"
namespace webkit_blob {
@@ -12,7 +11,7 @@
// Verify if the underlying file has not been modified.
bool FileStreamReader::VerifySnapshotTime(
const base::Time& expected_modification_time,
- const base::PlatformFileInfo& file_info) {
+ const base::File::Info& file_info) {
return expected_modification_time.is_null() ||
expected_modification_time.ToTimeT() ==
file_info.last_modified.ToTimeT();
diff --git a/webkit/browser/blob/file_stream_reader.h b/webkit/browser/blob/file_stream_reader.h
index 2f3d060..832c5d5d 100644
--- a/webkit/browser/blob/file_stream_reader.h
+++ b/webkit/browser/blob/file_stream_reader.h
@@ -7,12 +7,12 @@
#include "base/basictypes.h"
#include "base/compiler_specific.h"
+#include "base/files/file.h"
#include "net/base/completion_callback.h"
#include "webkit/browser/webkit_storage_browser_export.h"
namespace base {
class FilePath;
-struct PlatformFileInfo;
class TaskRunner;
class Time;
}
@@ -60,7 +60,7 @@
// Verify if the underlying file has not been modified.
WEBKIT_STORAGE_BROWSER_EXPORT static bool VerifySnapshotTime(
const base::Time& expected_modification_time,
- const base::PlatformFileInfo& file_info);
+ const base::File::Info& file_info);
// It is valid to delete the reader at any time. If the stream is deleted
// while it has a pending read, its callback will not be called.
diff --git a/webkit/browser/blob/local_file_stream_reader.cc b/webkit/browser/blob/local_file_stream_reader.cc
index fdf2b06..31c4f8c 100644
--- a/webkit/browser/blob/local_file_stream_reader.cc
+++ b/webkit/browser/blob/local_file_stream_reader.cc
@@ -150,14 +150,14 @@
void LocalFileStreamReader::DidGetFileInfoForGetLength(
const net::Int64CompletionCallback& callback,
- base::PlatformFileError error,
- const base::PlatformFileInfo& file_info) {
+ base::File::Error error,
+ const base::File::Info& file_info) {
if (file_info.is_directory) {
callback.Run(net::ERR_FILE_NOT_FOUND);
return;
}
- if (error != base::PLATFORM_FILE_OK) {
- callback.Run(net::PlatformFileErrorToNetError(error));
+ if (error != base::File::FILE_OK) {
+ callback.Run(net::FileErrorToNetError(error));
return;
}
if (!VerifySnapshotTime(expected_modification_time_, file_info)) {
diff --git a/webkit/browser/blob/local_file_stream_reader.h b/webkit/browser/blob/local_file_stream_reader.h
index 18a542451..1e125d0c 100644
--- a/webkit/browser/blob/local_file_stream_reader.h
+++ b/webkit/browser/blob/local_file_stream_reader.h
@@ -7,9 +7,9 @@
#include "base/basictypes.h"
#include "base/compiler_specific.h"
+#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/memory/weak_ptr.h"
-#include "base/platform_file.h"
#include "base/time/time.h"
#include "webkit/browser/blob/file_stream_reader.h"
#include "webkit/browser/webkit_storage_browser_export.h"
@@ -60,8 +60,8 @@
int open_result);
void DidGetFileInfoForGetLength(const net::Int64CompletionCallback& callback,
- base::PlatformFileError error,
- const base::PlatformFileInfo& file_info);
+ base::File::Error error,
+ const base::File::Info& file_info);
scoped_refptr<base::TaskRunner> task_runner_;
scoped_ptr<net::FileStream> stream_impl_;
diff --git a/webkit/browser/fileapi/async_file_test_helper.cc b/webkit/browser/fileapi/async_file_test_helper.cc
index 50fd7cd..0e88298 100644
--- a/webkit/browser/fileapi/async_file_test_helper.cc
+++ b/webkit/browser/fileapi/async_file_test_helper.cc
@@ -22,23 +22,23 @@
typedef FileSystemOperation::FileEntryList FileEntryList;
void AssignAndQuit(base::RunLoop* run_loop,
- base::PlatformFileError* result_out,
- base::PlatformFileError result) {
+ base::File::Error* result_out,
+ base::File::Error result) {
*result_out = result;
run_loop->Quit();
}
-base::Callback<void(base::PlatformFileError)>
+base::Callback<void(base::File::Error)>
AssignAndQuitCallback(base::RunLoop* run_loop,
- base::PlatformFileError* result) {
+ base::File::Error* result) {
return base::Bind(&AssignAndQuit, run_loop, base::Unretained(result));
}
void GetMetadataCallback(base::RunLoop* run_loop,
- base::PlatformFileError* result_out,
- base::PlatformFileInfo* file_info_out,
- base::PlatformFileError result,
- const base::PlatformFileInfo& file_info) {
+ base::File::Error* result_out,
+ base::File::Info* file_info_out,
+ base::File::Error result,
+ const base::File::Info& file_info) {
*result_out = result;
if (file_info_out)
*file_info_out = file_info;
@@ -47,10 +47,10 @@
void CreateSnapshotFileCallback(
base::RunLoop* run_loop,
- base::PlatformFileError* result_out,
+ base::File::Error* result_out,
base::FilePath* platform_path_out,
- base::PlatformFileError result,
- const base::PlatformFileInfo& file_info,
+ base::File::Error result,
+ const base::File::Info& file_info,
const base::FilePath& platform_path,
const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref) {
DCHECK(!file_ref.get());
@@ -61,14 +61,14 @@
}
void ReadDirectoryCallback(base::RunLoop* run_loop,
- base::PlatformFileError* result_out,
+ base::File::Error* result_out,
FileEntryList* entries_out,
- base::PlatformFileError result,
+ base::File::Error result,
const FileEntryList& entries,
bool has_more) {
*result_out = result;
*entries_out = entries;
- if (result != base::PLATFORM_FILE_OK || !has_more)
+ if (result != base::File::FILE_OK || !has_more)
run_loop->Quit();
}
@@ -90,19 +90,19 @@
const int64 AsyncFileTestHelper::kDontCheckSize = -1;
-base::PlatformFileError AsyncFileTestHelper::Copy(
+base::File::Error AsyncFileTestHelper::Copy(
FileSystemContext* context,
const FileSystemURL& src,
const FileSystemURL& dest) {
return CopyWithProgress(context, src, dest, CopyProgressCallback());
}
-base::PlatformFileError AsyncFileTestHelper::CopyWithProgress(
+base::File::Error AsyncFileTestHelper::CopyWithProgress(
FileSystemContext* context,
const FileSystemURL& src,
const FileSystemURL& dest,
const CopyProgressCallback& progress_callback) {
- base::PlatformFileError result = base::PLATFORM_FILE_ERROR_FAILED;
+ base::File::Error result = base::File::FILE_ERROR_FAILED;
base::RunLoop run_loop;
context->operation_runner()->Copy(
src, dest, FileSystemOperation::OPTION_NONE, progress_callback,
@@ -111,11 +111,11 @@
return result;
}
-base::PlatformFileError AsyncFileTestHelper::Move(
+base::File::Error AsyncFileTestHelper::Move(
FileSystemContext* context,
const FileSystemURL& src,
const FileSystemURL& dest) {
- base::PlatformFileError result = base::PLATFORM_FILE_ERROR_FAILED;
+ base::File::Error result = base::File::FILE_ERROR_FAILED;
base::RunLoop run_loop;
context->operation_runner()->Move(
src, dest, FileSystemOperation::OPTION_NONE,
@@ -124,11 +124,11 @@
return result;
}
-base::PlatformFileError AsyncFileTestHelper::Remove(
+base::File::Error AsyncFileTestHelper::Remove(
FileSystemContext* context,
const FileSystemURL& url,
bool recursive) {
- base::PlatformFileError result = base::PLATFORM_FILE_ERROR_FAILED;
+ base::File::Error result = base::File::FILE_ERROR_FAILED;
base::RunLoop run_loop;
context->operation_runner()->Remove(
url, recursive, AssignAndQuitCallback(&run_loop, &result));
@@ -136,11 +136,11 @@
return result;
}
-base::PlatformFileError AsyncFileTestHelper::ReadDirectory(
+base::File::Error AsyncFileTestHelper::ReadDirectory(
FileSystemContext* context,
const FileSystemURL& url,
FileEntryList* entries) {
- base::PlatformFileError result = base::PLATFORM_FILE_ERROR_FAILED;
+ base::File::Error result = base::File::FILE_ERROR_FAILED;
DCHECK(entries);
entries->clear();
base::RunLoop run_loop;
@@ -150,10 +150,10 @@
return result;
}
-base::PlatformFileError AsyncFileTestHelper::CreateDirectory(
+base::File::Error AsyncFileTestHelper::CreateDirectory(
FileSystemContext* context,
const FileSystemURL& url) {
- base::PlatformFileError result = base::PLATFORM_FILE_ERROR_FAILED;
+ base::File::Error result = base::File::FILE_ERROR_FAILED;
base::RunLoop run_loop;
context->operation_runner()->CreateDirectory(
url,
@@ -164,10 +164,10 @@
return result;
}
-base::PlatformFileError AsyncFileTestHelper::CreateFile(
+base::File::Error AsyncFileTestHelper::CreateFile(
FileSystemContext* context,
const FileSystemURL& url) {
- base::PlatformFileError result = base::PLATFORM_FILE_ERROR_FAILED;
+ base::File::Error result = base::File::FILE_ERROR_FAILED;
base::RunLoop run_loop;
context->operation_runner()->CreateFile(
url, false /* exclusive */,
@@ -176,18 +176,18 @@
return result;
}
-base::PlatformFileError AsyncFileTestHelper::CreateFileWithData(
+base::File::Error AsyncFileTestHelper::CreateFileWithData(
FileSystemContext* context,
const FileSystemURL& url,
const char* buf,
int buf_size) {
base::ScopedTempDir dir;
if (!dir.CreateUniqueTempDir())
- return base::PLATFORM_FILE_ERROR_FAILED;
+ return base::File::FILE_ERROR_FAILED;
base::FilePath local_path = dir.path().AppendASCII("tmp");
if (buf_size != file_util::WriteFile(local_path, buf, buf_size))
- return base::PLATFORM_FILE_ERROR_FAILED;
- base::PlatformFileError result = base::PLATFORM_FILE_ERROR_FAILED;
+ return base::File::FILE_ERROR_FAILED;
+ base::File::Error result = base::File::FILE_ERROR_FAILED;
base::RunLoop run_loop;
context->operation_runner()->CopyInForeignFile(
local_path, url, AssignAndQuitCallback(&run_loop, &result));
@@ -195,23 +195,23 @@
return result;
}
-base::PlatformFileError AsyncFileTestHelper::TruncateFile(
+base::File::Error AsyncFileTestHelper::TruncateFile(
FileSystemContext* context,
const FileSystemURL& url,
size_t size) {
base::RunLoop run_loop;
- base::PlatformFileError result = base::PLATFORM_FILE_ERROR_FAILED;
+ base::File::Error result = base::File::FILE_ERROR_FAILED;
context->operation_runner()->Truncate(
url, size, AssignAndQuitCallback(&run_loop, &result));
run_loop.Run();
return result;
}
-base::PlatformFileError AsyncFileTestHelper::GetMetadata(
+base::File::Error AsyncFileTestHelper::GetMetadata(
FileSystemContext* context,
const FileSystemURL& url,
- base::PlatformFileInfo* file_info) {
- base::PlatformFileError result = base::PLATFORM_FILE_ERROR_FAILED;
+ base::File::Info* file_info) {
+ base::File::Error result = base::File::FILE_ERROR_FAILED;
base::RunLoop run_loop;
context->operation_runner()->GetMetadata(
url, base::Bind(&GetMetadataCallback, &run_loop, &result,
@@ -220,11 +220,11 @@
return result;
}
-base::PlatformFileError AsyncFileTestHelper::GetPlatformPath(
+base::File::Error AsyncFileTestHelper::GetPlatformPath(
FileSystemContext* context,
const FileSystemURL& url,
base::FilePath* platform_path) {
- base::PlatformFileError result = base::PLATFORM_FILE_ERROR_FAILED;
+ base::File::Error result = base::File::FILE_ERROR_FAILED;
base::RunLoop run_loop;
context->operation_runner()->CreateSnapshotFile(
url, base::Bind(&CreateSnapshotFileCallback, &run_loop, &result,
@@ -237,9 +237,9 @@
FileSystemContext* context,
const FileSystemURL& url,
int64 expected_size) {
- base::PlatformFileInfo file_info;
- base::PlatformFileError result = GetMetadata(context, url, &file_info);
- if (result != base::PLATFORM_FILE_OK || file_info.is_directory)
+ base::File::Info file_info;
+ base::File::Error result = GetMetadata(context, url, &file_info);
+ if (result != base::File::FILE_OK || file_info.is_directory)
return false;
return expected_size == kDontCheckSize || file_info.size == expected_size;
}
@@ -247,9 +247,9 @@
bool AsyncFileTestHelper::DirectoryExists(
FileSystemContext* context,
const FileSystemURL& url) {
- base::PlatformFileInfo file_info;
- base::PlatformFileError result = GetMetadata(context, url, &file_info);
- return (result == base::PLATFORM_FILE_OK) && file_info.is_directory;
+ base::File::Info file_info;
+ base::File::Error result = GetMetadata(context, url, &file_info);
+ return (result == base::File::FILE_OK) && file_info.is_directory;
}
quota::QuotaStatusCode AsyncFileTestHelper::GetUsageAndQuota(
diff --git a/webkit/browser/fileapi/async_file_test_helper.h b/webkit/browser/fileapi/async_file_test_helper.h
index 168400f..fc2c95ed 100644
--- a/webkit/browser/fileapi/async_file_test_helper.h
+++ b/webkit/browser/fileapi/async_file_test_helper.h
@@ -28,61 +28,61 @@
static const int64 kDontCheckSize;
// Performs Copy from |src| to |dest| and returns the status code.
- static base::PlatformFileError Copy(FileSystemContext* context,
- const FileSystemURL& src,
- const FileSystemURL& dest);
+ static base::File::Error Copy(FileSystemContext* context,
+ const FileSystemURL& src,
+ const FileSystemURL& dest);
// Same as Copy, but this supports |progress_callback|.
- static base::PlatformFileError CopyWithProgress(
+ static base::File::Error CopyWithProgress(
FileSystemContext* context,
const FileSystemURL& src,
const FileSystemURL& dest,
const CopyProgressCallback& progress_callback);
// Performs Move from |src| to |dest| and returns the status code.
- static base::PlatformFileError Move(FileSystemContext* context,
- const FileSystemURL& src,
- const FileSystemURL& dest);
+ static base::File::Error Move(FileSystemContext* context,
+ const FileSystemURL& src,
+ const FileSystemURL& dest);
// Removes the given |url|.
- static base::PlatformFileError Remove(FileSystemContext* context,
- const FileSystemURL& url,
+ static base::File::Error Remove(FileSystemContext* context,
+ const FileSystemURL& url,
bool recursive);
// Performs ReadDirectory on |url|.
- static base::PlatformFileError ReadDirectory(FileSystemContext* context,
- const FileSystemURL& url,
- FileEntryList* entries);
+ static base::File::Error ReadDirectory(FileSystemContext* context,
+ const FileSystemURL& url,
+ FileEntryList* entries);
// Creates a directory at |url|.
- static base::PlatformFileError CreateDirectory(FileSystemContext* context,
- const FileSystemURL& url);
+ static base::File::Error CreateDirectory(FileSystemContext* context,
+ const FileSystemURL& url);
// Creates a file at |url|.
- static base::PlatformFileError CreateFile(FileSystemContext* context,
- const FileSystemURL& url);
+ static base::File::Error CreateFile(FileSystemContext* context,
+ const FileSystemURL& url);
// Creates a file at |url| and fills with |buf|.
- static base::PlatformFileError CreateFileWithData(
+ static base::File::Error CreateFileWithData(
FileSystemContext* context,
const FileSystemURL& url,
const char* buf,
int buf_size);
// Truncates the file |url| to |size|.
- static base::PlatformFileError TruncateFile(FileSystemContext* context,
- const FileSystemURL& url,
- size_t size);
+ static base::File::Error TruncateFile(FileSystemContext* context,
+ const FileSystemURL& url,
+ size_t size);
- // Retrieves PlatformFileInfo for |url| and populates |file_info|.
- static base::PlatformFileError GetMetadata(FileSystemContext* context,
- const FileSystemURL& url,
- base::PlatformFileInfo* file_info);
+ // Retrieves File::Info for |url| and populates |file_info|.
+ static base::File::Error GetMetadata(FileSystemContext* context,
+ const FileSystemURL& url,
+ base::File::Info* file_info);
// Retrieves FilePath for |url| and populates |platform_path|.
- static base::PlatformFileError GetPlatformPath(FileSystemContext* context,
- const FileSystemURL& url,
- base::FilePath* platform_path);
+ static base::File::Error GetPlatformPath(FileSystemContext* context,
+ const FileSystemURL& url,
+ base::FilePath* platform_path);
// Returns true if a file exists at |url| with |size|. If |size| is
// kDontCheckSize it doesn't check the file size (but just check its
diff --git a/webkit/browser/fileapi/async_file_util.h b/webkit/browser/fileapi/async_file_util.h
index c1e6d1e4..0e91341 100644
--- a/webkit/browser/fileapi/async_file_util.h
+++ b/webkit/browser/fileapi/async_file_util.h
@@ -9,6 +9,7 @@
#include "base/basictypes.h"
#include "base/callback_forward.h"
+#include "base/files/file.h"
#include "base/files/file_util_proxy.h"
#include "base/memory/scoped_ptr.h"
#include "base/platform_file.h"
@@ -47,34 +48,33 @@
//
class AsyncFileUtil {
public:
- typedef base::Callback<
- void(base::PlatformFileError result)> StatusCallback;
+ typedef base::Callback<void(base::File::Error result)> StatusCallback;
// |on_close_callback| will be called after the |file| is closed in the
// child process. |on_close_callback|.is_null() can be true, if no operation
// is needed on closing the file.
typedef base::Callback<
- void(base::PlatformFileError result,
+ void(base::File::Error result,
base::PassPlatformFile file,
const base::Closure& on_close_callback)> CreateOrOpenCallback;
typedef base::Callback<
- void(base::PlatformFileError result,
+ void(base::File::Error result,
bool created)> EnsureFileExistsCallback;
typedef base::Callback<
- void(base::PlatformFileError result,
- const base::PlatformFileInfo& file_info)> GetFileInfoCallback;
+ void(base::File::Error result,
+ const base::File::Info& file_info)> GetFileInfoCallback;
typedef std::vector<DirectoryEntry> EntryList;
typedef base::Callback<
- void(base::PlatformFileError result,
+ void(base::File::Error result,
const EntryList& file_list,
bool has_more)> ReadDirectoryCallback;
typedef base::Callback<
- void(base::PlatformFileError result,
- const base::PlatformFileInfo& file_info,
+ void(base::File::Error result,
+ const base::File::Info& file_info,
const base::FilePath& platform_path,
const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref)>
CreateSnapshotFileCallback;
diff --git a/webkit/browser/fileapi/async_file_util_adapter.cc b/webkit/browser/fileapi/async_file_util_adapter.cc
index b25ddf2..69500025 100644
--- a/webkit/browser/fileapi/async_file_util_adapter.cc
+++ b/webkit/browser/fileapi/async_file_util_adapter.cc
@@ -19,7 +19,6 @@
using base::Bind;
using base::Callback;
using base::Owned;
-using base::PlatformFileError;
using base::Unretained;
using webkit_blob::ShareableFileReference;
@@ -29,7 +28,7 @@
class EnsureFileExistsHelper {
public:
- EnsureFileExistsHelper() : error_(base::PLATFORM_FILE_OK), created_(false) {}
+ EnsureFileExistsHelper() : error_(base::File::FILE_OK), created_(false) {}
void RunWork(FileSystemFileUtil* file_util,
FileSystemOperationContext* context,
@@ -42,7 +41,7 @@
}
private:
- base::PlatformFileError error_;
+ base::File::Error error_;
bool created_;
DISALLOW_COPY_AND_ASSIGN(EnsureFileExistsHelper);
};
@@ -50,7 +49,7 @@
class GetFileInfoHelper {
public:
GetFileInfoHelper()
- : error_(base::PLATFORM_FILE_OK) {}
+ : error_(base::File::FILE_OK) {}
void GetFileInfo(FileSystemFileUtil* file_util,
FileSystemOperationContext* context,
@@ -76,8 +75,8 @@
}
private:
- base::PlatformFileError error_;
- base::PlatformFileInfo file_info_;
+ base::File::Error error_;
+ base::File::Info file_info_;
base::FilePath platform_path_;
webkit_blob::ScopedFile scoped_file_;
DISALLOW_COPY_AND_ASSIGN(GetFileInfoHelper);
@@ -85,21 +84,21 @@
class ReadDirectoryHelper {
public:
- ReadDirectoryHelper() : error_(base::PLATFORM_FILE_OK) {}
+ ReadDirectoryHelper() : error_(base::File::FILE_OK) {}
void RunWork(FileSystemFileUtil* file_util,
FileSystemOperationContext* context,
const FileSystemURL& url) {
- base::PlatformFileInfo file_info;
+ base::File::Info file_info;
base::FilePath platform_path;
- PlatformFileError error = file_util->GetFileInfo(
+ base::File::Error error = file_util->GetFileInfo(
context, url, &file_info, &platform_path);
- if (error != base::PLATFORM_FILE_OK) {
+ if (error != base::File::FILE_OK) {
error_ = error;
return;
}
if (!file_info.is_directory) {
- error_ = base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY;
+ error_ = base::File::FILE_ERROR_NOT_A_DIRECTORY;
return;
}
@@ -115,7 +114,7 @@
entry.last_modified_time = file_enum->LastModifiedTime();
entries_.push_back(entry);
}
- error_ = base::PLATFORM_FILE_OK;
+ error_ = base::File::FILE_OK;
}
void Reply(const AsyncFileUtil::ReadDirectoryCallback& callback) {
@@ -123,14 +122,14 @@
}
private:
- base::PlatformFileError error_;
+ base::File::Error error_;
std::vector<DirectoryEntry> entries_;
DISALLOW_COPY_AND_ASSIGN(ReadDirectoryHelper);
};
void RunCreateOrOpenCallback(
const AsyncFileUtil::CreateOrOpenCallback& callback,
- base::PlatformFileError result,
+ base::File::Error result,
base::PassPlatformFile file,
bool created) {
callback.Run(result, file, base::Closure());
@@ -332,7 +331,7 @@
scoped_ptr<FileSystemOperationContext> context,
const FileSystemURL& url,
const StatusCallback& callback) {
- callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION);
+ callback.Run(base::File::FILE_ERROR_INVALID_OPERATION);
}
void AsyncFileUtilAdapter::CreateSnapshotFile(
diff --git a/webkit/browser/fileapi/copy_or_move_file_validator.h b/webkit/browser/fileapi/copy_or_move_file_validator.h
index 2bd4df17..d497409 100644
--- a/webkit/browser/fileapi/copy_or_move_file_validator.h
+++ b/webkit/browser/fileapi/copy_or_move_file_validator.h
@@ -6,7 +6,7 @@
#define WEBKIT_BROWSER_FILEAPI_COPY_OR_MOVE_FILE_VALIDATOR_H_
#include "base/callback.h"
-#include "base/platform_file.h"
+#include "base/files/file.h"
#include "webkit/browser/webkit_storage_browser_export.h"
namespace base {
@@ -21,7 +21,7 @@
public:
// Callback that is invoked when validation completes. A result of
// base::PLATFORM_FILE_OK means the file validated.
- typedef base::Callback<void(base::PlatformFileError result)> ResultCallback;
+ typedef base::Callback<void(base::File::Error result)> ResultCallback;
virtual ~CopyOrMoveFileValidator() {}
diff --git a/webkit/browser/fileapi/copy_or_move_operation_delegate.cc b/webkit/browser/fileapi/copy_or_move_operation_delegate.cc
index 66f32fdb..699e3e3c 100644
--- a/webkit/browser/fileapi/copy_or_move_operation_delegate.cc
+++ b/webkit/browser/fileapi/copy_or_move_operation_delegate.cc
@@ -128,14 +128,14 @@
private:
void RunAfterCreateSnapshot(
const CopyOrMoveOperationDelegate::StatusCallback& callback,
- base::PlatformFileError error,
- const base::PlatformFileInfo& file_info,
+ base::File::Error error,
+ const base::File::Info& file_info,
const base::FilePath& platform_path,
const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref) {
if (cancel_requested_)
- error = base::PLATFORM_FILE_ERROR_ABORT;
+ error = base::File::FILE_ERROR_ABORT;
- if (error != base::PLATFORM_FILE_OK) {
+ if (error != base::File::FILE_OK) {
callback.Run(error);
return;
}
@@ -147,7 +147,7 @@
if (!validator_factory_) {
// No validation is needed.
RunAfterPreWriteValidation(platform_path, file_info, file_ref, callback,
- base::PLATFORM_FILE_OK);
+ base::File::FILE_OK);
return;
}
@@ -161,14 +161,14 @@
void RunAfterPreWriteValidation(
const base::FilePath& platform_path,
- const base::PlatformFileInfo& file_info,
+ const base::File::Info& file_info,
const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref,
const CopyOrMoveOperationDelegate::StatusCallback& callback,
- base::PlatformFileError error) {
+ base::File::Error error) {
if (cancel_requested_)
- error = base::PLATFORM_FILE_ERROR_ABORT;
+ error = base::File::FILE_ERROR_ABORT;
- if (error != base::PLATFORM_FILE_OK) {
+ if (error != base::File::FILE_OK) {
callback.Run(error);
return;
}
@@ -182,14 +182,14 @@
}
void RunAfterCopyInForeignFile(
- const base::PlatformFileInfo& file_info,
+ const base::File::Info& file_info,
const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref,
const CopyOrMoveOperationDelegate::StatusCallback& callback,
- base::PlatformFileError error) {
+ base::File::Error error) {
if (cancel_requested_)
- error = base::PLATFORM_FILE_ERROR_ABORT;
+ error = base::File::FILE_ERROR_ABORT;
- if (error != base::PLATFORM_FILE_OK) {
+ if (error != base::File::FILE_OK) {
callback.Run(error);
return;
}
@@ -197,7 +197,7 @@
file_progress_callback_.Run(file_info.size);
if (option_ == FileSystemOperation::OPTION_NONE) {
- RunAfterTouchFile(callback, base::PLATFORM_FILE_OK);
+ RunAfterTouchFile(callback, base::File::FILE_OK);
return;
}
@@ -210,11 +210,11 @@
void RunAfterTouchFile(
const CopyOrMoveOperationDelegate::StatusCallback& callback,
- base::PlatformFileError error) {
+ base::File::Error error) {
// Even if TouchFile is failed, just ignore it.
if (cancel_requested_) {
- callback.Run(base::PLATFORM_FILE_ERROR_ABORT);
+ callback.Run(base::File::FILE_ERROR_ABORT);
return;
}
@@ -222,7 +222,7 @@
// validation.
if (!validator_) {
// No validation is needed.
- RunAfterPostWriteValidation(callback, base::PLATFORM_FILE_OK);
+ RunAfterPostWriteValidation(callback, base::File::FILE_OK);
return;
}
@@ -233,13 +233,13 @@
void RunAfterPostWriteValidation(
const CopyOrMoveOperationDelegate::StatusCallback& callback,
- base::PlatformFileError error) {
+ base::File::Error error) {
if (cancel_requested_) {
- callback.Run(base::PLATFORM_FILE_ERROR_ABORT);
+ callback.Run(base::File::FILE_ERROR_ABORT);
return;
}
- if (error != base::PLATFORM_FILE_OK) {
+ if (error != base::File::FILE_OK) {
// Failed to validate. Remove the destination file.
operation_runner_->Remove(
dest_url_, true /* recursive */,
@@ -249,7 +249,7 @@
}
if (operation_type_ == CopyOrMoveOperationDelegate::OPERATION_COPY) {
- callback.Run(base::PLATFORM_FILE_OK);
+ callback.Run(base::File::FILE_OK);
return;
}
@@ -264,20 +264,20 @@
void RunAfterRemoveSourceForMove(
const CopyOrMoveOperationDelegate::StatusCallback& callback,
- base::PlatformFileError error) {
+ base::File::Error error) {
if (cancel_requested_)
- error = base::PLATFORM_FILE_ERROR_ABORT;
+ error = base::File::FILE_ERROR_ABORT;
- if (error == base::PLATFORM_FILE_ERROR_NOT_FOUND)
- error = base::PLATFORM_FILE_OK;
+ if (error == base::File::FILE_ERROR_NOT_FOUND)
+ error = base::File::FILE_OK;
callback.Run(error);
}
void DidRemoveDestForError(
- base::PlatformFileError prior_error,
+ base::File::Error prior_error,
const CopyOrMoveOperationDelegate::StatusCallback& callback,
- base::PlatformFileError error) {
- if (error != base::PLATFORM_FILE_OK) {
+ base::File::Error error) {
+ if (error != base::File::FILE_OK) {
VLOG(1) << "Error removing destination file after validation error: "
<< error;
}
@@ -307,14 +307,14 @@
void PostWriteValidationAfterCreateSnapshotFile(
const CopyOrMoveOperationDelegate::StatusCallback& callback,
- base::PlatformFileError error,
- const base::PlatformFileInfo& file_info,
+ base::File::Error error,
+ const base::File::Info& file_info,
const base::FilePath& platform_path,
const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref) {
if (cancel_requested_)
- error = base::PLATFORM_FILE_ERROR_ABORT;
+ error = base::File::FILE_ERROR_ABORT;
- if (error != base::PLATFORM_FILE_OK) {
+ if (error != base::File::FILE_OK) {
callback.Run(error);
return;
}
@@ -333,7 +333,7 @@
void DidPostWriteValidation(
const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref,
const CopyOrMoveOperationDelegate::StatusCallback& callback,
- base::PlatformFileError error) {
+ base::File::Error error) {
callback.Run(error);
}
@@ -406,19 +406,19 @@
private:
void RunAfterGetMetadataForSource(
const CopyOrMoveOperationDelegate::StatusCallback& callback,
- base::PlatformFileError error,
- const base::PlatformFileInfo& file_info) {
+ base::File::Error error,
+ const base::File::Info& file_info) {
if (cancel_requested_)
- error = base::PLATFORM_FILE_ERROR_ABORT;
+ error = base::File::FILE_ERROR_ABORT;
- if (error != base::PLATFORM_FILE_OK) {
+ if (error != base::File::FILE_OK) {
callback.Run(error);
return;
}
if (file_info.is_directory) {
// If not a directory, failed with appropriate error code.
- callback.Run(base::PLATFORM_FILE_ERROR_NOT_A_FILE);
+ callback.Run(base::File::FILE_ERROR_NOT_A_FILE);
return;
}
@@ -433,11 +433,11 @@
void RunAfterCreateFileForDestination(
const CopyOrMoveOperationDelegate::StatusCallback& callback,
const base::Time& last_modified,
- base::PlatformFileError error) {
+ base::File::Error error) {
if (cancel_requested_)
- error = base::PLATFORM_FILE_ERROR_ABORT;
+ error = base::File::FILE_ERROR_ABORT;
- if (error != base::PLATFORM_FILE_OK) {
+ if (error != base::File::FILE_OK) {
callback.Run(error);
return;
}
@@ -462,17 +462,17 @@
void RunAfterStreamCopy(
const CopyOrMoveOperationDelegate::StatusCallback& callback,
const base::Time& last_modified,
- base::PlatformFileError error) {
+ base::File::Error error) {
if (cancel_requested_)
- error = base::PLATFORM_FILE_ERROR_ABORT;
+ error = base::File::FILE_ERROR_ABORT;
- if (error != base::PLATFORM_FILE_OK) {
+ if (error != base::File::FILE_OK) {
callback.Run(error);
return;
}
if (option_ == FileSystemOperation::OPTION_NONE) {
- RunAfterTouchFile(callback, base::PLATFORM_FILE_OK);
+ RunAfterTouchFile(callback, base::File::FILE_OK);
return;
}
@@ -484,15 +484,15 @@
void RunAfterTouchFile(
const CopyOrMoveOperationDelegate::StatusCallback& callback,
- base::PlatformFileError error) {
+ base::File::Error error) {
// Even if TouchFile is failed, just ignore it.
if (cancel_requested_) {
- callback.Run(base::PLATFORM_FILE_ERROR_ABORT);
+ callback.Run(base::File::FILE_ERROR_ABORT);
return;
}
if (operation_type_ == CopyOrMoveOperationDelegate::OPERATION_COPY) {
- callback.Run(base::PLATFORM_FILE_OK);
+ callback.Run(base::File::FILE_OK);
return;
}
@@ -507,11 +507,11 @@
void RunAfterRemoveForMove(
const CopyOrMoveOperationDelegate::StatusCallback& callback,
- base::PlatformFileError error) {
+ base::File::Error error) {
if (cancel_requested_)
- error = base::PLATFORM_FILE_ERROR_ABORT;
- if (error == base::PLATFORM_FILE_ERROR_NOT_FOUND)
- error = base::PLATFORM_FILE_OK;
+ error = base::File::FILE_ERROR_ABORT;
+ if (error == base::File::FILE_ERROR_NOT_FOUND)
+ error = base::File::FILE_OK;
callback.Run(error);
}
@@ -579,12 +579,12 @@
void CopyOrMoveOperationDelegate::StreamCopyHelper::DidRead(
const StatusCallback& callback, int result) {
if (cancel_requested_) {
- callback.Run(base::PLATFORM_FILE_ERROR_ABORT);
+ callback.Run(base::File::FILE_ERROR_ABORT);
return;
}
if (result < 0) {
- callback.Run(NetErrorToPlatformFileError(result));
+ callback.Run(NetErrorToFileError(result));
return;
}
@@ -593,7 +593,7 @@
if (need_flush_)
Flush(callback, true /* is_eof */);
else
- callback.Run(base::PLATFORM_FILE_OK);
+ callback.Run(base::File::FILE_OK);
return;
}
@@ -618,12 +618,12 @@
scoped_refptr<net::DrainableIOBuffer> buffer,
int result) {
if (cancel_requested_) {
- callback.Run(base::PLATFORM_FILE_ERROR_ABORT);
+ callback.Run(base::File::FILE_ERROR_ABORT);
return;
}
if (result < 0) {
- callback.Run(NetErrorToPlatformFileError(result));
+ callback.Run(NetErrorToFileError(result));
return;
}
@@ -663,13 +663,13 @@
void CopyOrMoveOperationDelegate::StreamCopyHelper::DidFlush(
const StatusCallback& callback, bool is_eof, int result) {
if (cancel_requested_) {
- callback.Run(base::PLATFORM_FILE_ERROR_ABORT);
+ callback.Run(base::File::FILE_ERROR_ABORT);
return;
}
previous_flush_offset_ = num_copied_bytes_;
if (is_eof)
- callback.Run(NetErrorToPlatformFileError(result));
+ callback.Run(NetErrorToFileError(result));
else
Read(callback);
}
@@ -707,7 +707,7 @@
// It is an error to try to copy/move an entry into its child.
if (same_file_system_ && src_root_.path().IsParent(dest_root_.path())) {
- callback_.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION);
+ callback_.Run(base::File::FILE_ERROR_INVALID_OPERATION);
return;
}
@@ -715,7 +715,7 @@
// In JS API this should return error, but we return success because Pepper
// wants to return success and we have a code path that returns error in
// Blink for JS (http://crbug.com/329517).
- callback_.Run(base::PLATFORM_FILE_OK);
+ callback_.Run(base::File::FILE_OK);
return;
}
@@ -743,11 +743,11 @@
weak_factory_.GetWeakPtr(), src_url));
} else {
// Cross filesystem case.
- base::PlatformFileError error = base::PLATFORM_FILE_ERROR_FAILED;
+ base::File::Error error = base::File::FILE_ERROR_FAILED;
CopyOrMoveFileValidatorFactory* validator_factory =
file_system_context()->GetCopyOrMoveFileValidatorFactory(
dest_root_.type(), &error);
- if (error != base::PLATFORM_FILE_OK) {
+ if (error != base::File::FILE_OK) {
callback.Run(error);
return;
}
@@ -812,7 +812,7 @@
const StatusCallback& callback) {
if (option_ == FileSystemOperation::OPTION_NONE) {
PostProcessDirectoryAfterTouchFile(
- src_url, callback, base::PLATFORM_FILE_OK);
+ src_url, callback, base::File::FILE_OK);
return;
}
@@ -835,11 +835,11 @@
const FileSystemURL& dest_url,
const StatusCallback& callback,
CopyOrMoveImpl* impl,
- base::PlatformFileError error) {
+ base::File::Error error) {
running_copy_set_.erase(impl);
delete impl;
- if (!progress_callback_.is_null() && error == base::PLATFORM_FILE_OK) {
+ if (!progress_callback_.is_null() && error == base::File::FILE_OK) {
progress_callback_.Run(
FileSystemOperation::END_COPY_ENTRY, src_url, dest_url, 0);
}
@@ -849,13 +849,13 @@
void CopyOrMoveOperationDelegate::DidTryRemoveDestRoot(
const StatusCallback& callback,
- base::PlatformFileError error) {
- if (error == base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY) {
- callback_.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION);
+ base::File::Error error) {
+ if (error == base::File::FILE_ERROR_NOT_A_DIRECTORY) {
+ callback_.Run(base::File::FILE_ERROR_INVALID_OPERATION);
return;
}
- if (error != base::PLATFORM_FILE_OK &&
- error != base::PLATFORM_FILE_ERROR_NOT_FOUND) {
+ if (error != base::File::FILE_OK &&
+ error != base::File::FILE_ERROR_NOT_FOUND) {
callback_.Run(error);
return;
}
@@ -881,8 +881,8 @@
const FileSystemURL& src_url,
const FileSystemURL& dest_url,
const StatusCallback& callback,
- base::PlatformFileError error) {
- if (!progress_callback_.is_null() && error == base::PLATFORM_FILE_OK) {
+ base::File::Error error) {
+ if (!progress_callback_.is_null() && error == base::File::FILE_OK) {
progress_callback_.Run(
FileSystemOperation::END_COPY_ENTRY, src_url, dest_url, 0);
}
@@ -893,12 +893,12 @@
void CopyOrMoveOperationDelegate::PostProcessDirectoryAfterGetMetadata(
const FileSystemURL& src_url,
const StatusCallback& callback,
- base::PlatformFileError error,
- const base::PlatformFileInfo& file_info) {
- if (error != base::PLATFORM_FILE_OK) {
+ base::File::Error error,
+ const base::File::Info& file_info) {
+ if (error != base::File::FILE_OK) {
// Ignore the error, and run post process which should run after TouchFile.
PostProcessDirectoryAfterTouchFile(
- src_url, callback, base::PLATFORM_FILE_OK);
+ src_url, callback, base::File::FILE_OK);
return;
}
@@ -913,11 +913,11 @@
void CopyOrMoveOperationDelegate::PostProcessDirectoryAfterTouchFile(
const FileSystemURL& src_url,
const StatusCallback& callback,
- base::PlatformFileError error) {
+ base::File::Error error) {
// Even if the TouchFile is failed, just ignore it.
if (operation_type_ == OPERATION_COPY) {
- callback.Run(base::PLATFORM_FILE_OK);
+ callback.Run(base::File::FILE_OK);
return;
}
@@ -933,9 +933,9 @@
void CopyOrMoveOperationDelegate::DidRemoveSourceForMove(
const StatusCallback& callback,
- base::PlatformFileError error) {
- if (error == base::PLATFORM_FILE_ERROR_NOT_FOUND)
- error = base::PLATFORM_FILE_OK;
+ base::File::Error error) {
+ if (error == base::File::FILE_ERROR_NOT_FOUND)
+ error = base::File::FILE_OK;
callback.Run(error);
}
diff --git a/webkit/browser/fileapi/copy_or_move_operation_delegate.h b/webkit/browser/fileapi/copy_or_move_operation_delegate.h
index 2247c872..bb0c1f9 100644
--- a/webkit/browser/fileapi/copy_or_move_operation_delegate.h
+++ b/webkit/browser/fileapi/copy_or_move_operation_delegate.h
@@ -119,26 +119,26 @@
const FileSystemURL& dest_url,
const StatusCallback& callback,
CopyOrMoveImpl* impl,
- base::PlatformFileError error);
+ base::File::Error error);
void DidTryRemoveDestRoot(const StatusCallback& callback,
- base::PlatformFileError error);
+ base::File::Error error);
void ProcessDirectoryInternal(const FileSystemURL& src_url,
const FileSystemURL& dest_url,
const StatusCallback& callback);
void DidCreateDirectory(const FileSystemURL& src_url,
const FileSystemURL& dest_url,
const StatusCallback& callback,
- base::PlatformFileError error);
+ base::File::Error error);
void PostProcessDirectoryAfterGetMetadata(
const FileSystemURL& src_url,
const StatusCallback& callback,
- base::PlatformFileError error,
- const base::PlatformFileInfo& file_info);
+ base::File::Error error,
+ const base::File::Info& file_info);
void PostProcessDirectoryAfterTouchFile(const FileSystemURL& src_url,
const StatusCallback& callback,
- base::PlatformFileError error);
+ base::File::Error error);
void DidRemoveSourceForMove(const StatusCallback& callback,
- base::PlatformFileError error);
+ base::File::Error error);
void OnCopyFileProgress(const FileSystemURL& src_url, int64 size);
FileSystemURL CreateDestURL(const FileSystemURL& src_url) const;
diff --git a/webkit/browser/fileapi/dragged_file_util.cc b/webkit/browser/fileapi/dragged_file_util.cc
index 3e81242..0243b3d 100644
--- a/webkit/browser/fileapi/dragged_file_util.cc
+++ b/webkit/browser/fileapi/dragged_file_util.cc
@@ -15,9 +15,6 @@
#include "webkit/browser/fileapi/native_file_util.h"
#include "webkit/common/blob/shareable_file_reference.h"
-using base::PlatformFileError;
-using base::PlatformFileInfo;
-
namespace fileapi {
typedef IsolatedContext::MountPointInfo FileInfo;
@@ -51,7 +48,7 @@
private:
std::vector<FileInfo> files_;
std::vector<FileInfo>::const_iterator file_iter_;
- base::PlatformFileInfo file_info_;
+ base::File::Info file_info_;
};
} // namespace
@@ -60,10 +57,10 @@
DraggedFileUtil::DraggedFileUtil() {}
-PlatformFileError DraggedFileUtil::GetFileInfo(
+base::File::Error DraggedFileUtil::GetFileInfo(
FileSystemOperationContext* context,
const FileSystemURL& url,
- PlatformFileInfo* file_info,
+ base::File::Info* file_info,
base::FilePath* platform_path) {
DCHECK(file_info);
std::string filesystem_id;
@@ -77,15 +74,15 @@
file_info->is_directory = true;
file_info->is_symbolic_link = false;
file_info->size = 0;
- return base::PLATFORM_FILE_OK;
+ return base::File::FILE_OK;
}
- base::PlatformFileError error =
+ base::File::Error error =
NativeFileUtil::GetFileInfo(url.path(), file_info);
if (base::IsLink(url.path()) && !base::FilePath().IsParent(url.path())) {
// Don't follow symlinks unless it's the one that are selected by the user.
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ return base::File::FILE_ERROR_NOT_FOUND;
}
- if (error == base::PLATFORM_FILE_OK)
+ if (error == base::File::FILE_OK)
*platform_path = url.path();
return error;
}
diff --git a/webkit/browser/fileapi/dragged_file_util.h b/webkit/browser/fileapi/dragged_file_util.h
index 22c538e1..8807fc1 100644
--- a/webkit/browser/fileapi/dragged_file_util.h
+++ b/webkit/browser/fileapi/dragged_file_util.h
@@ -23,10 +23,10 @@
virtual ~DraggedFileUtil() {}
// FileSystemFileUtil overrides.
- virtual base::PlatformFileError GetFileInfo(
+ virtual base::File::Error GetFileInfo(
FileSystemOperationContext* context,
const FileSystemURL& url,
- base::PlatformFileInfo* file_info,
+ base::File::Info* file_info,
base::FilePath* platform_path) OVERRIDE;
virtual scoped_ptr<AbstractFileEnumerator> CreateFileEnumerator(
FileSystemOperationContext* context,
diff --git a/webkit/browser/fileapi/file_system_backend.h b/webkit/browser/fileapi/file_system_backend.h
index 048c86d..e475a20 100644
--- a/webkit/browser/fileapi/file_system_backend.h
+++ b/webkit/browser/fileapi/file_system_backend.h
@@ -9,9 +9,9 @@
#include <vector>
#include "base/callback_forward.h"
+#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/memory/scoped_ptr.h"
-#include "base/platform_file.h"
#include "webkit/browser/fileapi/file_permission_policy.h"
#include "webkit/browser/fileapi/open_file_system_mode.h"
#include "webkit/browser/webkit_storage_browser_export.h"
@@ -44,7 +44,7 @@
// Callback for InitializeFileSystem.
typedef base::Callback<void(const GURL& root_url,
const std::string& name,
- base::PlatformFileError error)>
+ base::File::Error error)>
OpenFileSystemCallback;
virtual ~FileSystemBackend() {}
@@ -76,7 +76,7 @@
// and |type|. If |error_code| is PLATFORM_FILE_OK and the result is NULL,
// then no validator is required.
virtual CopyOrMoveFileValidatorFactory* GetCopyOrMoveFileValidatorFactory(
- FileSystemType type, base::PlatformFileError* error_code) = 0;
+ FileSystemType type, base::File::Error* error_code) = 0;
// Returns a new instance of the specialized FileSystemOperation for this
// backend based on the given triplet of |origin_url|, |file_system_type|
@@ -87,7 +87,7 @@
virtual FileSystemOperation* CreateFileSystemOperation(
const FileSystemURL& url,
FileSystemContext* context,
- base::PlatformFileError* error_code) const = 0;
+ base::File::Error* error_code) const = 0;
// Creates a new file stream reader for a given filesystem URL |url| with an
// offset |offset|. |expected_modification_time| specifies the expected last
diff --git a/webkit/browser/fileapi/file_system_context.cc b/webkit/browser/fileapi/file_system_context.cc
index 49d00a5..444ef46 100644
--- a/webkit/browser/fileapi/file_system_context.cc
+++ b/webkit/browser/fileapi/file_system_context.cc
@@ -47,9 +47,9 @@
const base::FilePath& path,
const FileSystemContext::ResolveURLCallback& callback,
const FileSystemInfo& info,
- base::PlatformFileError error,
- const base::PlatformFileInfo& file_info) {
- if (error != base::PLATFORM_FILE_OK) {
+ base::File::Error error,
+ const base::File::Info& file_info) {
+ if (error != base::File::FILE_OK) {
callback.Run(error, FileSystemInfo(), base::FilePath(), false);
return;
}
@@ -184,7 +184,7 @@
continue;
if (backend->GetQuotaUtil()->DeleteOriginDataOnFileTaskRunner(
this, quota_manager_proxy(), origin_url, iter->first)
- != base::PLATFORM_FILE_OK) {
+ != base::File::FILE_OK) {
// Continue the loop, but record the failure.
success = false;
}
@@ -233,9 +233,9 @@
CopyOrMoveFileValidatorFactory*
FileSystemContext::GetCopyOrMoveFileValidatorFactory(
- FileSystemType type, base::PlatformFileError* error_code) const {
+ FileSystemType type, base::File::Error* error_code) const {
DCHECK(error_code);
- *error_code = base::PLATFORM_FILE_OK;
+ *error_code = base::File::FILE_OK;
FileSystemBackend* backend = GetFileSystemBackend(type);
if (!backend)
return NULL;
@@ -297,13 +297,13 @@
if (!FileSystemContext::IsSandboxFileSystem(type)) {
// Disallow opening a non-sandboxed filesystem.
- callback.Run(GURL(), std::string(), base::PLATFORM_FILE_ERROR_SECURITY);
+ callback.Run(GURL(), std::string(), base::File::FILE_ERROR_SECURITY);
return;
}
FileSystemBackend* backend = GetFileSystemBackend(type);
if (!backend) {
- callback.Run(GURL(), std::string(), base::PLATFORM_FILE_ERROR_SECURITY);
+ callback.Run(GURL(), std::string(), base::File::FILE_ERROR_SECURITY);
return;
}
@@ -324,17 +324,17 @@
// more generally. http://crbug.com/304062.
FileSystemInfo info = GetFileSystemInfoForChromeOS(url.origin());
DidOpenFileSystemForResolveURL(
- url, callback, info.root_url, info.name, base::PLATFORM_FILE_OK);
+ url, callback, info.root_url, info.name, base::File::FILE_OK);
return;
#endif
- callback.Run(base::PLATFORM_FILE_ERROR_SECURITY,
+ callback.Run(base::File::FILE_ERROR_SECURITY,
FileSystemInfo(), base::FilePath(), false);
return;
}
FileSystemBackend* backend = GetFileSystemBackend(url.type());
if (!backend) {
- callback.Run(base::PLATFORM_FILE_ERROR_SECURITY,
+ callback.Run(base::File::FILE_ERROR_SECURITY,
FileSystemInfo(), base::FilePath(), false);
return;
}
@@ -356,11 +356,11 @@
FileSystemBackend* backend = GetFileSystemBackend(type);
if (!backend) {
- callback.Run(base::PLATFORM_FILE_ERROR_SECURITY);
+ callback.Run(base::File::FILE_ERROR_SECURITY);
return;
}
if (!backend->GetQuotaUtil()) {
- callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION);
+ callback.Run(base::File::FILE_ERROR_INVALID_OPERATION);
return;
}
@@ -461,21 +461,21 @@
}
FileSystemOperation* FileSystemContext::CreateFileSystemOperation(
- const FileSystemURL& url, base::PlatformFileError* error_code) {
+ const FileSystemURL& url, base::File::Error* error_code) {
if (!url.is_valid()) {
if (error_code)
- *error_code = base::PLATFORM_FILE_ERROR_INVALID_URL;
+ *error_code = base::File::FILE_ERROR_INVALID_URL;
return NULL;
}
FileSystemBackend* backend = GetFileSystemBackend(url.type());
if (!backend) {
if (error_code)
- *error_code = base::PLATFORM_FILE_ERROR_FAILED;
+ *error_code = base::File::FILE_ERROR_FAILED;
return NULL;
}
- base::PlatformFileError fs_error = base::PLATFORM_FILE_OK;
+ base::File::Error fs_error = base::File::FILE_OK;
FileSystemOperation* operation =
backend->CreateFileSystemOperation(url, this, &fs_error);
@@ -543,10 +543,10 @@
const FileSystemContext::ResolveURLCallback& callback,
const GURL& filesystem_root,
const std::string& filesystem_name,
- base::PlatformFileError error) {
+ base::File::Error error) {
DCHECK(io_task_runner_->RunsTasksOnCurrentThread());
- if (error != base::PLATFORM_FILE_OK) {
+ if (error != base::File::FILE_OK) {
callback.Run(error, FileSystemInfo(), base::FilePath(), false);
return;
}
diff --git a/webkit/browser/fileapi/file_system_context.h b/webkit/browser/fileapi/file_system_context.h
index 9f81bba..04c9fa6 100644
--- a/webkit/browser/fileapi/file_system_context.h
+++ b/webkit/browser/fileapi/file_system_context.h
@@ -10,10 +10,10 @@
#include <vector>
#include "base/callback.h"
+#include "base/files/file.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/scoped_vector.h"
-#include "base/platform_file.h"
#include "base/sequenced_task_runner_helpers.h"
#include "webkit/browser/fileapi/file_system_url.h"
#include "webkit/browser/fileapi/open_file_system_mode.h"
@@ -134,7 +134,7 @@
// |type|. If |error_code| is PLATFORM_FILE_OK and the result is NULL,
// then no validator is required.
CopyOrMoveFileValidatorFactory* GetCopyOrMoveFileValidatorFactory(
- FileSystemType type, base::PlatformFileError* error_code) const;
+ FileSystemType type, base::File::Error* error_code) const;
// Returns the file system backend instance for the given |type|.
// This may return NULL if it is given an invalid or unsupported filesystem
@@ -163,17 +163,17 @@
// Used for OpenFileSystem.
typedef base::Callback<void(const GURL& root,
const std::string& name,
- base::PlatformFileError result)>
+ base::File::Error result)>
OpenFileSystemCallback;
// Used for ResolveURL.
- typedef base::Callback<void(base::PlatformFileError result,
+ typedef base::Callback<void(base::File::Error result,
const FileSystemInfo& info,
const base::FilePath& file_path,
bool is_directory)> ResolveURLCallback;
// Used for DeleteFileSystem and OpenPluginPrivateFileSystem.
- typedef base::Callback<void(base::PlatformFileError result)> StatusCallback;
+ typedef base::Callback<void(base::File::Error result)> StatusCallback;
// Opens the filesystem for the given |origin_url| and |type|, and dispatches
// |callback| on completion.
@@ -296,7 +296,7 @@
// Called by FileSystemOperationRunner.
FileSystemOperation* CreateFileSystemOperation(
const FileSystemURL& url,
- base::PlatformFileError* error_code);
+ base::File::Error* error_code);
// For non-cracked isolated and external mount points, returns a FileSystemURL
// created by cracking |url|. The url is cracked using MountPoints registered
@@ -316,7 +316,7 @@
const ResolveURLCallback& callback,
const GURL& filesystem_root,
const std::string& filesystem_name,
- base::PlatformFileError error);
+ base::File::Error error);
// Returns a FileSystemBackend, used only by test code.
SandboxFileSystemBackend* sandbox_backend() const {
diff --git a/webkit/browser/fileapi/file_system_dir_url_request_job.cc b/webkit/browser/fileapi/file_system_dir_url_request_job.cc
index 7589b37..07c5d58 100644
--- a/webkit/browser/fileapi/file_system_dir_url_request_job.cc
+++ b/webkit/browser/fileapi/file_system_dir_url_request_job.cc
@@ -85,7 +85,7 @@
// In incognito mode the API is not usable and there should be no data.
if (url_.is_valid() && VirtualPath::IsRootPath(url_.virtual_path())) {
// Return an empty directory if the filesystem root is queried.
- DidReadDirectory(base::PLATFORM_FILE_OK,
+ DidReadDirectory(base::File::FILE_OK,
std::vector<DirectoryEntry>(),
false);
return;
@@ -100,12 +100,12 @@
}
void FileSystemDirURLRequestJob::DidReadDirectory(
- base::PlatformFileError result,
+ base::File::Error result,
const std::vector<DirectoryEntry>& entries,
bool has_more) {
- if (result != base::PLATFORM_FILE_OK) {
+ if (result != base::File::FILE_OK) {
int rv = net::ERR_FILE_NOT_FOUND;
- if (result == base::PLATFORM_FILE_ERROR_INVALID_URL)
+ if (result == base::File::FILE_ERROR_INVALID_URL)
rv = net::ERR_INVALID_URL;
NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, rv));
return;
diff --git a/webkit/browser/fileapi/file_system_dir_url_request_job.h b/webkit/browser/fileapi/file_system_dir_url_request_job.h
index 933550e..7346225 100644
--- a/webkit/browser/fileapi/file_system_dir_url_request_job.h
+++ b/webkit/browser/fileapi/file_system_dir_url_request_job.h
@@ -8,10 +8,10 @@
#include <string>
#include <vector>
+#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/memory/weak_ptr.h"
#include "base/message_loop/message_loop_proxy.h"
-#include "base/platform_file.h"
#include "net/url_request/url_request_job.h"
#include "webkit/browser/fileapi/file_system_url.h"
#include "webkit/browser/webkit_storage_browser_export.h"
@@ -49,7 +49,7 @@
virtual ~FileSystemDirURLRequestJob();
void StartAsync();
- void DidReadDirectory(base::PlatformFileError result,
+ void DidReadDirectory(base::File::Error result,
const std::vector<DirectoryEntry>& entries,
bool has_more);
diff --git a/webkit/browser/fileapi/file_system_file_stream_reader.cc b/webkit/browser/fileapi/file_system_file_stream_reader.cc
index f5427b7..5624565 100644
--- a/webkit/browser/fileapi/file_system_file_stream_reader.cc
+++ b/webkit/browser/fileapi/file_system_file_stream_reader.cc
@@ -117,16 +117,16 @@
void FileSystemFileStreamReader::DidCreateSnapshot(
const base::Closure& callback,
const net::CompletionCallback& error_callback,
- base::PlatformFileError file_error,
- const base::PlatformFileInfo& file_info,
+ base::File::Error file_error,
+ const base::File::Info& file_info,
const base::FilePath& platform_path,
const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref) {
DCHECK(has_pending_create_snapshot_);
DCHECK(!local_file_reader_.get());
has_pending_create_snapshot_ = false;
- if (file_error != base::PLATFORM_FILE_OK) {
- error_callback.Run(net::PlatformFileErrorToNetError(file_error));
+ if (file_error != base::File::FILE_OK) {
+ error_callback.Run(net::FileErrorToNetError(file_error));
return;
}
diff --git a/webkit/browser/fileapi/file_system_file_stream_reader.h b/webkit/browser/fileapi/file_system_file_stream_reader.h
index 4d36c427..3615022 100644
--- a/webkit/browser/fileapi/file_system_file_stream_reader.h
+++ b/webkit/browser/fileapi/file_system_file_stream_reader.h
@@ -6,8 +6,8 @@
#define WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_FILE_STREAM_READER_H_
#include "base/bind.h"
+#include "base/files/file.h"
#include "base/memory/ref_counted.h"
-#include "base/platform_file.h"
#include "base/time/time.h"
#include "webkit/browser/blob/file_stream_reader.h"
#include "webkit/browser/fileapi/file_system_url.h"
@@ -57,8 +57,8 @@
void DidCreateSnapshot(
const base::Closure& callback,
const net::CompletionCallback& error_callback,
- base::PlatformFileError file_error,
- const base::PlatformFileInfo& file_info,
+ base::File::Error file_error,
+ const base::File::Info& file_info,
const base::FilePath& platform_path,
const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref);
diff --git a/webkit/browser/fileapi/file_system_file_util.h b/webkit/browser/fileapi/file_system_file_util.h
index 5a4d730b..a9ee035 100644
--- a/webkit/browser/fileapi/file_system_file_util.h
+++ b/webkit/browser/fileapi/file_system_file_util.h
@@ -5,6 +5,7 @@
#ifndef WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_FILE_UTIL_H_
#define WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_FILE_UTIL_H_
+#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/memory/scoped_ptr.h"
#include "base/platform_file.h"
@@ -60,7 +61,7 @@
// Creates or opens a file with the given flags.
// See header comments for AsyncFileUtil::CreateOrOpen() for more details.
// This is used only by Pepper/NaCl File API.
- virtual base::PlatformFileError CreateOrOpen(
+ virtual base::File::Error CreateOrOpen(
FileSystemOperationContext* context,
const FileSystemURL& url,
int file_flags,
@@ -69,20 +70,20 @@
// Closes the given file handle.
// This is used only for Pepper/NaCl File API.
- virtual base::PlatformFileError Close(
+ virtual base::File::Error Close(
FileSystemOperationContext* context,
base::PlatformFile file) = 0;
// Ensures that the given |url| exist. This creates a empty new file
// at |url| if the |url| does not exist.
// See header comments for AsyncFileUtil::EnsureFileExists() for more details.
- virtual base::PlatformFileError EnsureFileExists(
+ virtual base::File::Error EnsureFileExists(
FileSystemOperationContext* context,
const FileSystemURL& url, bool* created) = 0;
// Creates directory at given url.
// See header comments for AsyncFileUtil::CreateDirectory() for more details.
- virtual base::PlatformFileError CreateDirectory(
+ virtual base::File::Error CreateDirectory(
FileSystemOperationContext* context,
const FileSystemURL& url,
bool exclusive,
@@ -90,10 +91,10 @@
// Retrieves the information about a file.
// See header comments for AsyncFileUtil::GetFileInfo() for more details.
- virtual base::PlatformFileError GetFileInfo(
+ virtual base::File::Error GetFileInfo(
FileSystemOperationContext* context,
const FileSystemURL& url,
- base::PlatformFileInfo* file_info,
+ base::File::Info* file_info,
base::FilePath* platform_path) = 0;
// Returns a pointer to a new instance of AbstractFileEnumerator which is
@@ -110,14 +111,14 @@
// Maps |file_system_url| given |context| into |local_file_path|
// which represents physical file location on the host OS.
// This may not always make sense for all subclasses.
- virtual base::PlatformFileError GetLocalFilePath(
+ virtual base::File::Error GetLocalFilePath(
FileSystemOperationContext* context,
const FileSystemURL& file_system_url,
base::FilePath* local_file_path) = 0;
// Updates the file metadata information.
// See header comments for AsyncFileUtil::Touch() for more details.
- virtual base::PlatformFileError Touch(
+ virtual base::File::Error Touch(
FileSystemOperationContext* context,
const FileSystemURL& url,
const base::Time& last_access_time,
@@ -125,7 +126,7 @@
// Truncates a file to the given length.
// See header comments for AsyncFileUtil::Truncate() for more details.
- virtual base::PlatformFileError Truncate(
+ virtual base::File::Error Truncate(
FileSystemOperationContext* context,
const FileSystemURL& url,
int64 length) = 0;
@@ -143,7 +144,7 @@
// - PLATFORM_FILE_ERROR_FAILED if |dest_url| does not exist and
// its parent path is a file.
//
- virtual base::PlatformFileError CopyOrMoveFile(
+ virtual base::File::Error CopyOrMoveFile(
FileSystemOperationContext* context,
const FileSystemURL& src_url,
const FileSystemURL& dest_url,
@@ -153,20 +154,20 @@
// Copies in a single file from a different filesystem.
// See header comments for AsyncFileUtil::CopyInForeignFile() for
// more details.
- virtual base::PlatformFileError CopyInForeignFile(
+ virtual base::File::Error CopyInForeignFile(
FileSystemOperationContext* context,
const base::FilePath& src_file_path,
const FileSystemURL& dest_url) = 0;
// Deletes a single file.
// See header comments for AsyncFileUtil::DeleteFile() for more details.
- virtual base::PlatformFileError DeleteFile(
+ virtual base::File::Error DeleteFile(
FileSystemOperationContext* context,
const FileSystemURL& url) = 0;
// Deletes a single empty directory.
// See header comments for AsyncFileUtil::DeleteDirectory() for more details.
- virtual base::PlatformFileError DeleteDirectory(
+ virtual base::File::Error DeleteDirectory(
FileSystemOperationContext* context,
const FileSystemURL& url) = 0;
@@ -178,8 +179,8 @@
virtual webkit_blob::ScopedFile CreateSnapshotFile(
FileSystemOperationContext* context,
const FileSystemURL& url,
- base::PlatformFileError* error,
- base::PlatformFileInfo* file_info,
+ base::File::Error* error,
+ base::File::Info* file_info,
base::FilePath* platform_path) = 0;
protected:
diff --git a/webkit/browser/fileapi/file_system_operation.h b/webkit/browser/fileapi/file_system_operation.h
index ded87f7..cc35be46 100644
--- a/webkit/browser/fileapi/file_system_operation.h
+++ b/webkit/browser/fileapi/file_system_operation.h
@@ -8,6 +8,7 @@
#include <vector>
#include "base/callback.h"
+#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/platform_file.h"
#include "base/process/process.h"
@@ -66,19 +67,19 @@
virtual ~FileSystemOperation() {}
// Used for CreateFile(), etc. |result| is the return code of the operation.
- typedef base::Callback<void(base::PlatformFileError result)> StatusCallback;
+ typedef base::Callback<void(base::File::Error result)> StatusCallback;
// Used for GetMetadata(). |result| is the return code of the operation,
// |file_info| is the obtained file info.
typedef base::Callback<
- void(base::PlatformFileError result,
- const base::PlatformFileInfo& file_info)> GetMetadataCallback;
+ void(base::File::Error result,
+ const base::File::Info& file_info)> GetMetadataCallback;
// Used for OpenFile(). |result| is the return code of the operation.
// |on_close_callback| will be called after the file is closed in the child
// process. It can be null, if no operation is needed on closing a file.
typedef base::Callback<
- void(base::PlatformFileError result,
+ void(base::File::Error result,
base::PlatformFile file,
const base::Closure& on_close_callback)> OpenFileCallback;
@@ -89,7 +90,7 @@
// |file_list| is the list of files read, and |has_more| is true if some files
// are yet to be read.
typedef base::Callback<
- void(base::PlatformFileError result,
+ void(base::File::Error result,
const FileEntryList& file_list,
bool has_more)> ReadDirectoryCallback;
@@ -115,8 +116,8 @@
// Please see the comment for ShareableFileReference for details.
//
typedef base::Callback<
- void(base::PlatformFileError result,
- const base::PlatformFileInfo& file_info,
+ void(base::File::Error result,
+ const base::File::Info& file_info,
const base::FilePath& platform_path,
const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref)>
SnapshotFileCallback;
@@ -221,7 +222,7 @@
};
// Used for Write().
- typedef base::Callback<void(base::PlatformFileError result,
+ typedef base::Callback<void(base::File::Error result,
int64 bytes,
bool complete)> WriteCallback;
@@ -452,7 +453,7 @@
// temporary nor persistent.
// In such a case, base::PLATFORM_FILE_ERROR_INVALID_OPERATION will be
// returned.
- virtual base::PlatformFileError SyncGetPlatformPath(
+ virtual base::File::Error SyncGetPlatformPath(
const FileSystemURL& url,
base::FilePath* platform_path) = 0;
diff --git a/webkit/browser/fileapi/file_system_operation_impl.cc b/webkit/browser/fileapi/file_system_operation_impl.cc
index af6e1ca..5cee4a1 100644
--- a/webkit/browser/fileapi/file_system_operation_impl.cc
+++ b/webkit/browser/fileapi/file_system_operation_impl.cc
@@ -50,7 +50,7 @@
url,
base::Bind(&FileSystemOperationImpl::DoCreateFile,
weak_factory_.GetWeakPtr(), url, callback, exclusive),
- base::Bind(callback, base::PLATFORM_FILE_ERROR_FAILED));
+ base::Bind(callback, base::File::FILE_ERROR_FAILED));
}
void FileSystemOperationImpl::CreateDirectory(const FileSystemURL& url,
@@ -63,7 +63,7 @@
base::Bind(&FileSystemOperationImpl::DoCreateDirectory,
weak_factory_.GetWeakPtr(), url, callback,
exclusive, recursive),
- base::Bind(callback, base::PLATFORM_FILE_ERROR_FAILED));
+ base::Bind(callback, base::File::FILE_ERROR_FAILED));
}
void FileSystemOperationImpl::Copy(
@@ -182,7 +182,7 @@
url,
base::Bind(&FileSystemOperationImpl::DoTruncate,
weak_factory_.GetWeakPtr(), url, callback, length),
- base::Bind(callback, base::PLATFORM_FILE_ERROR_FAILED));
+ base::Bind(callback, base::File::FILE_ERROR_FAILED));
}
void FileSystemOperationImpl::TouchFile(const FileSystemURL& url,
@@ -204,7 +204,7 @@
if (file_flags &
(base::PLATFORM_FILE_TEMPORARY | base::PLATFORM_FILE_HIDDEN)) {
- callback.Run(base::PLATFORM_FILE_ERROR_FAILED,
+ callback.Run(base::File::FILE_ERROR_FAILED,
base::kInvalidPlatformFileValue,
base::Closure());
return;
@@ -214,7 +214,7 @@
base::Bind(&FileSystemOperationImpl::DoOpenFile,
weak_factory_.GetWeakPtr(),
url, callback, file_flags),
- base::Bind(callback, base::PLATFORM_FILE_ERROR_FAILED,
+ base::Bind(callback, base::File::FILE_ERROR_FAILED,
base::kInvalidPlatformFileValue,
base::Closure()));
}
@@ -257,7 +257,7 @@
base::Bind(&FileSystemOperationImpl::DoCopyInForeignFile,
weak_factory_.GetWeakPtr(), src_local_disk_file_path, dest_url,
callback),
- base::Bind(callback, base::PLATFORM_FILE_ERROR_FAILED));
+ base::Bind(callback, base::File::FILE_ERROR_FAILED));
}
void FileSystemOperationImpl::RemoveFile(
@@ -294,7 +294,7 @@
base::Bind(&FileSystemOperationImpl::DoCopyFileLocal,
weak_factory_.GetWeakPtr(), src_url, dest_url, option,
progress_callback, callback),
- base::Bind(callback, base::PLATFORM_FILE_ERROR_FAILED));
+ base::Bind(callback, base::File::FILE_ERROR_FAILED));
}
void FileSystemOperationImpl::MoveFileLocal(
@@ -309,19 +309,19 @@
base::Bind(&FileSystemOperationImpl::DoMoveFileLocal,
weak_factory_.GetWeakPtr(),
src_url, dest_url, option, callback),
- base::Bind(callback, base::PLATFORM_FILE_ERROR_FAILED));
+ base::Bind(callback, base::File::FILE_ERROR_FAILED));
}
-base::PlatformFileError FileSystemOperationImpl::SyncGetPlatformPath(
+base::File::Error FileSystemOperationImpl::SyncGetPlatformPath(
const FileSystemURL& url,
base::FilePath* platform_path) {
DCHECK(SetPendingOperationType(kOperationGetLocalPath));
if (!file_system_context()->IsSandboxFileSystem(url.type()))
- return base::PLATFORM_FILE_ERROR_INVALID_OPERATION;
+ return base::File::FILE_ERROR_INVALID_OPERATION;
FileSystemFileUtil* file_util =
file_system_context()->sandbox_delegate()->sync_file_util();
file_util->GetLocalFilePath(operation_context_.get(), url, platform_path);
- return base::PLATFORM_FILE_OK;
+ return base::File::FILE_OK;
}
FileSystemOperationImpl::FileSystemOperationImpl(
@@ -456,9 +456,9 @@
void FileSystemOperationImpl::DidEnsureFileExistsExclusive(
const StatusCallback& callback,
- base::PlatformFileError rv, bool created) {
- if (rv == base::PLATFORM_FILE_OK && !created) {
- callback.Run(base::PLATFORM_FILE_ERROR_EXISTS);
+ base::File::Error rv, bool created) {
+ if (rv == base::File::FILE_OK && !created) {
+ callback.Run(base::File::FILE_ERROR_EXISTS);
} else {
DidFinishOperation(callback, rv);
}
@@ -466,21 +466,21 @@
void FileSystemOperationImpl::DidEnsureFileExistsNonExclusive(
const StatusCallback& callback,
- base::PlatformFileError rv, bool /* created */) {
+ base::File::Error rv, bool /* created */) {
DidFinishOperation(callback, rv);
}
void FileSystemOperationImpl::DidFinishOperation(
const StatusCallback& callback,
- base::PlatformFileError rv) {
+ 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::PLATFORM_FILE_ERROR_ABORT ?
- base::PLATFORM_FILE_OK :
- base::PLATFORM_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);
}
@@ -488,27 +488,27 @@
void FileSystemOperationImpl::DidDirectoryExists(
const StatusCallback& callback,
- base::PlatformFileError rv,
- const base::PlatformFileInfo& file_info) {
- if (rv == base::PLATFORM_FILE_OK && !file_info.is_directory)
- rv = base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY;
+ 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_DIRECTORY;
callback.Run(rv);
}
void FileSystemOperationImpl::DidFileExists(
const StatusCallback& callback,
- base::PlatformFileError rv,
- const base::PlatformFileInfo& file_info) {
- if (rv == base::PLATFORM_FILE_OK && file_info.is_directory)
- rv = base::PLATFORM_FILE_ERROR_NOT_A_FILE;
+ 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);
}
void FileSystemOperationImpl::DidDeleteRecursively(
const FileSystemURL& url,
const StatusCallback& callback,
- base::PlatformFileError rv) {
- if (rv == base::PLATFORM_FILE_ERROR_INVALID_OPERATION) {
+ base::File::Error rv) {
+ if (rv == base::File::FILE_ERROR_INVALID_OPERATION) {
// Recursive removal is not supported on this platform.
DCHECK(!recursive_operation_delegate_);
recursive_operation_delegate_.reset(
@@ -526,7 +526,7 @@
void FileSystemOperationImpl::DidWrite(
const FileSystemURL& url,
const WriteCallback& write_callback,
- base::PlatformFileError rv,
+ base::File::Error rv,
int64 bytes,
FileWriterDelegate::WriteProgressStatus write_status) {
const bool complete = (
@@ -540,12 +540,12 @@
StatusCallback cancel_callback = cancel_callback_;
write_callback.Run(rv, bytes, complete);
if (!cancel_callback.is_null())
- cancel_callback.Run(base::PLATFORM_FILE_OK);
+ cancel_callback.Run(base::File::FILE_OK);
}
void FileSystemOperationImpl::DidOpenFile(
const OpenFileCallback& callback,
- base::PlatformFileError rv,
+ base::File::Error rv,
base::PassPlatformFile file,
const base::Closure& on_close_callback) {
callback.Run(rv, file.ReleaseValue(), on_close_callback);
diff --git a/webkit/browser/fileapi/file_system_operation_impl.h b/webkit/browser/fileapi/file_system_operation_impl.h
index 0625995..36e1bb8 100644
--- a/webkit/browser/fileapi/file_system_operation_impl.h
+++ b/webkit/browser/fileapi/file_system_operation_impl.h
@@ -90,7 +90,7 @@
const FileSystemURL& dest_url,
CopyOrMoveOption option,
const StatusCallback& callback) OVERRIDE;
- virtual base::PlatformFileError SyncGetPlatformPath(
+ virtual base::File::Error SyncGetPlatformPath(
const FileSystemURL& url,
base::FilePath* platform_path) OVERRIDE;
@@ -151,32 +151,32 @@
// Callback for CreateFile for |exclusive|=true cases.
void DidEnsureFileExistsExclusive(const StatusCallback& callback,
- base::PlatformFileError rv,
+ base::File::Error rv,
bool created);
// Callback for CreateFile for |exclusive|=false cases.
void DidEnsureFileExistsNonExclusive(const StatusCallback& callback,
- base::PlatformFileError rv,
+ base::File::Error rv,
bool created);
void DidFinishOperation(const StatusCallback& callback,
- base::PlatformFileError rv);
+ base::File::Error rv);
void DidDirectoryExists(const StatusCallback& callback,
- base::PlatformFileError rv,
- const base::PlatformFileInfo& file_info);
+ base::File::Error rv,
+ const base::File::Info& file_info);
void DidFileExists(const StatusCallback& callback,
- base::PlatformFileError rv,
- const base::PlatformFileInfo& file_info);
+ base::File::Error rv,
+ const base::File::Info& file_info);
void DidDeleteRecursively(const FileSystemURL& url,
const StatusCallback& callback,
- base::PlatformFileError rv);
+ base::File::Error rv);
void DidWrite(const FileSystemURL& url,
const WriteCallback& callback,
- base::PlatformFileError rv,
+ base::File::Error rv,
int64 bytes,
FileWriterDelegate::WriteProgressStatus write_status);
void DidOpenFile(const OpenFileCallback& callback,
- base::PlatformFileError rv,
+ base::File::Error rv,
base::PassPlatformFile file,
const base::Closure& on_close_callback);
diff --git a/webkit/browser/fileapi/file_system_operation_runner.cc b/webkit/browser/fileapi/file_system_operation_runner.cc
index d552a783..aa4c435 100644
--- a/webkit/browser/fileapi/file_system_operation_runner.cc
+++ b/webkit/browser/fileapi/file_system_operation_runner.cc
@@ -43,7 +43,7 @@
const FileSystemURL& url,
bool exclusive,
const StatusCallback& callback) {
- base::PlatformFileError error = base::PLATFORM_FILE_OK;
+ base::File::Error error = base::File::FILE_OK;
FileSystemOperation* operation =
file_system_context_->CreateFileSystemOperation(url, &error);
@@ -66,7 +66,7 @@
bool exclusive,
bool recursive,
const StatusCallback& callback) {
- base::PlatformFileError error = base::PLATFORM_FILE_OK;
+ base::File::Error error = base::File::FILE_OK;
FileSystemOperation* operation =
file_system_context_->CreateFileSystemOperation(url, &error);
BeginOperationScoper scope;
@@ -89,7 +89,7 @@
CopyOrMoveOption option,
const CopyProgressCallback& progress_callback,
const StatusCallback& callback) {
- base::PlatformFileError error = base::PLATFORM_FILE_OK;
+ base::File::Error error = base::File::FILE_OK;
FileSystemOperation* operation =
file_system_context_->CreateFileSystemOperation(dest_url, &error);
BeginOperationScoper scope;
@@ -116,7 +116,7 @@
const FileSystemURL& dest_url,
CopyOrMoveOption option,
const StatusCallback& callback) {
- base::PlatformFileError error = base::PLATFORM_FILE_OK;
+ base::File::Error error = base::File::FILE_OK;
FileSystemOperation* operation =
file_system_context_->CreateFileSystemOperation(dest_url, &error);
BeginOperationScoper scope;
@@ -137,7 +137,7 @@
OperationID FileSystemOperationRunner::DirectoryExists(
const FileSystemURL& url,
const StatusCallback& callback) {
- base::PlatformFileError error = base::PLATFORM_FILE_OK;
+ base::File::Error error = base::File::FILE_OK;
FileSystemOperation* operation =
file_system_context_->CreateFileSystemOperation(url, &error);
BeginOperationScoper scope;
@@ -157,7 +157,7 @@
OperationID FileSystemOperationRunner::FileExists(
const FileSystemURL& url,
const StatusCallback& callback) {
- base::PlatformFileError error = base::PLATFORM_FILE_OK;
+ base::File::Error error = base::File::FILE_OK;
FileSystemOperation* operation =
file_system_context_->CreateFileSystemOperation(url, &error);
BeginOperationScoper scope;
@@ -177,13 +177,13 @@
OperationID FileSystemOperationRunner::GetMetadata(
const FileSystemURL& url,
const GetMetadataCallback& callback) {
- base::PlatformFileError error = base::PLATFORM_FILE_OK;
+ base::File::Error error = base::File::FILE_OK;
FileSystemOperation* operation =
file_system_context_->CreateFileSystemOperation(url, &error);
BeginOperationScoper scope;
OperationHandle handle = BeginOperation(operation, scope.AsWeakPtr());
if (!operation) {
- DidGetMetadata(handle, callback, error, base::PlatformFileInfo());
+ DidGetMetadata(handle, callback, error, base::File::Info());
return handle.id;
}
PrepareForRead(handle.id, url);
@@ -197,7 +197,7 @@
OperationID FileSystemOperationRunner::ReadDirectory(
const FileSystemURL& url,
const ReadDirectoryCallback& callback) {
- base::PlatformFileError error = base::PLATFORM_FILE_OK;
+ base::File::Error error = base::File::FILE_OK;
FileSystemOperation* operation =
file_system_context_->CreateFileSystemOperation(url, &error);
BeginOperationScoper scope;
@@ -218,7 +218,7 @@
OperationID FileSystemOperationRunner::Remove(
const FileSystemURL& url, bool recursive,
const StatusCallback& callback) {
- base::PlatformFileError error = base::PLATFORM_FILE_OK;
+ base::File::Error error = base::File::FILE_OK;
FileSystemOperation* operation =
file_system_context_->CreateFileSystemOperation(url, &error);
BeginOperationScoper scope;
@@ -241,7 +241,7 @@
scoped_ptr<webkit_blob::BlobDataHandle> blob,
int64 offset,
const WriteCallback& callback) {
- base::PlatformFileError error = base::PLATFORM_FILE_OK;
+ base::File::Error error = base::File::FILE_OK;
FileSystemOperation* operation =
file_system_context_->CreateFileSystemOperation(url, &error);
@@ -256,7 +256,7 @@
file_system_context_->CreateFileStreamWriter(url, offset));
if (!writer) {
// Write is not supported.
- DidWrite(handle, callback, base::PLATFORM_FILE_ERROR_SECURITY, 0, true);
+ DidWrite(handle, callback, base::File::FILE_ERROR_SECURITY, 0, true);
return handle.id;
}
@@ -280,7 +280,7 @@
OperationID FileSystemOperationRunner::Truncate(
const FileSystemURL& url, int64 length,
const StatusCallback& callback) {
- base::PlatformFileError error = base::PLATFORM_FILE_OK;
+ base::File::Error error = base::File::FILE_OK;
FileSystemOperation* operation =
file_system_context_->CreateFileSystemOperation(url, &error);
BeginOperationScoper scope;
@@ -308,7 +308,7 @@
FileSystemOperation* operation = operations_.Lookup(id);
if (!operation) {
// There is no operation with |id|.
- callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION);
+ callback.Run(base::File::FILE_ERROR_INVALID_OPERATION);
return;
}
operation->Cancel(callback);
@@ -319,7 +319,7 @@
const base::Time& last_access_time,
const base::Time& last_modified_time,
const StatusCallback& callback) {
- base::PlatformFileError error = base::PLATFORM_FILE_OK;
+ base::File::Error error = base::File::FILE_OK;
FileSystemOperation* operation =
file_system_context_->CreateFileSystemOperation(url, &error);
BeginOperationScoper scope;
@@ -340,7 +340,7 @@
const FileSystemURL& url,
int file_flags,
const OpenFileCallback& callback) {
- base::PlatformFileError error = base::PLATFORM_FILE_OK;
+ base::File::Error error = base::File::FILE_OK;
FileSystemOperation* operation =
file_system_context_->CreateFileSystemOperation(url, &error);
BeginOperationScoper scope;
@@ -370,13 +370,13 @@
OperationID FileSystemOperationRunner::CreateSnapshotFile(
const FileSystemURL& url,
const SnapshotFileCallback& callback) {
- base::PlatformFileError error = base::PLATFORM_FILE_OK;
+ base::File::Error error = base::File::FILE_OK;
FileSystemOperation* operation =
file_system_context_->CreateFileSystemOperation(url, &error);
BeginOperationScoper scope;
OperationHandle handle = BeginOperation(operation, scope.AsWeakPtr());
if (!operation) {
- DidCreateSnapshot(handle, callback, error, base::PlatformFileInfo(),
+ DidCreateSnapshot(handle, callback, error, base::File::Info(),
base::FilePath(), NULL);
return handle.id;
}
@@ -392,7 +392,7 @@
const base::FilePath& src_local_disk_path,
const FileSystemURL& dest_url,
const StatusCallback& callback) {
- base::PlatformFileError error = base::PLATFORM_FILE_OK;
+ base::File::Error error = base::File::FILE_OK;
FileSystemOperation* operation =
file_system_context_->CreateFileSystemOperation(dest_url, &error);
BeginOperationScoper scope;
@@ -411,7 +411,7 @@
OperationID FileSystemOperationRunner::RemoveFile(
const FileSystemURL& url,
const StatusCallback& callback) {
- base::PlatformFileError error = base::PLATFORM_FILE_OK;
+ base::File::Error error = base::File::FILE_OK;
FileSystemOperation* operation =
file_system_context_->CreateFileSystemOperation(url, &error);
BeginOperationScoper scope;
@@ -430,7 +430,7 @@
OperationID FileSystemOperationRunner::RemoveDirectory(
const FileSystemURL& url,
const StatusCallback& callback) {
- base::PlatformFileError error = base::PLATFORM_FILE_OK;
+ base::File::Error error = base::File::FILE_OK;
FileSystemOperation* operation =
file_system_context_->CreateFileSystemOperation(url, &error);
BeginOperationScoper scope;
@@ -452,7 +452,7 @@
CopyOrMoveOption option,
const CopyFileProgressCallback& progress_callback,
const StatusCallback& callback) {
- base::PlatformFileError error = base::PLATFORM_FILE_OK;
+ base::File::Error error = base::File::FILE_OK;
FileSystemOperation* operation =
file_system_context_->CreateFileSystemOperation(src_url, &error);
BeginOperationScoper scope;
@@ -473,7 +473,7 @@
const FileSystemURL& dest_url,
CopyOrMoveOption option,
const StatusCallback& callback) {
- base::PlatformFileError error = base::PLATFORM_FILE_OK;
+ base::File::Error error = base::File::FILE_OK;
FileSystemOperation* operation =
file_system_context_->CreateFileSystemOperation(src_url, &error);
BeginOperationScoper scope;
@@ -489,10 +489,10 @@
return handle.id;
}
-base::PlatformFileError FileSystemOperationRunner::SyncGetPlatformPath(
+base::File::Error FileSystemOperationRunner::SyncGetPlatformPath(
const FileSystemURL& url,
base::FilePath* platform_path) {
- base::PlatformFileError error = base::PLATFORM_FILE_OK;
+ base::File::Error error = base::File::FILE_OK;
scoped_ptr<FileSystemOperation> operation(
file_system_context_->CreateFileSystemOperation(url, &error));
if (!operation.get())
@@ -507,7 +507,7 @@
void FileSystemOperationRunner::DidFinish(
const OperationHandle& handle,
const StatusCallback& callback,
- base::PlatformFileError rv) {
+ base::File::Error rv) {
if (handle.scope) {
finished_operations_.insert(handle.id);
base::MessageLoopProxy::current()->PostTask(
@@ -522,8 +522,8 @@
void FileSystemOperationRunner::DidGetMetadata(
const OperationHandle& handle,
const GetMetadataCallback& callback,
- base::PlatformFileError rv,
- const base::PlatformFileInfo& file_info) {
+ base::File::Error rv,
+ const base::File::Info& file_info) {
if (handle.scope) {
finished_operations_.insert(handle.id);
base::MessageLoopProxy::current()->PostTask(
@@ -538,7 +538,7 @@
void FileSystemOperationRunner::DidReadDirectory(
const OperationHandle& handle,
const ReadDirectoryCallback& callback,
- base::PlatformFileError rv,
+ base::File::Error rv,
const std::vector<DirectoryEntry>& entries,
bool has_more) {
if (handle.scope) {
@@ -550,14 +550,14 @@
return;
}
callback.Run(rv, entries, has_more);
- if (rv != base::PLATFORM_FILE_OK || !has_more)
+ if (rv != base::File::FILE_OK || !has_more)
FinishOperation(handle.id);
}
void FileSystemOperationRunner::DidWrite(
const OperationHandle& handle,
const WriteCallback& callback,
- base::PlatformFileError rv,
+ base::File::Error rv,
int64 bytes,
bool complete) {
if (handle.scope) {
@@ -568,14 +568,14 @@
return;
}
callback.Run(rv, bytes, complete);
- if (rv != base::PLATFORM_FILE_OK || complete)
+ if (rv != base::File::FILE_OK || complete)
FinishOperation(handle.id);
}
void FileSystemOperationRunner::DidOpenFile(
const OperationHandle& handle,
const OpenFileCallback& callback,
- base::PlatformFileError rv,
+ base::File::Error rv,
base::PlatformFile file,
const base::Closure& on_close_callback) {
if (handle.scope) {
@@ -593,8 +593,8 @@
void FileSystemOperationRunner::DidCreateSnapshot(
const OperationHandle& handle,
const SnapshotFileCallback& callback,
- base::PlatformFileError rv,
- const base::PlatformFileInfo& file_info,
+ base::File::Error rv,
+ const base::File::Info& file_info,
const base::FilePath& platform_path,
const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref) {
if (handle.scope) {
@@ -679,7 +679,7 @@
if (found_cancel != stray_cancel_callbacks_.end()) {
// This cancel has been requested after the operation has finished,
// so report that we failed to stop it.
- found_cancel->second.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION);
+ found_cancel->second.Run(base::File::FILE_ERROR_INVALID_OPERATION);
stray_cancel_callbacks_.erase(found_cancel);
}
}
diff --git a/webkit/browser/fileapi/file_system_operation_runner.h b/webkit/browser/fileapi/file_system_operation_runner.h
index fba6b1c..1a5314c5 100644
--- a/webkit/browser/fileapi/file_system_operation_runner.h
+++ b/webkit/browser/fileapi/file_system_operation_runner.h
@@ -234,8 +234,8 @@
// This is called only by pepper plugin as of writing to synchronously get
// the underlying platform path to upload a file in the sandboxed filesystem
// (e.g. TEMPORARY or PERSISTENT).
- base::PlatformFileError SyncGetPlatformPath(const FileSystemURL& url,
- base::FilePath* platform_path);
+ base::File::Error SyncGetPlatformPath(const FileSystemURL& url,
+ base::FilePath* platform_path);
private:
class BeginOperationScoper;
@@ -253,32 +253,32 @@
void DidFinish(const OperationHandle& handle,
const StatusCallback& callback,
- base::PlatformFileError rv);
+ base::File::Error rv);
void DidGetMetadata(const OperationHandle& handle,
const GetMetadataCallback& callback,
- base::PlatformFileError rv,
- const base::PlatformFileInfo& file_info);
+ base::File::Error rv,
+ const base::File::Info& file_info);
void DidReadDirectory(const OperationHandle& handle,
const ReadDirectoryCallback& callback,
- base::PlatformFileError rv,
+ base::File::Error rv,
const std::vector<DirectoryEntry>& entries,
bool has_more);
void DidWrite(const OperationHandle& handle,
const WriteCallback& callback,
- base::PlatformFileError rv,
+ base::File::Error rv,
int64 bytes,
bool complete);
void DidOpenFile(
const OperationHandle& handle,
const OpenFileCallback& callback,
- base::PlatformFileError rv,
+ base::File::Error rv,
base::PlatformFile file,
const base::Closure& on_close_callback);
void DidCreateSnapshot(
const OperationHandle& handle,
const SnapshotFileCallback& callback,
- base::PlatformFileError rv,
- const base::PlatformFileInfo& file_info,
+ base::File::Error rv,
+ const base::File::Info& file_info,
const base::FilePath& platform_path,
const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref);
diff --git a/webkit/browser/fileapi/file_system_quota_client.cc b/webkit/browser/fileapi/file_system_quota_client.cc
index 6fd0ef5e..3dce218 100644
--- a/webkit/browser/fileapi/file_system_quota_client.cc
+++ b/webkit/browser/fileapi/file_system_quota_client.cc
@@ -70,10 +70,10 @@
FileSystemBackend* provider = context->GetFileSystemBackend(type);
if (!provider || !provider->GetQuotaUtil())
return quota::kQuotaErrorNotSupported;
- base::PlatformFileError result =
+ base::File::Error result =
provider->GetQuotaUtil()->DeleteOriginDataOnFileTaskRunner(
context, context->quota_manager_proxy(), origin, type);
- if (result == base::PLATFORM_FILE_OK)
+ if (result == base::File::FILE_OK)
return quota::kQuotaStatusOk;
return quota::kQuotaErrorInvalidModification;
}
diff --git a/webkit/browser/fileapi/file_system_quota_util.h b/webkit/browser/fileapi/file_system_quota_util.h
index 2005927e..7e6badf0 100644
--- a/webkit/browser/fileapi/file_system_quota_util.h
+++ b/webkit/browser/fileapi/file_system_quota_util.h
@@ -9,7 +9,7 @@
#include <string>
#include "base/basictypes.h"
-#include "base/platform_file.h"
+#include "base/files/file.h"
#include "url/gurl.h"
#include "webkit/browser/fileapi/task_runner_bound_observer_list.h"
#include "webkit/browser/webkit_storage_browser_export.h"
@@ -38,7 +38,7 @@
// Deletes the data on the origin and reports the amount of deleted data
// to the quota manager via |proxy|.
- virtual base::PlatformFileError DeleteOriginDataOnFileTaskRunner(
+ virtual base::File::Error DeleteOriginDataOnFileTaskRunner(
FileSystemContext* context,
quota::QuotaManagerProxy* proxy,
const GURL& origin_url,
diff --git a/webkit/browser/fileapi/file_system_url_request_job.cc b/webkit/browser/fileapi/file_system_url_request_job.cc
index 57db3006..fe445649 100644
--- a/webkit/browser/fileapi/file_system_url_request_job.cc
+++ b/webkit/browser/fileapi/file_system_url_request_job.cc
@@ -169,10 +169,10 @@
}
void FileSystemURLRequestJob::DidGetMetadata(
- base::PlatformFileError error_code,
- const base::PlatformFileInfo& file_info) {
- if (error_code != base::PLATFORM_FILE_OK) {
- NotifyFailed(error_code == base::PLATFORM_FILE_ERROR_INVALID_URL ?
+ base::File::Error error_code,
+ const base::File::Info& file_info) {
+ if (error_code != base::File::FILE_OK) {
+ NotifyFailed(error_code == base::File::FILE_ERROR_INVALID_URL ?
net::ERR_INVALID_URL : net::ERR_FILE_NOT_FOUND);
return;
}
diff --git a/webkit/browser/fileapi/file_system_url_request_job.h b/webkit/browser/fileapi/file_system_url_request_job.h
index a784d62..8fa766c 100644
--- a/webkit/browser/fileapi/file_system_url_request_job.h
+++ b/webkit/browser/fileapi/file_system_url_request_job.h
@@ -7,10 +7,10 @@
#include <string>
+#include "base/files/file.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
-#include "base/platform_file.h"
#include "net/http/http_byte_range.h"
#include "net/url_request/url_request_job.h"
#include "webkit/browser/fileapi/file_system_url.h"
@@ -61,8 +61,8 @@
void StartAsync();
void DidGetMetadata(
- base::PlatformFileError error_code,
- const base::PlatformFileInfo& file_info);
+ base::File::Error error_code,
+ const base::File::Info& file_info);
void DidRead(int result);
void NotifyFailed(int rv);
diff --git a/webkit/browser/fileapi/file_writer_delegate.cc b/webkit/browser/fileapi/file_writer_delegate.cc
index 295cd64..c1ec7ebe 100644
--- a/webkit/browser/fileapi/file_writer_delegate.cc
+++ b/webkit/browser/fileapi/file_writer_delegate.cc
@@ -54,7 +54,7 @@
// Return true to finish immediately if we have no pending writes.
// Otherwise we'll do the final cleanup in the Cancel callback.
if (status != net::ERR_IO_PENDING) {
- write_callback_.Run(base::PLATFORM_FILE_ERROR_ABORT, 0,
+ write_callback_.Run(base::File::FILE_ERROR_ABORT, 0,
GetCompletionStatusOnError());
}
}
@@ -63,33 +63,33 @@
const GURL& new_url,
bool* defer_redirect) {
NOTREACHED();
- OnError(base::PLATFORM_FILE_ERROR_SECURITY);
+ OnError(base::File::FILE_ERROR_SECURITY);
}
void FileWriterDelegate::OnAuthRequired(net::URLRequest* request,
net::AuthChallengeInfo* auth_info) {
NOTREACHED();
- OnError(base::PLATFORM_FILE_ERROR_SECURITY);
+ OnError(base::File::FILE_ERROR_SECURITY);
}
void FileWriterDelegate::OnCertificateRequested(
net::URLRequest* request,
net::SSLCertRequestInfo* cert_request_info) {
NOTREACHED();
- OnError(base::PLATFORM_FILE_ERROR_SECURITY);
+ OnError(base::File::FILE_ERROR_SECURITY);
}
void FileWriterDelegate::OnSSLCertificateError(net::URLRequest* request,
const net::SSLInfo& ssl_info,
bool fatal) {
NOTREACHED();
- OnError(base::PLATFORM_FILE_ERROR_SECURITY);
+ OnError(base::File::FILE_ERROR_SECURITY);
}
void FileWriterDelegate::OnResponseStarted(net::URLRequest* request) {
DCHECK_EQ(request_.get(), request);
if (!request->status().is_success() || request->GetResponseCode() != 200) {
- OnError(base::PLATFORM_FILE_ERROR_FAILED);
+ OnError(base::File::FILE_ERROR_FAILED);
return;
}
Read();
@@ -99,7 +99,7 @@
int bytes_read) {
DCHECK_EQ(request_.get(), request);
if (!request->status().is_success()) {
- OnError(base::PLATFORM_FILE_ERROR_FAILED);
+ OnError(base::File::FILE_ERROR_FAILED);
return;
}
OnDataReceived(bytes_read);
@@ -114,7 +114,7 @@
base::Bind(&FileWriterDelegate::OnDataReceived,
weak_factory_.GetWeakPtr(), bytes_read_));
} else if (!request_->status().is_io_pending()) {
- OnError(base::PLATFORM_FILE_ERROR_FAILED);
+ OnError(base::File::FILE_ERROR_FAILED);
}
}
@@ -145,7 +145,7 @@
base::Bind(&FileWriterDelegate::OnDataWritten,
weak_factory_.GetWeakPtr(), write_response));
} else if (net::ERR_IO_PENDING != write_response) {
- OnError(NetErrorToPlatformFileError(write_response));
+ OnError(NetErrorToFileError(write_response));
}
}
@@ -159,7 +159,7 @@
else
Write();
} else {
- OnError(NetErrorToPlatformFileError(write_response));
+ OnError(NetErrorToFileError(write_response));
}
}
@@ -168,7 +168,7 @@
return writing_started_ ? ERROR_WRITE_STARTED : ERROR_WRITE_NOT_STARTED;
}
-void FileWriterDelegate::OnError(base::PlatformFileError error) {
+void FileWriterDelegate::OnError(base::File::Error error) {
if (request_) {
request_->set_delegate(NULL);
request_->Cancel();
@@ -192,10 +192,10 @@
bytes_written_backlog_ = 0;
if (done) {
- FlushForCompletion(base::PLATFORM_FILE_OK, bytes_written,
+ FlushForCompletion(base::File::FILE_OK, bytes_written,
SUCCESS_COMPLETED);
} else {
- write_callback_.Run(base::PLATFORM_FILE_OK, bytes_written,
+ write_callback_.Run(base::File::FILE_OK, bytes_written,
SUCCESS_IO_PENDING);
}
return;
@@ -204,12 +204,12 @@
}
void FileWriterDelegate::OnWriteCancelled(int status) {
- write_callback_.Run(base::PLATFORM_FILE_ERROR_ABORT, 0,
+ write_callback_.Run(base::File::FILE_ERROR_ABORT, 0,
GetCompletionStatusOnError());
}
void FileWriterDelegate::FlushForCompletion(
- base::PlatformFileError error,
+ base::File::Error error,
int bytes_written,
WriteProgressStatus progress_status) {
int flush_error = file_stream_writer_->Flush(
@@ -219,14 +219,14 @@
OnFlushed(error, bytes_written, progress_status, flush_error);
}
-void FileWriterDelegate::OnFlushed(base::PlatformFileError error,
+void FileWriterDelegate::OnFlushed(base::File::Error error,
int bytes_written,
WriteProgressStatus progress_status,
int flush_error) {
- if (error == base::PLATFORM_FILE_OK && flush_error != net::OK) {
+ if (error == base::File::FILE_OK && flush_error != net::OK) {
// If the Flush introduced an error, overwrite the status.
// Otherwise, keep the original error status.
- error = NetErrorToPlatformFileError(flush_error);
+ error = NetErrorToFileError(flush_error);
progress_status = GetCompletionStatusOnError();
}
write_callback_.Run(error, bytes_written, progress_status);
diff --git a/webkit/browser/fileapi/file_writer_delegate.h b/webkit/browser/fileapi/file_writer_delegate.h
index f7ce16d..a5dcb57 100644
--- a/webkit/browser/fileapi/file_writer_delegate.h
+++ b/webkit/browser/fileapi/file_writer_delegate.h
@@ -5,10 +5,10 @@
#ifndef WEBKIT_BROWSER_FILEAPI_FILE_WRITER_DELEGATE_H_
#define WEBKIT_BROWSER_FILEAPI_FILE_WRITER_DELEGATE_H_
+#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
-#include "base/platform_file.h"
#include "base/time/time.h"
#include "net/base/file_stream.h"
#include "net/base/io_buffer.h"
@@ -29,7 +29,7 @@
ERROR_WRITE_NOT_STARTED,
};
- typedef base::Callback<void(base::PlatformFileError result,
+ typedef base::Callback<void(base::File::Error result,
int64 bytes,
WriteProgressStatus write_status)>
DelegateWriteCallback;
@@ -63,19 +63,19 @@
private:
void OnGetFileInfoAndStartRequest(
scoped_ptr<net::URLRequest> request,
- base::PlatformFileError error,
- const base::PlatformFileInfo& file_info);
+ base::File::Error error,
+ const base::File::Info& file_info);
void Read();
void OnDataReceived(int bytes_read);
void Write();
void OnDataWritten(int write_response);
- void OnError(base::PlatformFileError error);
+ void OnError(base::File::Error error);
void OnProgress(int bytes_read, bool done);
void OnWriteCancelled(int status);
- void FlushForCompletion(base::PlatformFileError error,
+ void FlushForCompletion(base::File::Error error,
int bytes_written,
WriteProgressStatus progress_status);
- void OnFlushed(base::PlatformFileError error,
+ void OnFlushed(base::File::Error error,
int bytes_written,
WriteProgressStatus progress_status,
int flush_error);
diff --git a/webkit/browser/fileapi/isolated_file_system_backend.cc b/webkit/browser/fileapi/isolated_file_system_backend.cc
index f83ae15..cf70885 100644
--- a/webkit/browser/fileapi/isolated_file_system_backend.cc
+++ b/webkit/browser/fileapi/isolated_file_system_backend.cc
@@ -68,7 +68,7 @@
base::Bind(callback,
GetFileSystemRootURI(origin_url, type),
GetFileSystemName(origin_url, type),
- base::PLATFORM_FILE_ERROR_SECURITY));
+ base::File::FILE_ERROR_SECURITY));
}
AsyncFileUtil* IsolatedFileSystemBackend::GetAsyncFileUtil(
@@ -88,16 +88,16 @@
CopyOrMoveFileValidatorFactory*
IsolatedFileSystemBackend::GetCopyOrMoveFileValidatorFactory(
- FileSystemType type, base::PlatformFileError* error_code) {
+ FileSystemType type, base::File::Error* error_code) {
DCHECK(error_code);
- *error_code = base::PLATFORM_FILE_OK;
+ *error_code = base::File::FILE_OK;
return NULL;
}
FileSystemOperation* IsolatedFileSystemBackend::CreateFileSystemOperation(
const FileSystemURL& url,
FileSystemContext* context,
- base::PlatformFileError* error_code) const {
+ base::File::Error* error_code) const {
return FileSystemOperation::Create(
url, context, make_scoped_ptr(new FileSystemOperationContext(context)));
}
diff --git a/webkit/browser/fileapi/isolated_file_system_backend.h b/webkit/browser/fileapi/isolated_file_system_backend.h
index aa03844..a7284a3d 100644
--- a/webkit/browser/fileapi/isolated_file_system_backend.h
+++ b/webkit/browser/fileapi/isolated_file_system_backend.h
@@ -28,11 +28,11 @@
virtual AsyncFileUtil* GetAsyncFileUtil(FileSystemType type) OVERRIDE;
virtual CopyOrMoveFileValidatorFactory* GetCopyOrMoveFileValidatorFactory(
FileSystemType type,
- base::PlatformFileError* error_code) OVERRIDE;
+ base::File::Error* error_code) OVERRIDE;
virtual FileSystemOperation* CreateFileSystemOperation(
const FileSystemURL& url,
FileSystemContext* context,
- base::PlatformFileError* error_code) const OVERRIDE;
+ base::File::Error* error_code) const OVERRIDE;
virtual scoped_ptr<webkit_blob::FileStreamReader> CreateFileStreamReader(
const FileSystemURL& url,
int64 offset,
diff --git a/webkit/browser/fileapi/local_file_util.cc b/webkit/browser/fileapi/local_file_util.cc
index 8f47859..032244f2 100644
--- a/webkit/browser/fileapi/local_file_util.cc
+++ b/webkit/browser/fileapi/local_file_util.cc
@@ -22,8 +22,6 @@
return new AsyncFileUtilAdapter(new LocalFileUtil());
}
-using base::PlatformFileError;
-
class LocalFileEnumerator : public FileSystemFileUtil::AbstractFileEnumerator {
public:
LocalFileEnumerator(const base::FilePath& platform_root_path,
@@ -78,64 +76,66 @@
LocalFileUtil::~LocalFileUtil() {}
-PlatformFileError LocalFileUtil::CreateOrOpen(
+base::File::Error LocalFileUtil::CreateOrOpen(
FileSystemOperationContext* context,
const FileSystemURL& url, int file_flags,
base::PlatformFile* file_handle, bool* created) {
*created = false;
base::FilePath file_path;
- PlatformFileError error = GetLocalFilePath(context, url, &file_path);
- if (error != base::PLATFORM_FILE_OK)
+ base::File::Error error = GetLocalFilePath(context, url, &file_path);
+ if (error != base::File::FILE_OK)
return error;
// Disallow opening files in symlinked paths.
if (base::IsLink(file_path))
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
- return NativeFileUtil::CreateOrOpen(
- file_path, file_flags, file_handle, created);
+ return base::File::FILE_ERROR_NOT_FOUND;
+
+ return NativeFileUtil::CreateOrOpen(file_path, file_flags, file_handle,
+ created);
}
-PlatformFileError LocalFileUtil::Close(FileSystemOperationContext* context,
+base::File::Error LocalFileUtil::Close(FileSystemOperationContext* context,
base::PlatformFile file) {
return NativeFileUtil::Close(file);
}
-PlatformFileError LocalFileUtil::EnsureFileExists(
+base::File::Error LocalFileUtil::EnsureFileExists(
FileSystemOperationContext* context,
const FileSystemURL& url,
bool* created) {
base::FilePath file_path;
- PlatformFileError error = GetLocalFilePath(context, url, &file_path);
- if (error != base::PLATFORM_FILE_OK)
+ base::File::Error error = GetLocalFilePath(context, url, &file_path);
+ if (error != base::File::FILE_OK)
return error;
return NativeFileUtil::EnsureFileExists(file_path, created);
}
-PlatformFileError LocalFileUtil::CreateDirectory(
+base::File::Error LocalFileUtil::CreateDirectory(
FileSystemOperationContext* context,
const FileSystemURL& url,
bool exclusive,
bool recursive) {
base::FilePath file_path;
- PlatformFileError error = GetLocalFilePath(context, url, &file_path);
- if (error != base::PLATFORM_FILE_OK)
+ base::File::Error error = GetLocalFilePath(context, url, &file_path);
+ if (error != base::File::FILE_OK)
return error;
return NativeFileUtil::CreateDirectory(file_path, exclusive, recursive);
}
-PlatformFileError LocalFileUtil::GetFileInfo(
+base::File::Error LocalFileUtil::GetFileInfo(
FileSystemOperationContext* context,
const FileSystemURL& url,
- base::PlatformFileInfo* file_info,
+ base::File::Info* file_info,
base::FilePath* platform_file_path) {
base::FilePath file_path;
- PlatformFileError error = GetLocalFilePath(context, url, &file_path);
- if (error != base::PLATFORM_FILE_OK)
+ base::File::Error error = GetLocalFilePath(context, url, &file_path);
+ if (error != base::File::FILE_OK)
return error;
// We should not follow symbolic links in sandboxed file system.
if (base::IsLink(file_path))
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ return base::File::FILE_ERROR_NOT_FOUND;
+
error = NativeFileUtil::GetFileInfo(file_path, file_info);
- if (error == base::PLATFORM_FILE_OK)
+ if (error == base::File::FILE_OK)
*platform_file_path = file_path;
return error;
}
@@ -146,7 +146,7 @@
const FileSystemURL& root_url) {
base::FilePath file_path;
if (GetLocalFilePath(context, root_url, &file_path) !=
- base::PLATFORM_FILE_OK) {
+ base::File::FILE_OK) {
return make_scoped_ptr(new EmptyFileEnumerator)
.PassAs<FileSystemFileUtil::AbstractFileEnumerator>();
}
@@ -156,7 +156,7 @@
.PassAs<FileSystemFileUtil::AbstractFileEnumerator>();
}
-PlatformFileError LocalFileUtil::GetLocalFilePath(
+base::File::Error LocalFileUtil::GetLocalFilePath(
FileSystemOperationContext* context,
const FileSystemURL& url,
base::FilePath* local_file_path) {
@@ -164,49 +164,49 @@
DCHECK(url.is_valid());
if (url.path().empty()) {
// Root direcory case, which should not be accessed.
- return base::PLATFORM_FILE_ERROR_ACCESS_DENIED;
+ return base::File::FILE_ERROR_ACCESS_DENIED;
}
*local_file_path = url.path();
- return base::PLATFORM_FILE_OK;
+ return base::File::FILE_OK;
}
-PlatformFileError LocalFileUtil::Touch(
+base::File::Error LocalFileUtil::Touch(
FileSystemOperationContext* context,
const FileSystemURL& url,
const base::Time& last_access_time,
const base::Time& last_modified_time) {
base::FilePath file_path;
- PlatformFileError error = GetLocalFilePath(context, url, &file_path);
- if (error != base::PLATFORM_FILE_OK)
+ base::File::Error error = GetLocalFilePath(context, url, &file_path);
+ if (error != base::File::FILE_OK)
return error;
return NativeFileUtil::Touch(file_path, last_access_time, last_modified_time);
}
-PlatformFileError LocalFileUtil::Truncate(
+base::File::Error LocalFileUtil::Truncate(
FileSystemOperationContext* context,
const FileSystemURL& url,
int64 length) {
base::FilePath file_path;
- PlatformFileError error = GetLocalFilePath(context, url, &file_path);
- if (error != base::PLATFORM_FILE_OK)
+ base::File::Error error = GetLocalFilePath(context, url, &file_path);
+ if (error != base::File::FILE_OK)
return error;
return NativeFileUtil::Truncate(file_path, length);
}
-PlatformFileError LocalFileUtil::CopyOrMoveFile(
+base::File::Error 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);
- if (error != base::PLATFORM_FILE_OK)
+ base::File::Error error = GetLocalFilePath(context, src_url, &src_file_path);
+ if (error != base::File::FILE_OK)
return error;
base::FilePath dest_file_path;
error = GetLocalFilePath(context, dest_url, &dest_file_path);
- if (error != base::PLATFORM_FILE_OK)
+ if (error != base::File::FILE_OK)
return error;
return NativeFileUtil::CopyOrMoveFile(
@@ -214,17 +214,17 @@
fileapi::NativeFileUtil::CopyOrMoveModeForDestination(dest_url, copy));
}
-PlatformFileError LocalFileUtil::CopyInForeignFile(
+base::File::Error LocalFileUtil::CopyInForeignFile(
FileSystemOperationContext* context,
const base::FilePath& src_file_path,
const FileSystemURL& dest_url) {
if (src_file_path.empty())
- return base::PLATFORM_FILE_ERROR_INVALID_OPERATION;
+ return base::File::FILE_ERROR_INVALID_OPERATION;
base::FilePath dest_file_path;
- PlatformFileError error =
+ base::File::Error error =
GetLocalFilePath(context, dest_url, &dest_file_path);
- if (error != base::PLATFORM_FILE_OK)
+ if (error != base::File::FILE_OK)
return error;
return NativeFileUtil::CopyOrMoveFile(
src_file_path, dest_file_path, FileSystemOperation::OPTION_NONE,
@@ -232,22 +232,22 @@
true /* copy */));
}
-PlatformFileError LocalFileUtil::DeleteFile(
+base::File::Error LocalFileUtil::DeleteFile(
FileSystemOperationContext* context,
const FileSystemURL& url) {
base::FilePath file_path;
- PlatformFileError error = GetLocalFilePath(context, url, &file_path);
- if (error != base::PLATFORM_FILE_OK)
+ base::File::Error error = GetLocalFilePath(context, url, &file_path);
+ if (error != base::File::FILE_OK)
return error;
return NativeFileUtil::DeleteFile(file_path);
}
-PlatformFileError LocalFileUtil::DeleteDirectory(
+base::File::Error LocalFileUtil::DeleteDirectory(
FileSystemOperationContext* context,
const FileSystemURL& url) {
base::FilePath file_path;
- PlatformFileError error = GetLocalFilePath(context, url, &file_path);
- if (error != base::PLATFORM_FILE_OK)
+ base::File::Error error = GetLocalFilePath(context, url, &file_path);
+ if (error != base::File::FILE_OK)
return error;
return NativeFileUtil::DeleteDirectory(file_path);
}
@@ -255,14 +255,14 @@
webkit_blob::ScopedFile LocalFileUtil::CreateSnapshotFile(
FileSystemOperationContext* context,
const FileSystemURL& url,
- base::PlatformFileError* error,
- base::PlatformFileInfo* file_info,
+ base::File::Error* error,
+ base::File::Info* file_info,
base::FilePath* platform_path) {
DCHECK(file_info);
// We're just returning the local file information.
*error = GetFileInfo(context, url, file_info, platform_path);
- if (*error == base::PLATFORM_FILE_OK && file_info->is_directory)
- *error = base::PLATFORM_FILE_ERROR_NOT_A_FILE;
+ if (*error == base::File::FILE_OK && file_info->is_directory)
+ *error = base::File::FILE_ERROR_NOT_A_FILE;
return webkit_blob::ScopedFile();
}
diff --git a/webkit/browser/fileapi/local_file_util.h b/webkit/browser/fileapi/local_file_util.h
index 21efc72f..b5220b07 100644
--- a/webkit/browser/fileapi/local_file_util.h
+++ b/webkit/browser/fileapi/local_file_util.h
@@ -30,65 +30,65 @@
LocalFileUtil();
virtual ~LocalFileUtil();
- virtual base::PlatformFileError CreateOrOpen(
+ virtual base::File::Error CreateOrOpen(
FileSystemOperationContext* context,
const FileSystemURL& url,
int file_flags,
base::PlatformFile* file_handle,
bool* created) OVERRIDE;
- virtual base::PlatformFileError Close(
+ virtual base::File::Error Close(
FileSystemOperationContext* context,
base::PlatformFile file) OVERRIDE;
- virtual base::PlatformFileError EnsureFileExists(
+ virtual base::File::Error EnsureFileExists(
FileSystemOperationContext* context,
const FileSystemURL& url, bool* created) OVERRIDE;
- virtual base::PlatformFileError CreateDirectory(
+ virtual base::File::Error CreateDirectory(
FileSystemOperationContext* context,
const FileSystemURL& url,
bool exclusive,
bool recursive) OVERRIDE;
- virtual base::PlatformFileError GetFileInfo(
+ virtual base::File::Error GetFileInfo(
FileSystemOperationContext* context,
const FileSystemURL& url,
- base::PlatformFileInfo* file_info,
+ base::File::Info* file_info,
base::FilePath* platform_file) OVERRIDE;
virtual scoped_ptr<AbstractFileEnumerator> CreateFileEnumerator(
FileSystemOperationContext* context,
const FileSystemURL& root_url) OVERRIDE;
- virtual base::PlatformFileError GetLocalFilePath(
+ virtual base::File::Error GetLocalFilePath(
FileSystemOperationContext* context,
const FileSystemURL& file_system_url,
base::FilePath* local_file_path) OVERRIDE;
- virtual base::PlatformFileError Touch(
+ virtual base::File::Error Touch(
FileSystemOperationContext* context,
const FileSystemURL& url,
const base::Time& last_access_time,
const base::Time& last_modified_time) OVERRIDE;
- virtual base::PlatformFileError Truncate(
+ virtual base::File::Error Truncate(
FileSystemOperationContext* context,
const FileSystemURL& url,
int64 length) OVERRIDE;
- virtual base::PlatformFileError CopyOrMoveFile(
+ virtual base::File::Error CopyOrMoveFile(
FileSystemOperationContext* context,
const FileSystemURL& src_url,
const FileSystemURL& dest_url,
CopyOrMoveOption option,
bool copy) OVERRIDE;
- virtual base::PlatformFileError CopyInForeignFile(
+ virtual base::File::Error CopyInForeignFile(
FileSystemOperationContext* context,
const base::FilePath& src_file_path,
const FileSystemURL& dest_url) OVERRIDE;
- virtual base::PlatformFileError DeleteFile(
+ virtual base::File::Error DeleteFile(
FileSystemOperationContext* context,
const FileSystemURL& url) OVERRIDE;
- virtual base::PlatformFileError DeleteDirectory(
+ virtual base::File::Error DeleteDirectory(
FileSystemOperationContext* context,
const FileSystemURL& url) OVERRIDE;
virtual webkit_blob::ScopedFile CreateSnapshotFile(
FileSystemOperationContext* context,
const FileSystemURL& url,
- base::PlatformFileError* error,
- base::PlatformFileInfo* file_info,
+ base::File::Error* error,
+ base::File::Info* file_info,
base::FilePath* platform_path) OVERRIDE;
private:
diff --git a/webkit/browser/fileapi/native_file_util.cc b/webkit/browser/fileapi/native_file_util.cc
index e13d8e7..e99e297 100644
--- a/webkit/browser/fileapi/native_file_util.cc
+++ b/webkit/browser/fileapi/native_file_util.cc
@@ -73,7 +73,6 @@
} // namespace
using base::PlatformFile;
-using base::PlatformFileError;
class NativeFileEnumerator : public FileSystemFileUtil::AbstractFileEnumerator {
public:
@@ -123,69 +122,74 @@
return MOVE;
}
-PlatformFileError NativeFileUtil::CreateOrOpen(
+base::File::Error NativeFileUtil::CreateOrOpen(
const base::FilePath& path, int file_flags,
PlatformFile* file_handle, bool* created) {
if (!base::DirectoryExists(path.DirName())) {
// If its parent does not exist, should return NOT_FOUND error.
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ return base::File::FILE_ERROR_NOT_FOUND;
}
if (base::DirectoryExists(path))
- return base::PLATFORM_FILE_ERROR_NOT_A_FILE;
- PlatformFileError error_code = base::PLATFORM_FILE_OK;
+ return base::File::FILE_ERROR_NOT_A_FILE;
+
+ // TODO(rvargas): convert this code to use base::File.
+ base::PlatformFileError error_code = base::PLATFORM_FILE_OK;
*file_handle = base::CreatePlatformFile(path, file_flags,
created, &error_code);
- return error_code;
+ return static_cast<base::File::Error>(error_code);
}
-PlatformFileError NativeFileUtil::Close(PlatformFile file_handle) {
+base::File::Error NativeFileUtil::Close(PlatformFile file_handle) {
if (!base::ClosePlatformFile(file_handle))
- return base::PLATFORM_FILE_ERROR_FAILED;
- return base::PLATFORM_FILE_OK;
+ return base::File::FILE_ERROR_FAILED;
+ return base::File::FILE_OK;
}
-PlatformFileError NativeFileUtil::EnsureFileExists(
+base::File::Error NativeFileUtil::EnsureFileExists(
const base::FilePath& path,
bool* created) {
if (!base::DirectoryExists(path.DirName()))
// If its parent does not exist, should return NOT_FOUND error.
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
- PlatformFileError error_code = base::PLATFORM_FILE_OK;
+ return base::File::FILE_ERROR_NOT_FOUND;
+
// Tries to create the |path| exclusively. This should fail
- // with base::PLATFORM_FILE_ERROR_EXISTS if the path already exists.
- PlatformFile handle = base::CreatePlatformFile(
- path,
- base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_READ,
- created, &error_code);
- if (error_code == base::PLATFORM_FILE_ERROR_EXISTS) {
+ // with base::File::FILE_ERROR_EXISTS if the path already exists.
+ base::File file(path, base::File::FLAG_CREATE | base::File::FLAG_READ);
+
+ if (file.IsValid()) {
+ if (created)
+ *created = file.created();
+ return base::File::FILE_OK;
+ }
+
+ base::File::Error error_code = file.error_details();
+ if (error_code == base::File::FILE_ERROR_EXISTS) {
// Make sure created_ is false.
if (created)
*created = false;
- error_code = base::PLATFORM_FILE_OK;
+ error_code = base::File::FILE_OK;
}
- if (handle != base::kInvalidPlatformFileValue)
- base::ClosePlatformFile(handle);
return error_code;
}
-PlatformFileError NativeFileUtil::CreateDirectory(
+base::File::Error NativeFileUtil::CreateDirectory(
const base::FilePath& path,
bool exclusive,
bool recursive) {
// If parent dir of file doesn't exist.
if (!recursive && !base::PathExists(path.DirName()))
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ return base::File::FILE_ERROR_NOT_FOUND;
bool path_exists = base::PathExists(path);
if (exclusive && path_exists)
- return base::PLATFORM_FILE_ERROR_EXISTS;
+ return base::File::FILE_ERROR_EXISTS;
// If file exists at the path.
if (path_exists && !base::DirectoryExists(path))
- return base::PLATFORM_FILE_ERROR_EXISTS;
+ return base::File::FILE_ERROR_EXISTS;
if (!base::CreateDirectory(path))
- return base::PLATFORM_FILE_ERROR_FAILED;
+ return base::File::FILE_ERROR_FAILED;
if (!SetPlatformSpecificDirectoryPermissions(path)) {
// Since some file systems don't support permission setting, we do not treat
@@ -194,19 +198,18 @@
<< path.AsUTF8Unsafe();
}
- return base::PLATFORM_FILE_OK;
+ return base::File::FILE_OK;
}
-PlatformFileError NativeFileUtil::GetFileInfo(
+base::File::Error NativeFileUtil::GetFileInfo(
const base::FilePath& path,
- base::PlatformFileInfo* file_info) {
+ base::File::Info* file_info) {
if (!base::PathExists(path))
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ return base::File::FILE_ERROR_NOT_FOUND;
- // TODO(rvargas): convert this code to use base::File.
- if (!base::GetFileInfo(path, reinterpret_cast<base::File::Info*>(file_info)))
- return base::PLATFORM_FILE_ERROR_FAILED;
- return base::PLATFORM_FILE_OK;
+ if (!base::GetFileInfo(path, file_info))
+ return base::File::FILE_ERROR_FAILED;
+ return base::File::FILE_OK;
}
scoped_ptr<FileSystemFileUtil::AbstractFileEnumerator>
@@ -218,32 +221,25 @@
.PassAs<FileSystemFileUtil::AbstractFileEnumerator>();
}
-PlatformFileError NativeFileUtil::Touch(
+base::File::Error NativeFileUtil::Touch(
const base::FilePath& path,
const base::Time& last_access_time,
const base::Time& last_modified_time) {
if (!base::TouchFile(path, last_access_time, last_modified_time))
- return base::PLATFORM_FILE_ERROR_FAILED;
- return base::PLATFORM_FILE_OK;
+ return base::File::FILE_ERROR_FAILED;
+ return base::File::FILE_OK;
}
-PlatformFileError NativeFileUtil::Truncate(
- const base::FilePath& path, int64 length) {
- PlatformFileError error_code(base::PLATFORM_FILE_ERROR_FAILED);
- PlatformFile file =
- base::CreatePlatformFile(
- path,
- base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_WRITE,
- NULL,
- &error_code);
- if (error_code != base::PLATFORM_FILE_OK) {
- return error_code;
- }
- DCHECK_NE(base::kInvalidPlatformFileValue, file);
- if (!base::TruncatePlatformFile(file, length))
- error_code = base::PLATFORM_FILE_ERROR_FAILED;
- base::ClosePlatformFile(file);
- return error_code;
+base::File::Error NativeFileUtil::Truncate(const base::FilePath& path,
+ int64 length) {
+ base::File file(path, base::File::FLAG_OPEN | base::File::FLAG_WRITE);
+ if (!file.IsValid())
+ return file.error_details();
+
+ if (!file.SetLength(length))
+ return base::File::FILE_ERROR_FAILED;
+
+ return base::File::FILE_OK;
}
bool NativeFileUtil::PathExists(const base::FilePath& path) {
@@ -254,45 +250,45 @@
return base::DirectoryExists(path);
}
-PlatformFileError NativeFileUtil::CopyOrMoveFile(
+base::File::Error NativeFileUtil::CopyOrMoveFile(
const base::FilePath& src_path,
const base::FilePath& dest_path,
FileSystemOperation::CopyOrMoveOption option,
CopyOrMoveMode mode) {
- base::PlatformFileInfo info;
- base::PlatformFileError error = NativeFileUtil::GetFileInfo(src_path, &info);
- if (error != base::PLATFORM_FILE_OK)
+ base::File::Info info;
+ base::File::Error error = NativeFileUtil::GetFileInfo(src_path, &info);
+ if (error != base::File::FILE_OK)
return error;
if (info.is_directory)
- return base::PLATFORM_FILE_ERROR_NOT_A_FILE;
+ return base::File::FILE_ERROR_NOT_A_FILE;
base::Time last_modified = info.last_modified;
error = NativeFileUtil::GetFileInfo(dest_path, &info);
- if (error != base::PLATFORM_FILE_OK &&
- error != base::PLATFORM_FILE_ERROR_NOT_FOUND)
+ if (error != base::File::FILE_OK &&
+ error != base::File::FILE_ERROR_NOT_FOUND)
return error;
if (info.is_directory)
- return base::PLATFORM_FILE_ERROR_INVALID_OPERATION;
- if (error == base::PLATFORM_FILE_ERROR_NOT_FOUND) {
+ return base::File::FILE_ERROR_INVALID_OPERATION;
+ if (error == base::File::FILE_ERROR_NOT_FOUND) {
error = NativeFileUtil::GetFileInfo(dest_path.DirName(), &info);
- if (error != base::PLATFORM_FILE_OK)
+ if (error != base::File::FILE_OK)
return error;
if (!info.is_directory)
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ return base::File::FILE_ERROR_NOT_FOUND;
}
switch (mode) {
case COPY_NOSYNC:
if (!base::CopyFile(src_path, dest_path))
- return base::PLATFORM_FILE_ERROR_FAILED;
+ return base::File::FILE_ERROR_FAILED;
break;
case COPY_SYNC:
if (!CopyFileAndSync(src_path, dest_path))
- return base::PLATFORM_FILE_ERROR_FAILED;
+ return base::File::FILE_ERROR_FAILED;
break;
case MOVE:
if (!base::Move(src_path, dest_path))
- return base::PLATFORM_FILE_ERROR_FAILED;
+ return base::File::FILE_ERROR_FAILED;
break;
}
@@ -301,29 +297,29 @@
if (option == FileSystemOperation::OPTION_PRESERVE_LAST_MODIFIED)
base::TouchFile(dest_path, last_modified, last_modified);
- return base::PLATFORM_FILE_OK;
+ return base::File::FILE_OK;
}
-PlatformFileError NativeFileUtil::DeleteFile(const base::FilePath& path) {
+base::File::Error NativeFileUtil::DeleteFile(const base::FilePath& path) {
if (!base::PathExists(path))
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ return base::File::FILE_ERROR_NOT_FOUND;
if (base::DirectoryExists(path))
- return base::PLATFORM_FILE_ERROR_NOT_A_FILE;
+ return base::File::FILE_ERROR_NOT_A_FILE;
if (!base::DeleteFile(path, false))
- return base::PLATFORM_FILE_ERROR_FAILED;
- return base::PLATFORM_FILE_OK;
+ return base::File::FILE_ERROR_FAILED;
+ return base::File::FILE_OK;
}
-PlatformFileError NativeFileUtil::DeleteDirectory(const base::FilePath& path) {
+base::File::Error NativeFileUtil::DeleteDirectory(const base::FilePath& path) {
if (!base::PathExists(path))
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ return base::File::FILE_ERROR_NOT_FOUND;
if (!base::DirectoryExists(path))
- return base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY;
+ return base::File::FILE_ERROR_NOT_A_DIRECTORY;
if (!base::IsDirectoryEmpty(path))
- return base::PLATFORM_FILE_ERROR_NOT_EMPTY;
+ return base::File::FILE_ERROR_NOT_EMPTY;
if (!base::DeleteFile(path, false))
- return base::PLATFORM_FILE_ERROR_FAILED;
- return base::PLATFORM_FILE_OK;
+ return base::File::FILE_ERROR_FAILED;
+ return base::File::FILE_OK;
}
} // namespace fileapi
diff --git a/webkit/browser/fileapi/native_file_util.h b/webkit/browser/fileapi/native_file_util.h
index 4c36e5f..7069c02e 100644
--- a/webkit/browser/fileapi/native_file_util.h
+++ b/webkit/browser/fileapi/native_file_util.h
@@ -5,6 +5,7 @@
#ifndef WEBKIT_BROWSER_FILEAPI_NATIVE_FILE_UTIL_H_
#define WEBKIT_BROWSER_FILEAPI_NATIVE_FILE_UTIL_H_
+#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/files/file_util_proxy.h"
#include "base/memory/scoped_ptr.h"
@@ -38,36 +39,36 @@
static CopyOrMoveMode CopyOrMoveModeForDestination(
const FileSystemURL& dest_url, bool copy);
- static base::PlatformFileError CreateOrOpen(
+ static base::File::Error CreateOrOpen(
const base::FilePath& path,
int file_flags,
base::PlatformFile* file_handle,
bool* created);
- static base::PlatformFileError Close(base::PlatformFile file);
- static base::PlatformFileError EnsureFileExists(const base::FilePath& path,
- bool* created);
- static base::PlatformFileError CreateDirectory(const base::FilePath& path,
- bool exclusive,
- bool recursive);
- static base::PlatformFileError GetFileInfo(const base::FilePath& path,
- base::PlatformFileInfo* file_info);
+ static base::File::Error Close(base::PlatformFile file);
+ static base::File::Error EnsureFileExists(const base::FilePath& path,
+ bool* created);
+ static base::File::Error CreateDirectory(const base::FilePath& path,
+ bool exclusive,
+ bool recursive);
+ static base::File::Error GetFileInfo(const base::FilePath& path,
+ base::File::Info* file_info);
static scoped_ptr<FileSystemFileUtil::AbstractFileEnumerator>
CreateFileEnumerator(const base::FilePath& root_path,
bool recursive);
- static base::PlatformFileError Touch(const base::FilePath& path,
- const base::Time& last_access_time,
- const base::Time& last_modified_time);
- static base::PlatformFileError Truncate(const base::FilePath& path,
+ static base::File::Error Touch(const base::FilePath& path,
+ const base::Time& last_access_time,
+ const base::Time& last_modified_time);
+ static base::File::Error Truncate(const base::FilePath& path,
int64 length);
static bool PathExists(const base::FilePath& path);
static bool DirectoryExists(const base::FilePath& path);
- static base::PlatformFileError CopyOrMoveFile(
+ static base::File::Error CopyOrMoveFile(
const base::FilePath& src_path,
const base::FilePath& dest_path,
FileSystemOperation::CopyOrMoveOption option,
CopyOrMoveMode mode);
- static base::PlatformFileError DeleteFile(const base::FilePath& path);
- static base::PlatformFileError DeleteDirectory(const base::FilePath& path);
+ static base::File::Error DeleteFile(const base::FilePath& path);
+ static base::File::Error DeleteDirectory(const base::FilePath& path);
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(NativeFileUtil);
diff --git a/webkit/browser/fileapi/native_file_util_unittest.cc b/webkit/browser/fileapi/native_file_util_unittest.cc
index 587bf9a..cdf088ff 100644
--- a/webkit/browser/fileapi/native_file_util_unittest.cc
+++ b/webkit/browser/fileapi/native_file_util_unittest.cc
@@ -52,7 +52,7 @@
base::PlatformFile file_handle;
bool created = false;
int flags = base::PLATFORM_FILE_WRITE | base::PLATFORM_FILE_ASYNC;
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
NativeFileUtil::CreateOrOpen(file_name,
base::PLATFORM_FILE_CREATE | flags,
&file_handle, &created));
@@ -63,16 +63,16 @@
EXPECT_EQ(0, GetSize(file_name));
EXPECT_NE(base::kInvalidPlatformFileValue, file_handle);
- ASSERT_EQ(base::PLATFORM_FILE_OK, NativeFileUtil::Close(file_handle));
+ ASSERT_EQ(base::File::FILE_OK, NativeFileUtil::Close(file_handle));
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
NativeFileUtil::CreateOrOpen(file_name,
base::PLATFORM_FILE_OPEN | flags,
&file_handle, &created));
ASSERT_FALSE(created);
- ASSERT_EQ(base::PLATFORM_FILE_OK, NativeFileUtil::Close(file_handle));
+ ASSERT_EQ(base::File::FILE_OK, NativeFileUtil::Close(file_handle));
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
NativeFileUtil::DeleteFile(file_name));
EXPECT_FALSE(base::PathExists(file_name));
EXPECT_FALSE(NativeFileUtil::PathExists(file_name));
@@ -81,21 +81,21 @@
TEST_F(NativeFileUtilTest, EnsureFileExists) {
base::FilePath file_name = Path("foobar");
bool created = false;
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
NativeFileUtil::EnsureFileExists(file_name, &created));
ASSERT_TRUE(created);
EXPECT_TRUE(FileExists(file_name));
EXPECT_EQ(0, GetSize(file_name));
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
NativeFileUtil::EnsureFileExists(file_name, &created));
EXPECT_FALSE(created);
}
TEST_F(NativeFileUtilTest, CreateAndDeleteDirectory) {
base::FilePath dir_name = Path("test_dir");
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
NativeFileUtil::CreateDirectory(dir_name,
false /* exclusive */,
false /* recursive */));
@@ -103,12 +103,12 @@
EXPECT_TRUE(NativeFileUtil::DirectoryExists(dir_name));
EXPECT_TRUE(base::DirectoryExists(dir_name));
- ASSERT_EQ(base::PLATFORM_FILE_ERROR_EXISTS,
+ ASSERT_EQ(base::File::FILE_ERROR_EXISTS,
NativeFileUtil::CreateDirectory(dir_name,
true /* exclusive */,
false /* recursive */));
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
NativeFileUtil::DeleteDirectory(dir_name));
EXPECT_FALSE(base::DirectoryExists(dir_name));
EXPECT_FALSE(NativeFileUtil::DirectoryExists(dir_name));
@@ -116,18 +116,18 @@
TEST_F(NativeFileUtilTest, TouchFileAndGetFileInfo) {
base::FilePath file_name = Path("test_file");
- base::PlatformFileInfo native_info;
- ASSERT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND,
+ base::File::Info native_info;
+ ASSERT_EQ(base::File::FILE_ERROR_NOT_FOUND,
NativeFileUtil::GetFileInfo(file_name, &native_info));
bool created = false;
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
NativeFileUtil::EnsureFileExists(file_name, &created));
ASSERT_TRUE(created);
base::File::Info info;
ASSERT_TRUE(base::GetFileInfo(file_name, &info));
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
NativeFileUtil::GetFileInfo(file_name, &native_info));
ASSERT_EQ(info.size, native_info.size);
ASSERT_EQ(info.is_directory, native_info.is_directory);
@@ -141,7 +141,7 @@
const base::Time new_modified =
info.last_modified + base::TimeDelta::FromHours(5);
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ EXPECT_EQ(base::File::FILE_OK,
NativeFileUtil::Touch(file_name,
new_accessed, new_modified));
@@ -157,16 +157,16 @@
base::FilePath path_12 = Path("dir1").AppendASCII("dir12");
base::FilePath path_121 =
Path("dir1").AppendASCII("dir12").AppendASCII("file121");
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
NativeFileUtil::CreateDirectory(path_1, false, false));
bool created = false;
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
NativeFileUtil::EnsureFileExists(path_2, &created));
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
NativeFileUtil::EnsureFileExists(path_11, &created));
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
NativeFileUtil::CreateDirectory(path_12, false, false));
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
NativeFileUtil::EnsureFileExists(path_121, &created));
{
@@ -200,11 +200,11 @@
TEST_F(NativeFileUtilTest, Truncate) {
base::FilePath file_name = Path("truncated");
bool created = false;
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
NativeFileUtil::EnsureFileExists(file_name, &created));
ASSERT_TRUE(created);
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
NativeFileUtil::Truncate(file_name, 1020));
EXPECT_TRUE(FileExists(file_name));
@@ -218,21 +218,21 @@
const NativeFileUtil::CopyOrMoveMode nosync = NativeFileUtil::COPY_NOSYNC;
const NativeFileUtil::CopyOrMoveMode sync = NativeFileUtil::COPY_SYNC;
bool created = false;
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
NativeFileUtil::EnsureFileExists(from_file, &created));
ASSERT_TRUE(created);
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
NativeFileUtil::Truncate(from_file, 1020));
EXPECT_TRUE(FileExists(from_file));
EXPECT_EQ(1020, GetSize(from_file));
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
NativeFileUtil::CopyOrMoveFile(
from_file, to_file1, FileSystemOperation::OPTION_NONE, nosync));
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
NativeFileUtil::CopyOrMoveFile(
from_file, to_file2, FileSystemOperation::OPTION_NONE, sync));
@@ -244,11 +244,11 @@
EXPECT_EQ(1020, GetSize(to_file2));
base::FilePath dir = Path("dir");
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
NativeFileUtil::CreateDirectory(dir, false, false));
ASSERT_TRUE(base::DirectoryExists(dir));
base::FilePath to_dir_file = dir.AppendASCII("file");
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
NativeFileUtil::CopyOrMoveFile(
from_file, to_dir_file,
FileSystemOperation::OPTION_NONE, nosync));
@@ -257,26 +257,26 @@
// Following tests are error checking.
// Source doesn't exist.
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND,
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND,
NativeFileUtil::CopyOrMoveFile(
Path("nonexists"), Path("file"),
FileSystemOperation::OPTION_NONE, nosync));
// Source is not a file.
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_A_FILE,
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_A_FILE,
NativeFileUtil::CopyOrMoveFile(
dir, Path("file"), FileSystemOperation::OPTION_NONE, nosync));
// Destination is not a file.
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_INVALID_OPERATION,
+ EXPECT_EQ(base::File::FILE_ERROR_INVALID_OPERATION,
NativeFileUtil::CopyOrMoveFile(
from_file, dir, FileSystemOperation::OPTION_NONE, nosync));
// Destination's parent doesn't exist.
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND,
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND,
NativeFileUtil::CopyOrMoveFile(
from_file, Path("nodir").AppendASCII("file"),
FileSystemOperation::OPTION_NONE, nosync));
// Destination's parent is a file.
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND,
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND,
NativeFileUtil::CopyOrMoveFile(
from_file, Path("tofile1").AppendASCII("file"),
FileSystemOperation::OPTION_NONE, nosync));
@@ -287,16 +287,16 @@
base::FilePath to_file = Path("tofile");
const NativeFileUtil::CopyOrMoveMode move = NativeFileUtil::MOVE;
bool created = false;
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
NativeFileUtil::EnsureFileExists(from_file, &created));
ASSERT_TRUE(created);
- ASSERT_EQ(base::PLATFORM_FILE_OK, NativeFileUtil::Truncate(from_file, 1020));
+ ASSERT_EQ(base::File::FILE_OK, NativeFileUtil::Truncate(from_file, 1020));
EXPECT_TRUE(FileExists(from_file));
EXPECT_EQ(1020, GetSize(from_file));
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
NativeFileUtil::CopyOrMoveFile(
from_file, to_file, FileSystemOperation::OPTION_NONE, move));
@@ -304,17 +304,17 @@
EXPECT_TRUE(FileExists(to_file));
EXPECT_EQ(1020, GetSize(to_file));
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
NativeFileUtil::EnsureFileExists(from_file, &created));
ASSERT_TRUE(FileExists(from_file));
- ASSERT_EQ(base::PLATFORM_FILE_OK, NativeFileUtil::Truncate(from_file, 1020));
+ ASSERT_EQ(base::File::FILE_OK, NativeFileUtil::Truncate(from_file, 1020));
base::FilePath dir = Path("dir");
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
NativeFileUtil::CreateDirectory(dir, false, false));
ASSERT_TRUE(base::DirectoryExists(dir));
base::FilePath to_dir_file = dir.AppendASCII("file");
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
NativeFileUtil::CopyOrMoveFile(
from_file, to_dir_file,
FileSystemOperation::OPTION_NONE, move));
@@ -324,33 +324,33 @@
// Following is error checking.
// Source doesn't exist.
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND,
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND,
NativeFileUtil::CopyOrMoveFile(
Path("nonexists"), Path("file"),
FileSystemOperation::OPTION_NONE, move));
// Source is not a file.
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_A_FILE,
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_A_FILE,
NativeFileUtil::CopyOrMoveFile(
dir, Path("file"), FileSystemOperation::OPTION_NONE, move));
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
NativeFileUtil::EnsureFileExists(from_file, &created));
ASSERT_TRUE(FileExists(from_file));
// Destination is not a file.
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_INVALID_OPERATION,
+ EXPECT_EQ(base::File::FILE_ERROR_INVALID_OPERATION,
NativeFileUtil::CopyOrMoveFile(
from_file, dir, FileSystemOperation::OPTION_NONE, move));
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
NativeFileUtil::EnsureFileExists(from_file, &created));
ASSERT_TRUE(FileExists(from_file));
// Destination's parent doesn't exist.
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND,
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND,
NativeFileUtil::CopyOrMoveFile(
from_file, Path("nodir").AppendASCII("file"),
FileSystemOperation::OPTION_NONE, move));
// Destination's parent is a file.
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND,
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND,
NativeFileUtil::CopyOrMoveFile(
from_file, Path("tofile1").AppendASCII("file"),
FileSystemOperation::OPTION_NONE, move));
@@ -362,49 +362,49 @@
base::FilePath to_file2 = Path("tofile2");
base::FilePath to_file3 = Path("tofile3");
bool created = false;
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
NativeFileUtil::EnsureFileExists(from_file, &created));
ASSERT_TRUE(created);
EXPECT_TRUE(FileExists(from_file));
- base::PlatformFileInfo file_info1;
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ base::File::Info file_info1;
+ ASSERT_EQ(base::File::FILE_OK,
NativeFileUtil::GetFileInfo(from_file, &file_info1));
// Test for copy (nosync).
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
NativeFileUtil::CopyOrMoveFile(
from_file, to_file1,
FileSystemOperation::OPTION_PRESERVE_LAST_MODIFIED,
NativeFileUtil::COPY_NOSYNC));
- base::PlatformFileInfo file_info2;
+ base::File::Info file_info2;
ASSERT_TRUE(FileExists(to_file1));
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
NativeFileUtil::GetFileInfo(to_file1, &file_info2));
EXPECT_EQ(file_info1.last_modified, file_info2.last_modified);
// Test for copy (sync).
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
NativeFileUtil::CopyOrMoveFile(
from_file, to_file2,
FileSystemOperation::OPTION_PRESERVE_LAST_MODIFIED,
NativeFileUtil::COPY_SYNC));
ASSERT_TRUE(FileExists(to_file2));
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
NativeFileUtil::GetFileInfo(to_file1, &file_info2));
EXPECT_EQ(file_info1.last_modified, file_info2.last_modified);
// Test for move.
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
NativeFileUtil::CopyOrMoveFile(
from_file, to_file3,
FileSystemOperation::OPTION_PRESERVE_LAST_MODIFIED,
NativeFileUtil::MOVE));
ASSERT_TRUE(FileExists(to_file3));
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
NativeFileUtil::GetFileInfo(to_file2, &file_info2));
EXPECT_EQ(file_info1.last_modified, file_info2.last_modified);
}
diff --git a/webkit/browser/fileapi/obfuscated_file_util.cc b/webkit/browser/fileapi/obfuscated_file_util.cc
index 18243976b..5cae814 100644
--- a/webkit/browser/fileapi/obfuscated_file_util.cc
+++ b/webkit/browser/fileapi/obfuscated_file_util.cc
@@ -106,7 +106,6 @@
} // namespace
using base::PlatformFile;
-using base::PlatformFileError;
class ObfuscatedFileEnumerator
: public FileSystemFileUtil::AbstractFileEnumerator {
@@ -145,11 +144,11 @@
FileInfo file_info;
base::FilePath platform_file_path;
- base::PlatformFileError error =
+ base::File::Error error =
obfuscated_file_util_->GetFileInfoInternal(
db_, context_, root_url_, current_file_id_,
&file_info, ¤t_platform_file_info_, &platform_file_path);
- if (error != base::PLATFORM_FILE_OK)
+ if (error != base::File::FILE_OK)
return Next();
base::FilePath virtual_path =
@@ -205,7 +204,7 @@
base::FilePath current_parent_virtual_path_;
FileId current_file_id_;
- base::PlatformFileInfo current_platform_file_info_;
+ base::File::Info current_platform_file_info_;
};
class ObfuscatedOriginEnumerator
@@ -272,52 +271,52 @@
DropDatabases();
}
-PlatformFileError ObfuscatedFileUtil::CreateOrOpen(
+base::File::Error ObfuscatedFileUtil::CreateOrOpen(
FileSystemOperationContext* context,
const FileSystemURL& url, int file_flags,
PlatformFile* file_handle, bool* created) {
- PlatformFileError error = CreateOrOpenInternal(context, url, file_flags,
+ base::File::Error error = CreateOrOpenInternal(context, url, file_flags,
file_handle, created);
if (*file_handle != base::kInvalidPlatformFileValue &&
file_flags & base::PLATFORM_FILE_WRITE &&
context->quota_limit_type() == quota::kQuotaLimitTypeUnlimited &&
sandbox_delegate_) {
- DCHECK_EQ(base::PLATFORM_FILE_OK, error);
+ DCHECK_EQ(base::File::FILE_OK, error);
sandbox_delegate_->StickyInvalidateUsageCache(url.origin(), url.type());
}
return error;
}
-PlatformFileError ObfuscatedFileUtil::Close(
+base::File::Error ObfuscatedFileUtil::Close(
FileSystemOperationContext* context,
base::PlatformFile file) {
return NativeFileUtil::Close(file);
}
-PlatformFileError ObfuscatedFileUtil::EnsureFileExists(
+base::File::Error ObfuscatedFileUtil::EnsureFileExists(
FileSystemOperationContext* context,
const FileSystemURL& url,
bool* created) {
SandboxDirectoryDatabase* db = GetDirectoryDatabase(url, true);
if (!db)
- return base::PLATFORM_FILE_ERROR_FAILED;
+ return base::File::FILE_ERROR_FAILED;
FileId file_id;
if (db->GetFileWithPath(url.path(), &file_id)) {
FileInfo file_info;
if (!db->GetFileInfo(file_id, &file_info)) {
NOTREACHED();
- return base::PLATFORM_FILE_ERROR_FAILED;
+ return base::File::FILE_ERROR_FAILED;
}
if (file_info.is_directory())
- return base::PLATFORM_FILE_ERROR_NOT_A_FILE;
+ return base::File::FILE_ERROR_NOT_A_FILE;
if (created)
*created = false;
- return base::PLATFORM_FILE_OK;
+ return base::File::FILE_OK;
}
FileId parent_id;
if (!db->GetFileWithPath(VirtualPath::DirName(url.path()), &parent_id))
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ return base::File::FILE_ERROR_NOT_FOUND;
FileInfo file_info;
InitFileInfo(&file_info, parent_id,
@@ -325,10 +324,10 @@
int64 growth = UsageForPath(file_info.name.size());
if (!AllocateQuota(context, growth))
- return base::PLATFORM_FILE_ERROR_NO_SPACE;
- PlatformFileError error = CreateFile(
+ return base::File::FILE_ERROR_NO_SPACE;
+ base::File::Error error = CreateFile(
context, base::FilePath(), url, &file_info, 0, NULL);
- if (created && base::PLATFORM_FILE_OK == error) {
+ if (created && base::File::FILE_OK == error) {
*created = true;
UpdateUsage(context, url, growth);
context->change_observers()->Notify(
@@ -337,27 +336,27 @@
return error;
}
-PlatformFileError ObfuscatedFileUtil::CreateDirectory(
+base::File::Error ObfuscatedFileUtil::CreateDirectory(
FileSystemOperationContext* context,
const FileSystemURL& url,
bool exclusive,
bool recursive) {
SandboxDirectoryDatabase* db = GetDirectoryDatabase(url, true);
if (!db)
- return base::PLATFORM_FILE_ERROR_FAILED;
+ return base::File::FILE_ERROR_FAILED;
FileId file_id;
if (db->GetFileWithPath(url.path(), &file_id)) {
FileInfo file_info;
if (exclusive)
- return base::PLATFORM_FILE_ERROR_EXISTS;
+ return base::File::FILE_ERROR_EXISTS;
if (!db->GetFileInfo(file_id, &file_info)) {
NOTREACHED();
- return base::PLATFORM_FILE_ERROR_FAILED;
+ return base::File::FILE_ERROR_FAILED;
}
if (!file_info.is_directory())
- return base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY;
- return base::PLATFORM_FILE_OK;
+ return base::File::FILE_ERROR_NOT_A_DIRECTORY;
+ return base::File::FILE_OK;
}
std::vector<base::FilePath::StringType> components;
@@ -372,9 +371,9 @@
break;
}
if (!db->IsDirectory(parent_id))
- return base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY;
+ return base::File::FILE_ERROR_NOT_A_DIRECTORY;
if (!recursive && components.size() - index > 1)
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ return base::File::FILE_ERROR_NOT_FOUND;
bool first = true;
for (; index < components.size(); ++index) {
FileInfo file_info;
@@ -385,9 +384,9 @@
file_info.parent_id = parent_id;
int64 growth = UsageForPath(file_info.name.size());
if (!AllocateQuota(context, growth))
- return base::PLATFORM_FILE_ERROR_NO_SPACE;
- base::PlatformFileError error = db->AddFileInfo(file_info, &parent_id);
- if (error != base::PLATFORM_FILE_OK)
+ return base::File::FILE_ERROR_NO_SPACE;
+ base::File::Error error = db->AddFileInfo(file_info, &parent_id);
+ if (error != base::File::FILE_OK)
return error;
UpdateUsage(context, url, growth);
context->change_observers()->Notify(
@@ -397,20 +396,20 @@
TouchDirectory(db, file_info.parent_id);
}
}
- return base::PLATFORM_FILE_OK;
+ return base::File::FILE_OK;
}
-PlatformFileError ObfuscatedFileUtil::GetFileInfo(
+base::File::Error ObfuscatedFileUtil::GetFileInfo(
FileSystemOperationContext* context,
const FileSystemURL& url,
- base::PlatformFileInfo* file_info,
+ base::File::Info* file_info,
base::FilePath* platform_file_path) {
SandboxDirectoryDatabase* db = GetDirectoryDatabase(url, false);
if (!db)
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ return base::File::FILE_ERROR_NOT_FOUND;
FileId file_id;
if (!db->GetFileWithPath(url.path(), &file_id))
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ return base::File::FILE_ERROR_NOT_FOUND;
FileInfo local_info;
return GetFileInfoInternal(db, context, url,
file_id, &local_info,
@@ -424,72 +423,72 @@
return CreateFileEnumerator(context, root_url, false /* recursive */);
}
-PlatformFileError ObfuscatedFileUtil::GetLocalFilePath(
+base::File::Error ObfuscatedFileUtil::GetLocalFilePath(
FileSystemOperationContext* context,
const FileSystemURL& url,
base::FilePath* local_path) {
SandboxDirectoryDatabase* db = GetDirectoryDatabase(url, false);
if (!db)
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ return base::File::FILE_ERROR_NOT_FOUND;
FileId file_id;
if (!db->GetFileWithPath(url.path(), &file_id))
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ return base::File::FILE_ERROR_NOT_FOUND;
FileInfo file_info;
if (!db->GetFileInfo(file_id, &file_info) || file_info.is_directory()) {
NOTREACHED();
// Directories have no local file path.
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ return base::File::FILE_ERROR_NOT_FOUND;
}
*local_path = DataPathToLocalPath(url, file_info.data_path);
if (local_path->empty())
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
- return base::PLATFORM_FILE_OK;
+ return base::File::FILE_ERROR_NOT_FOUND;
+ return base::File::FILE_OK;
}
-PlatformFileError ObfuscatedFileUtil::Touch(
+base::File::Error ObfuscatedFileUtil::Touch(
FileSystemOperationContext* context,
const FileSystemURL& url,
const base::Time& last_access_time,
const base::Time& last_modified_time) {
SandboxDirectoryDatabase* db = GetDirectoryDatabase(url, false);
if (!db)
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ return base::File::FILE_ERROR_NOT_FOUND;
FileId file_id;
if (!db->GetFileWithPath(url.path(), &file_id))
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ return base::File::FILE_ERROR_NOT_FOUND;
FileInfo file_info;
if (!db->GetFileInfo(file_id, &file_info)) {
NOTREACHED();
- return base::PLATFORM_FILE_ERROR_FAILED;
+ return base::File::FILE_ERROR_FAILED;
}
if (file_info.is_directory()) {
if (!db->UpdateModificationTime(file_id, last_modified_time))
- return base::PLATFORM_FILE_ERROR_FAILED;
- return base::PLATFORM_FILE_OK;
+ return base::File::FILE_ERROR_FAILED;
+ return base::File::FILE_OK;
}
return NativeFileUtil::Touch(
DataPathToLocalPath(url, file_info.data_path),
last_access_time, last_modified_time);
}
-PlatformFileError ObfuscatedFileUtil::Truncate(
+base::File::Error ObfuscatedFileUtil::Truncate(
FileSystemOperationContext* context,
const FileSystemURL& url,
int64 length) {
- base::PlatformFileInfo file_info;
+ base::File::Info file_info;
base::FilePath local_path;
- base::PlatformFileError error =
+ base::File::Error error =
GetFileInfo(context, url, &file_info, &local_path);
- if (error != base::PLATFORM_FILE_OK)
+ if (error != base::File::FILE_OK)
return error;
int64 growth = length - file_info.size;
if (!AllocateQuota(context, growth))
- return base::PLATFORM_FILE_ERROR_NO_SPACE;
+ return base::File::FILE_ERROR_NO_SPACE;
error = NativeFileUtil::Truncate(local_path, length);
- if (error == base::PLATFORM_FILE_OK) {
+ if (error == base::File::FILE_OK) {
UpdateUsage(context, url, growth);
context->change_observers()->Notify(
&FileChangeObserver::OnModifyFile, MakeTuple(url));
@@ -497,7 +496,7 @@
return error;
}
-PlatformFileError ObfuscatedFileUtil::CopyOrMoveFile(
+base::File::Error ObfuscatedFileUtil::CopyOrMoveFile(
FileSystemOperationContext* context,
const FileSystemURL& src_url,
const FileSystemURL& dest_url,
@@ -509,46 +508,46 @@
SandboxDirectoryDatabase* db = GetDirectoryDatabase(src_url, true);
if (!db)
- return base::PLATFORM_FILE_ERROR_FAILED;
+ return base::File::FILE_ERROR_FAILED;
FileId src_file_id;
if (!db->GetFileWithPath(src_url.path(), &src_file_id))
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ return base::File::FILE_ERROR_NOT_FOUND;
FileId dest_file_id;
bool overwrite = db->GetFileWithPath(dest_url.path(),
&dest_file_id);
FileInfo src_file_info;
- base::PlatformFileInfo src_platform_file_info;
+ base::File::Info src_platform_file_info;
base::FilePath src_local_path;
- base::PlatformFileError error = GetFileInfoInternal(
+ base::File::Error error = GetFileInfoInternal(
db, context, src_url, src_file_id,
&src_file_info, &src_platform_file_info, &src_local_path);
- if (error != base::PLATFORM_FILE_OK)
+ if (error != base::File::FILE_OK)
return error;
if (src_file_info.is_directory())
- return base::PLATFORM_FILE_ERROR_NOT_A_FILE;
+ return base::File::FILE_ERROR_NOT_A_FILE;
FileInfo dest_file_info;
- base::PlatformFileInfo dest_platform_file_info; // overwrite case only
+ base::File::Info dest_platform_file_info; // overwrite case only
base::FilePath dest_local_path; // overwrite case only
if (overwrite) {
- base::PlatformFileError error = GetFileInfoInternal(
+ base::File::Error error = GetFileInfoInternal(
db, context, dest_url, dest_file_id,
&dest_file_info, &dest_platform_file_info, &dest_local_path);
- if (error == base::PLATFORM_FILE_ERROR_NOT_FOUND)
+ if (error == base::File::FILE_ERROR_NOT_FOUND)
overwrite = false; // fallback to non-overwrite case
- else if (error != base::PLATFORM_FILE_OK)
+ else if (error != base::File::FILE_OK)
return error;
else if (dest_file_info.is_directory())
- return base::PLATFORM_FILE_ERROR_INVALID_OPERATION;
+ return base::File::FILE_ERROR_INVALID_OPERATION;
}
if (!overwrite) {
FileId dest_parent_id;
if (!db->GetFileWithPath(VirtualPath::DirName(dest_url.path()),
&dest_parent_id)) {
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ return base::File::FILE_ERROR_NOT_FOUND;
}
dest_file_info = src_file_info;
@@ -567,7 +566,7 @@
else
growth += UsageForPath(dest_file_info.name.size());
if (!AllocateQuota(context, growth))
- return base::PLATFORM_FILE_ERROR_NO_SPACE;
+ return base::File::FILE_ERROR_NO_SPACE;
/*
* Copy-with-overwrite
@@ -583,7 +582,7 @@
* Move-without-overwrite
* Just update metadata
*/
- error = base::PLATFORM_FILE_ERROR_FAILED;
+ error = base::File::FILE_ERROR_FAILED;
if (copy) {
if (overwrite) {
error = NativeFileUtil::CopyOrMoveFile(
@@ -599,22 +598,22 @@
} else {
if (overwrite) {
if (db->OverwritingMoveFile(src_file_id, dest_file_id)) {
- if (base::PLATFORM_FILE_OK !=
+ if (base::File::FILE_OK !=
NativeFileUtil::DeleteFile(dest_local_path))
LOG(WARNING) << "Leaked a backing file.";
- error = base::PLATFORM_FILE_OK;
+ error = base::File::FILE_OK;
} else {
- error = base::PLATFORM_FILE_ERROR_FAILED;
+ error = base::File::FILE_ERROR_FAILED;
}
} else { // non-overwrite
if (db->UpdateFileInfo(src_file_id, dest_file_info))
- error = base::PLATFORM_FILE_OK;
+ error = base::File::FILE_OK;
else
- error = base::PLATFORM_FILE_ERROR_FAILED;
+ error = base::File::FILE_ERROR_FAILED;
}
}
- if (error != base::PLATFORM_FILE_OK)
+ if (error != base::File::FILE_OK)
return error;
if (overwrite) {
@@ -639,44 +638,44 @@
return error;
}
-PlatformFileError ObfuscatedFileUtil::CopyInForeignFile(
+base::File::Error ObfuscatedFileUtil::CopyInForeignFile(
FileSystemOperationContext* context,
const base::FilePath& src_file_path,
const FileSystemURL& dest_url) {
SandboxDirectoryDatabase* db = GetDirectoryDatabase(dest_url, true);
if (!db)
- return base::PLATFORM_FILE_ERROR_FAILED;
+ return base::File::FILE_ERROR_FAILED;
base::File::Info src_platform_file_info;
if (!base::GetFileInfo(src_file_path, &src_platform_file_info))
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ return base::File::FILE_ERROR_NOT_FOUND;
FileId dest_file_id;
bool overwrite = db->GetFileWithPath(dest_url.path(),
&dest_file_id);
FileInfo dest_file_info;
- base::PlatformFileInfo dest_platform_file_info; // overwrite case only
+ base::File::Info dest_platform_file_info; // overwrite case only
if (overwrite) {
base::FilePath dest_local_path;
- base::PlatformFileError error = GetFileInfoInternal(
+ base::File::Error error = GetFileInfoInternal(
db, context, dest_url, dest_file_id,
&dest_file_info, &dest_platform_file_info, &dest_local_path);
- if (error == base::PLATFORM_FILE_ERROR_NOT_FOUND)
+ if (error == base::File::FILE_ERROR_NOT_FOUND)
overwrite = false; // fallback to non-overwrite case
- else if (error != base::PLATFORM_FILE_OK)
+ else if (error != base::File::FILE_OK)
return error;
else if (dest_file_info.is_directory())
- return base::PLATFORM_FILE_ERROR_INVALID_OPERATION;
+ return base::File::FILE_ERROR_INVALID_OPERATION;
}
if (!overwrite) {
FileId dest_parent_id;
if (!db->GetFileWithPath(VirtualPath::DirName(dest_url.path()),
&dest_parent_id)) {
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ return base::File::FILE_ERROR_NOT_FOUND;
}
if (!dest_file_info.is_directory())
- return base::PLATFORM_FILE_ERROR_FAILED;
+ return base::File::FILE_ERROR_FAILED;
InitFileInfo(&dest_file_info, dest_parent_id,
VirtualPath::BaseName(dest_url.path()).value());
}
@@ -687,9 +686,9 @@
else
growth += UsageForPath(dest_file_info.name.size());
if (!AllocateQuota(context, growth))
- return base::PLATFORM_FILE_ERROR_NO_SPACE;
+ return base::File::FILE_ERROR_NO_SPACE;
- base::PlatformFileError error;
+ base::File::Error error;
if (overwrite) {
base::FilePath dest_local_path =
DataPathToLocalPath(dest_url, dest_file_info.data_path);
@@ -703,7 +702,7 @@
dest_url, &dest_file_info, 0, NULL);
}
- if (error != base::PLATFORM_FILE_OK)
+ if (error != base::File::FILE_OK)
return error;
if (overwrite) {
@@ -716,36 +715,36 @@
UpdateUsage(context, dest_url, growth);
TouchDirectory(db, dest_file_info.parent_id);
- return base::PLATFORM_FILE_OK;
+ return base::File::FILE_OK;
}
-PlatformFileError ObfuscatedFileUtil::DeleteFile(
+base::File::Error ObfuscatedFileUtil::DeleteFile(
FileSystemOperationContext* context,
const FileSystemURL& url) {
SandboxDirectoryDatabase* db = GetDirectoryDatabase(url, true);
if (!db)
- return base::PLATFORM_FILE_ERROR_FAILED;
+ return base::File::FILE_ERROR_FAILED;
FileId file_id;
if (!db->GetFileWithPath(url.path(), &file_id))
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ return base::File::FILE_ERROR_NOT_FOUND;
FileInfo file_info;
- base::PlatformFileInfo platform_file_info;
+ base::File::Info platform_file_info;
base::FilePath local_path;
- base::PlatformFileError error = GetFileInfoInternal(
+ base::File::Error error = GetFileInfoInternal(
db, context, url, file_id, &file_info, &platform_file_info, &local_path);
- if (error != base::PLATFORM_FILE_ERROR_NOT_FOUND &&
- error != base::PLATFORM_FILE_OK)
+ if (error != base::File::FILE_ERROR_NOT_FOUND &&
+ error != base::File::FILE_OK)
return error;
if (file_info.is_directory())
- return base::PLATFORM_FILE_ERROR_NOT_A_FILE;
+ return base::File::FILE_ERROR_NOT_A_FILE;
int64 growth = -UsageForPath(file_info.name.size()) - platform_file_info.size;
AllocateQuota(context, growth);
if (!db->RemoveFileInfo(file_id)) {
NOTREACHED();
- return base::PLATFORM_FILE_ERROR_FAILED;
+ return base::File::FILE_ERROR_FAILED;
}
UpdateUsage(context, url, growth);
TouchDirectory(db, file_info.parent_id);
@@ -753,54 +752,54 @@
context->change_observers()->Notify(
&FileChangeObserver::OnRemoveFile, MakeTuple(url));
- if (error == base::PLATFORM_FILE_ERROR_NOT_FOUND)
- return base::PLATFORM_FILE_OK;
+ if (error == base::File::FILE_ERROR_NOT_FOUND)
+ return base::File::FILE_OK;
error = NativeFileUtil::DeleteFile(local_path);
- if (base::PLATFORM_FILE_OK != error)
+ if (base::File::FILE_OK != error)
LOG(WARNING) << "Leaked a backing file.";
- return base::PLATFORM_FILE_OK;
+ return base::File::FILE_OK;
}
-PlatformFileError ObfuscatedFileUtil::DeleteDirectory(
+base::File::Error ObfuscatedFileUtil::DeleteDirectory(
FileSystemOperationContext* context,
const FileSystemURL& url) {
SandboxDirectoryDatabase* db = GetDirectoryDatabase(url, true);
if (!db)
- return base::PLATFORM_FILE_ERROR_FAILED;
+ return base::File::FILE_ERROR_FAILED;
FileId file_id;
if (!db->GetFileWithPath(url.path(), &file_id))
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ return base::File::FILE_ERROR_NOT_FOUND;
FileInfo file_info;
if (!db->GetFileInfo(file_id, &file_info)) {
NOTREACHED();
- return base::PLATFORM_FILE_ERROR_FAILED;
+ return base::File::FILE_ERROR_FAILED;
}
if (!file_info.is_directory())
- return base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY;
+ return base::File::FILE_ERROR_NOT_A_DIRECTORY;
if (!db->RemoveFileInfo(file_id))
- return base::PLATFORM_FILE_ERROR_NOT_EMPTY;
+ return base::File::FILE_ERROR_NOT_EMPTY;
int64 growth = -UsageForPath(file_info.name.size());
AllocateQuota(context, growth);
UpdateUsage(context, url, growth);
TouchDirectory(db, file_info.parent_id);
context->change_observers()->Notify(
&FileChangeObserver::OnRemoveDirectory, MakeTuple(url));
- return base::PLATFORM_FILE_OK;
+ return base::File::FILE_OK;
}
webkit_blob::ScopedFile ObfuscatedFileUtil::CreateSnapshotFile(
FileSystemOperationContext* context,
const FileSystemURL& url,
- base::PlatformFileError* error,
- base::PlatformFileInfo* file_info,
+ base::File::Error* error,
+ base::File::Info* file_info,
base::FilePath* platform_path) {
// We're just returning the local file information.
*error = GetFileInfo(context, url, file_info, platform_path);
- if (*error == base::PLATFORM_FILE_OK && file_info->is_directory) {
- *file_info = base::PlatformFileInfo();
- *error = base::PLATFORM_FILE_ERROR_NOT_A_FILE;
+ if (*error == base::File::FILE_OK && file_info->is_directory) {
+ *file_info = base::File::Info();
+ *error = base::File::FILE_ERROR_NOT_A_FILE;
}
return webkit_blob::ScopedFile();
}
@@ -846,19 +845,19 @@
const GURL& origin,
const std::string& type_string,
bool create,
- base::PlatformFileError* error_code) {
+ base::File::Error* error_code) {
base::FilePath origin_dir = GetDirectoryForOrigin(origin, create, error_code);
if (origin_dir.empty())
return base::FilePath();
if (type_string.empty())
return origin_dir;
base::FilePath path = origin_dir.AppendASCII(type_string);
- base::PlatformFileError error = base::PLATFORM_FILE_OK;
+ base::File::Error error = base::File::FILE_OK;
if (!base::DirectoryExists(path) &&
(!create || !base::CreateDirectory(path))) {
error = create ?
- base::PLATFORM_FILE_ERROR_FAILED :
- base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ base::File::FILE_ERROR_FAILED :
+ base::File::FILE_ERROR_NOT_FOUND;
}
if (error_code)
@@ -869,12 +868,12 @@
bool ObfuscatedFileUtil::DeleteDirectoryForOriginAndType(
const GURL& origin,
const std::string& type_string) {
- base::PlatformFileError error = base::PLATFORM_FILE_OK;
+ base::File::Error error = base::File::FILE_OK;
base::FilePath origin_type_path = GetDirectoryForOriginAndType(
origin, type_string, false, &error);
if (origin_type_path.empty())
return true;
- if (error != base::PLATFORM_FILE_ERROR_NOT_FOUND) {
+ if (error != base::File::FILE_ERROR_NOT_FOUND) {
// TODO(dmikurube): Consider the return value of DestroyDirectoryDatabase.
// We ignore its error now since 1) it doesn't matter the final result, and
// 2) it always returns false in Windows because of LevelDB's
@@ -940,10 +939,10 @@
delete database;
}
- PlatformFileError error = base::PLATFORM_FILE_OK;
+ base::File::Error error = base::File::FILE_OK;
base::FilePath path = GetDirectoryForOriginAndType(
origin, type_string, false, &error);
- if (path.empty() || error == base::PLATFORM_FILE_ERROR_NOT_FOUND)
+ if (path.empty() || error == base::File::FILE_ERROR_NOT_FOUND)
return true;
return SandboxDirectoryDatabase::DestroyDatabase(path);
}
@@ -968,10 +967,10 @@
// Only handles known types.
if (!ContainsKey(known_type_strings_, type_string))
continue;
- PlatformFileError error = base::PLATFORM_FILE_ERROR_FAILED;
+ base::File::Error error = base::File::FILE_ERROR_FAILED;
base::FilePath path = GetDirectoryForOriginAndType(
origin, type_string, false, &error);
- if (error != base::PLATFORM_FILE_OK)
+ if (error != base::File::FILE_OK)
continue;
scoped_ptr<SandboxDirectoryDatabase> db(new SandboxDirectoryDatabase(path));
if (db->Init(SandboxDirectoryDatabase::FAIL_ON_CORRUPTION)) {
@@ -987,7 +986,7 @@
base::FilePath ObfuscatedFileUtil::GetDirectoryForURL(
const FileSystemURL& url,
bool create,
- base::PlatformFileError* error_code) {
+ base::File::Error* error_code) {
return GetDirectoryForOriginAndType(
url.origin(), CallGetTypeStringForURL(url), create, error_code);
}
@@ -998,13 +997,13 @@
return get_type_string_for_url_.Run(url);
}
-PlatformFileError ObfuscatedFileUtil::GetFileInfoInternal(
+base::File::Error ObfuscatedFileUtil::GetFileInfoInternal(
SandboxDirectoryDatabase* db,
FileSystemOperationContext* context,
const FileSystemURL& url,
FileId file_id,
FileInfo* local_info,
- base::PlatformFileInfo* file_info,
+ base::File::Info* file_info,
base::FilePath* platform_file_path) {
DCHECK(db);
DCHECK(context);
@@ -1013,7 +1012,7 @@
if (!db->GetFileInfo(file_id, local_info)) {
NOTREACHED();
- return base::PLATFORM_FILE_ERROR_FAILED;
+ return base::File::FILE_ERROR_FAILED;
}
if (local_info->is_directory()) {
@@ -1023,30 +1022,30 @@
file_info->last_modified = local_info->modification_time;
*platform_file_path = base::FilePath();
// We don't fill in ctime or atime.
- return base::PLATFORM_FILE_OK;
+ return base::File::FILE_OK;
}
if (local_info->data_path.empty())
- return base::PLATFORM_FILE_ERROR_INVALID_OPERATION;
+ return base::File::FILE_ERROR_INVALID_OPERATION;
base::FilePath local_path = DataPathToLocalPath(url, local_info->data_path);
- base::PlatformFileError error = NativeFileUtil::GetFileInfo(
+ base::File::Error error = NativeFileUtil::GetFileInfo(
local_path, file_info);
// We should not follow symbolic links in sandboxed file system.
if (base::IsLink(local_path)) {
LOG(WARNING) << "Found a symbolic file.";
- error = base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ error = base::File::FILE_ERROR_NOT_FOUND;
}
- if (error == base::PLATFORM_FILE_OK) {
+ if (error == base::File::FILE_OK) {
*platform_file_path = local_path;
- } else if (error == base::PLATFORM_FILE_ERROR_NOT_FOUND) {
+ } else if (error == base::File::FILE_ERROR_NOT_FOUND) {
LOG(WARNING) << "Lost a backing file.";
InvalidateUsageCache(context, url.origin(), url.type());
if (!db->RemoveFileInfo(file_id))
- return base::PLATFORM_FILE_ERROR_FAILED;
+ return base::File::FILE_ERROR_FAILED;
}
return error;
}
-PlatformFileError ObfuscatedFileUtil::CreateFile(
+base::File::Error ObfuscatedFileUtil::CreateFile(
FileSystemOperationContext* context,
const base::FilePath& src_file_path,
const FileSystemURL& dest_url,
@@ -1055,14 +1054,14 @@
*handle = base::kInvalidPlatformFileValue;
SandboxDirectoryDatabase* db = GetDirectoryDatabase(dest_url, true);
- PlatformFileError error = base::PLATFORM_FILE_OK;
+ base::File::Error error = base::File::FILE_OK;
base::FilePath root = GetDirectoryForURL(dest_url, false, &error);
- if (error != base::PLATFORM_FILE_OK)
+ if (error != base::File::FILE_OK)
return error;
base::FilePath dest_local_path;
error = GenerateNewLocalPath(db, context, dest_url, &dest_local_path);
- if (error != base::PLATFORM_FILE_OK)
+ if (error != base::File::FILE_OK)
return error;
bool created = false;
@@ -1079,7 +1078,7 @@
if (base::PathExists(dest_local_path)) {
if (!base::DeleteFile(dest_local_path, true /* recursive */)) {
NOTREACHED();
- return base::PLATFORM_FILE_ERROR_FAILED;
+ return base::File::FILE_ERROR_FAILED;
}
LOG(WARNING) << "A stray file detected";
InvalidateUsageCache(context, dest_url.origin(), dest_url.type());
@@ -1094,7 +1093,7 @@
error = NativeFileUtil::EnsureFileExists(dest_local_path, &created);
}
}
- if (error != base::PLATFORM_FILE_OK)
+ if (error != base::File::FILE_OK)
return error;
if (!created) {
@@ -1105,7 +1104,7 @@
base::DeleteFile(dest_local_path, false /* recursive */);
*handle = base::kInvalidPlatformFileValue;
}
- return base::PLATFORM_FILE_ERROR_FAILED;
+ return base::File::FILE_ERROR_FAILED;
}
// This removes the root, including the trailing slash, leaving a relative
@@ -1115,7 +1114,7 @@
FileId file_id;
error = db->AddFileInfo(*dest_file_info, &file_id);
- if (error != base::PLATFORM_FILE_OK) {
+ if (error != base::File::FILE_OK) {
if (handle) {
DCHECK_NE(base::kInvalidPlatformFileValue, *handle);
base::ClosePlatformFile(*handle);
@@ -1126,14 +1125,14 @@
}
TouchDirectory(db, dest_file_info->parent_id);
- return base::PLATFORM_FILE_OK;
+ return base::File::FILE_OK;
}
base::FilePath ObfuscatedFileUtil::DataPathToLocalPath(
const FileSystemURL& url, const base::FilePath& data_path) {
- PlatformFileError error = base::PLATFORM_FILE_OK;
+ base::File::Error error = base::File::FILE_OK;
base::FilePath root = GetDirectoryForURL(url, false, &error);
- if (error != base::PLATFORM_FILE_OK)
+ if (error != base::File::FILE_OK)
return base::FilePath();
return root.Append(data_path);
}
@@ -1166,9 +1165,9 @@
return iter->second;
}
- PlatformFileError error = base::PLATFORM_FILE_OK;
+ base::File::Error error = base::File::FILE_OK;
base::FilePath path = GetDirectoryForURL(url, create, &error);
- if (error != base::PLATFORM_FILE_OK) {
+ if (error != base::File::FILE_OK) {
LOG(WARNING) << "Failed to get origin+type directory: "
<< url.DebugString() << " error:" << error;
return NULL;
@@ -1180,12 +1179,12 @@
}
base::FilePath ObfuscatedFileUtil::GetDirectoryForOrigin(
- const GURL& origin, bool create, base::PlatformFileError* error_code) {
+ const GURL& origin, bool create, base::File::Error* error_code) {
if (!InitOriginDatabase(origin, create)) {
if (error_code) {
*error_code = create ?
- base::PLATFORM_FILE_ERROR_FAILED :
- base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ base::File::FILE_ERROR_FAILED :
+ base::File::FILE_ERROR_NOT_FOUND;
}
return base::FilePath();
}
@@ -1195,12 +1194,12 @@
bool exists_in_db = origin_database_->HasOriginPath(id);
if (!exists_in_db && !create) {
if (error_code)
- *error_code = base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ *error_code = base::File::FILE_ERROR_NOT_FOUND;
return base::FilePath();
}
if (!origin_database_->GetPathForOrigin(id, &directory_name)) {
if (error_code)
- *error_code = base::PLATFORM_FILE_ERROR_FAILED;
+ *error_code = base::File::FILE_ERROR_FAILED;
return base::FilePath();
}
@@ -1209,7 +1208,7 @@
if (!exists_in_db && exists_in_fs) {
if (!base::DeleteFile(path, true)) {
if (error_code)
- *error_code = base::PLATFORM_FILE_ERROR_FAILED;
+ *error_code = base::File::FILE_ERROR_FAILED;
return base::FilePath();
}
exists_in_fs = false;
@@ -1219,14 +1218,14 @@
if (!create || !base::CreateDirectory(path)) {
if (error_code)
*error_code = create ?
- base::PLATFORM_FILE_ERROR_FAILED :
- base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ base::File::FILE_ERROR_FAILED :
+ base::File::FILE_ERROR_NOT_FOUND;
return base::FilePath();
}
}
if (error_code)
- *error_code = base::PLATFORM_FILE_OK;
+ *error_code = base::File::FILE_OK;
return path;
}
@@ -1301,7 +1300,7 @@
return true;
}
-PlatformFileError ObfuscatedFileUtil::GenerateNewLocalPath(
+base::File::Error ObfuscatedFileUtil::GenerateNewLocalPath(
SandboxDirectoryDatabase* db,
FileSystemOperationContext* context,
const FileSystemURL& url,
@@ -1309,12 +1308,12 @@
DCHECK(local_path);
int64 number;
if (!db || !db->GetNextInteger(&number))
- return base::PLATFORM_FILE_ERROR_FAILED;
+ return base::File::FILE_ERROR_FAILED;
- PlatformFileError error = base::PLATFORM_FILE_OK;
+ base::File::Error error = base::File::FILE_OK;
base::FilePath new_local_path = GetDirectoryForURL(url, false, &error);
- if (error != base::PLATFORM_FILE_OK)
- return base::PLATFORM_FILE_ERROR_FAILED;
+ if (error != base::File::FILE_OK)
+ return base::File::FILE_ERROR_FAILED;
// We use the third- and fourth-to-last digits as the directory.
int64 directory_number = number % 10000 / 100;
@@ -1323,15 +1322,15 @@
error = NativeFileUtil::CreateDirectory(
new_local_path, false /* exclusive */, false /* recursive */);
- if (error != base::PLATFORM_FILE_OK)
+ if (error != base::File::FILE_OK)
return error;
*local_path =
new_local_path.AppendASCII(base::StringPrintf("%08" PRId64, number));
- return base::PLATFORM_FILE_OK;
+ return base::File::FILE_OK;
}
-PlatformFileError ObfuscatedFileUtil::CreateOrOpenInternal(
+base::File::Error ObfuscatedFileUtil::CreateOrOpenInternal(
FileSystemOperationContext* context,
const FileSystemURL& url, int file_flags,
PlatformFile* file_handle, bool* created) {
@@ -1340,28 +1339,28 @@
base::PLATFORM_FILE_EXCLUSIVE_WRITE)));
SandboxDirectoryDatabase* db = GetDirectoryDatabase(url, true);
if (!db)
- return base::PLATFORM_FILE_ERROR_FAILED;
+ return base::File::FILE_ERROR_FAILED;
FileId file_id;
if (!db->GetFileWithPath(url.path(), &file_id)) {
// The file doesn't exist.
if (!(file_flags & (base::PLATFORM_FILE_CREATE |
base::PLATFORM_FILE_CREATE_ALWAYS | base::PLATFORM_FILE_OPEN_ALWAYS)))
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ return base::File::FILE_ERROR_NOT_FOUND;
FileId parent_id;
if (!db->GetFileWithPath(VirtualPath::DirName(url.path()),
&parent_id))
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ return base::File::FILE_ERROR_NOT_FOUND;
FileInfo file_info;
InitFileInfo(&file_info, parent_id,
VirtualPath::BaseName(url.path()).value());
int64 growth = UsageForPath(file_info.name.size());
if (!AllocateQuota(context, growth))
- return base::PLATFORM_FILE_ERROR_NO_SPACE;
- PlatformFileError error = CreateFile(
+ return base::File::FILE_ERROR_NO_SPACE;
+ base::File::Error error = CreateFile(
context, base::FilePath(),
url, &file_info, file_flags, file_handle);
- if (created && base::PLATFORM_FILE_OK == error) {
+ if (created && base::File::FILE_OK == error) {
*created = true;
UpdateUsage(context, url, growth);
context->change_observers()->Notify(
@@ -1371,17 +1370,17 @@
}
if (file_flags & base::PLATFORM_FILE_CREATE)
- return base::PLATFORM_FILE_ERROR_EXISTS;
+ return base::File::FILE_ERROR_EXISTS;
- base::PlatformFileInfo platform_file_info;
+ base::File::Info platform_file_info;
base::FilePath local_path;
FileInfo file_info;
- base::PlatformFileError error = GetFileInfoInternal(
+ base::File::Error error = GetFileInfoInternal(
db, context, url, file_id, &file_info, &platform_file_info, &local_path);
- if (error != base::PLATFORM_FILE_OK)
+ if (error != base::File::FILE_OK)
return error;
if (file_info.is_directory())
- return base::PLATFORM_FILE_ERROR_NOT_A_FILE;
+ return base::File::FILE_ERROR_NOT_A_FILE;
int64 delta = 0;
if (file_flags & (base::PLATFORM_FILE_CREATE_ALWAYS |
@@ -1393,16 +1392,16 @@
error = NativeFileUtil::CreateOrOpen(
local_path, file_flags, file_handle, created);
- if (error == base::PLATFORM_FILE_ERROR_NOT_FOUND) {
+ if (error == base::File::FILE_ERROR_NOT_FOUND) {
// TODO(tzik): Also invalidate on-memory usage cache in UsageTracker.
// TODO(tzik): Delete database entry after ensuring the file lost.
InvalidateUsageCache(context, url.origin(), url.type());
LOG(WARNING) << "Lost a backing file.";
- error = base::PLATFORM_FILE_ERROR_FAILED;
+ error = base::File::FILE_ERROR_FAILED;
}
// If truncating we need to update the usage.
- if (error == base::PLATFORM_FILE_OK && delta) {
+ if (error == base::File::FILE_OK && delta) {
UpdateUsage(context, url, delta);
context->change_observers()->Notify(
&FileChangeObserver::OnModifyFile, MakeTuple(url));
diff --git a/webkit/browser/fileapi/obfuscated_file_util.h b/webkit/browser/fileapi/obfuscated_file_util.h
index 7b14779..ed1f2bc 100644
--- a/webkit/browser/fileapi/obfuscated_file_util.h
+++ b/webkit/browser/fileapi/obfuscated_file_util.h
@@ -11,6 +11,7 @@
#include <vector>
#include "base/callback_forward.h"
+#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/files/file_util_proxy.h"
#include "base/gtest_prod_util.h"
@@ -110,65 +111,65 @@
virtual ~ObfuscatedFileUtil();
// FileSystemFileUtil overrides.
- virtual base::PlatformFileError CreateOrOpen(
+ virtual base::File::Error CreateOrOpen(
FileSystemOperationContext* context,
const FileSystemURL& url,
int file_flags,
base::PlatformFile* file_handle,
bool* created) OVERRIDE;
- virtual base::PlatformFileError Close(
+ virtual base::File::Error Close(
FileSystemOperationContext* context,
base::PlatformFile file) OVERRIDE;
- virtual base::PlatformFileError EnsureFileExists(
+ virtual base::File::Error EnsureFileExists(
FileSystemOperationContext* context,
const FileSystemURL& url, bool* created) OVERRIDE;
- virtual base::PlatformFileError CreateDirectory(
+ virtual base::File::Error CreateDirectory(
FileSystemOperationContext* context,
const FileSystemURL& url,
bool exclusive,
bool recursive) OVERRIDE;
- virtual base::PlatformFileError GetFileInfo(
+ virtual base::File::Error GetFileInfo(
FileSystemOperationContext* context,
const FileSystemURL& url,
- base::PlatformFileInfo* file_info,
+ base::File::Info* file_info,
base::FilePath* platform_file) OVERRIDE;
virtual scoped_ptr<AbstractFileEnumerator> CreateFileEnumerator(
FileSystemOperationContext* context,
const FileSystemURL& root_url) OVERRIDE;
- virtual base::PlatformFileError GetLocalFilePath(
+ virtual base::File::Error GetLocalFilePath(
FileSystemOperationContext* context,
const FileSystemURL& file_system_url,
base::FilePath* local_path) OVERRIDE;
- virtual base::PlatformFileError Touch(
+ virtual base::File::Error Touch(
FileSystemOperationContext* context,
const FileSystemURL& url,
const base::Time& last_access_time,
const base::Time& last_modified_time) OVERRIDE;
- virtual base::PlatformFileError Truncate(
+ virtual base::File::Error Truncate(
FileSystemOperationContext* context,
const FileSystemURL& url,
int64 length) OVERRIDE;
- virtual base::PlatformFileError CopyOrMoveFile(
+ virtual base::File::Error CopyOrMoveFile(
FileSystemOperationContext* context,
const FileSystemURL& src_url,
const FileSystemURL& dest_url,
CopyOrMoveOption option,
bool copy) OVERRIDE;
- virtual base::PlatformFileError CopyInForeignFile(
+ virtual base::File::Error CopyInForeignFile(
FileSystemOperationContext* context,
const base::FilePath& src_file_path,
const FileSystemURL& dest_url) OVERRIDE;
- virtual base::PlatformFileError DeleteFile(
+ virtual base::File::Error DeleteFile(
FileSystemOperationContext* context,
const FileSystemURL& url) OVERRIDE;
- virtual base::PlatformFileError DeleteDirectory(
+ virtual base::File::Error DeleteDirectory(
FileSystemOperationContext* context,
const FileSystemURL& url) OVERRIDE;
virtual webkit_blob::ScopedFile CreateSnapshotFile(
FileSystemOperationContext* context,
const FileSystemURL& url,
- base::PlatformFileError* error,
- base::PlatformFileInfo* file_info,
+ base::File::Error* error,
+ base::File::Info* file_info,
base::FilePath* platform_path) OVERRIDE;
// Same as the other CreateFileEnumerator, but with recursive support.
@@ -195,7 +196,7 @@
const GURL& origin,
const std::string& type_string,
bool create,
- base::PlatformFileError* error_code);
+ base::File::Error* error_code);
// Deletes the topmost directory specific to this origin and type. This will
// delete its directory database.
@@ -247,18 +248,18 @@
base::FilePath GetDirectoryForURL(
const FileSystemURL& url,
bool create,
- base::PlatformFileError* error_code);
+ base::File::Error* error_code);
// This just calls get_type_string_for_url_ callback that is given in ctor.
std::string CallGetTypeStringForURL(const FileSystemURL& url);
- base::PlatformFileError GetFileInfoInternal(
+ base::File::Error GetFileInfoInternal(
SandboxDirectoryDatabase* db,
FileSystemOperationContext* context,
const FileSystemURL& url,
FileId file_id,
FileInfo* local_info,
- base::PlatformFileInfo* file_info,
+ base::File::Info* file_info,
base::FilePath* platform_file_path);
// Creates a new file, both the underlying backing file and the entry in the
@@ -272,7 +273,7 @@
// Caveat: do not supply handle if you're also supplying a data path. It was
// easier not to support this, and no code has needed it so far, so it will
// DCHECK and handle will hold base::kInvalidPlatformFileValue.
- base::PlatformFileError CreateFile(
+ base::File::Error CreateFile(
FileSystemOperationContext* context,
const base::FilePath& source_file_path,
const FileSystemURL& dest_url,
@@ -300,7 +301,7 @@
// contain both the filesystem type subdirectories.
base::FilePath GetDirectoryForOrigin(const GURL& origin,
bool create,
- base::PlatformFileError* error_code);
+ base::File::Error* error_code);
void InvalidateUsageCache(FileSystemOperationContext* context,
const GURL& origin,
@@ -313,13 +314,13 @@
// for initializing database if it's not empty.
bool InitOriginDatabase(const GURL& origin_hint, bool create);
- base::PlatformFileError GenerateNewLocalPath(
+ base::File::Error GenerateNewLocalPath(
SandboxDirectoryDatabase* db,
FileSystemOperationContext* context,
const FileSystemURL& url,
base::FilePath* local_path);
- base::PlatformFileError CreateOrOpenInternal(
+ base::File::Error CreateOrOpenInternal(
FileSystemOperationContext* context,
const FileSystemURL& url,
int file_flags,
diff --git a/webkit/browser/fileapi/plugin_private_file_system_backend.cc b/webkit/browser/fileapi/plugin_private_file_system_backend.cc
index b4a3f8b..2ea302f 100644
--- a/webkit/browser/fileapi/plugin_private_file_system_backend.cc
+++ b/webkit/browser/fileapi/plugin_private_file_system_backend.cc
@@ -66,18 +66,18 @@
const base::FilePath::CharType* kPluginPrivateDirectory =
FILE_PATH_LITERAL("Plugins");
-base::PlatformFileError OpenFileSystemOnFileTaskRunner(
+base::File::Error OpenFileSystemOnFileTaskRunner(
ObfuscatedFileUtil* file_util,
PluginPrivateFileSystemBackend::FileSystemIDToPluginMap* plugin_map,
const GURL& origin_url,
const std::string& filesystem_id,
const std::string& plugin_id,
OpenFileSystemMode mode) {
- base::PlatformFileError error = base::PLATFORM_FILE_ERROR_FAILED;
+ base::File::Error error = base::File::FILE_ERROR_FAILED;
const bool create = (mode == OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT);
file_util->GetDirectoryForOriginAndType(
origin_url, plugin_id, create, &error);
- if (error == base::PLATFORM_FILE_OK)
+ if (error == base::File::FILE_OK)
plugin_map->RegisterFileSystem(filesystem_id, plugin_id);
return error;
}
@@ -123,7 +123,7 @@
const StatusCallback& callback) {
if (!CanHandleType(type) || file_system_options_.is_incognito()) {
base::MessageLoopProxy::current()->PostTask(
- FROM_HERE, base::Bind(callback, base::PLATFORM_FILE_ERROR_SECURITY));
+ FROM_HERE, base::Bind(callback, base::File::FILE_ERROR_SECURITY));
return;
}
@@ -153,7 +153,7 @@
base::MessageLoopProxy::current()->PostTask(
FROM_HERE,
base::Bind(callback, GURL(), std::string(),
- base::PLATFORM_FILE_ERROR_SECURITY));
+ base::File::FILE_ERROR_SECURITY));
}
AsyncFileUtil*
@@ -164,16 +164,16 @@
CopyOrMoveFileValidatorFactory*
PluginPrivateFileSystemBackend::GetCopyOrMoveFileValidatorFactory(
FileSystemType type,
- base::PlatformFileError* error_code) {
+ base::File::Error* error_code) {
DCHECK(error_code);
- *error_code = base::PLATFORM_FILE_OK;
+ *error_code = base::File::FILE_OK;
return NULL;
}
FileSystemOperation* PluginPrivateFileSystemBackend::CreateFileSystemOperation(
const FileSystemURL& url,
FileSystemContext* context,
- base::PlatformFileError* error_code) const {
+ base::File::Error* error_code) const {
scoped_ptr<FileSystemOperationContext> operation_context(
new FileSystemOperationContext(context));
return FileSystemOperation::Create(url, context, operation_context.Pass());
@@ -200,19 +200,19 @@
return this;
}
-base::PlatformFileError
+base::File::Error
PluginPrivateFileSystemBackend::DeleteOriginDataOnFileTaskRunner(
FileSystemContext* context,
quota::QuotaManagerProxy* proxy,
const GURL& origin_url,
FileSystemType type) {
if (!CanHandleType(type))
- return base::PLATFORM_FILE_ERROR_SECURITY;
+ return base::File::FILE_ERROR_SECURITY;
bool result = obfuscated_file_util()->DeleteDirectoryForOriginAndType(
origin_url, std::string());
if (result)
- return base::PLATFORM_FILE_OK;
- return base::PLATFORM_FILE_ERROR_FAILED;
+ return base::File::FILE_OK;
+ return base::File::FILE_ERROR_FAILED;
}
void PluginPrivateFileSystemBackend::GetOriginsForTypeOnFileTaskRunner(
diff --git a/webkit/browser/fileapi/plugin_private_file_system_backend.h b/webkit/browser/fileapi/plugin_private_file_system_backend.h
index 8e3f356..0d349883 100644
--- a/webkit/browser/fileapi/plugin_private_file_system_backend.h
+++ b/webkit/browser/fileapi/plugin_private_file_system_backend.h
@@ -35,7 +35,7 @@
public FileSystemQuotaUtil {
public:
class FileSystemIDToPluginMap;
- typedef base::Callback<void(base::PlatformFileError result)> StatusCallback;
+ typedef base::Callback<void(base::File::Error result)> StatusCallback;
PluginPrivateFileSystemBackend(
base::SequencedTaskRunner* file_task_runner,
@@ -69,11 +69,11 @@
virtual AsyncFileUtil* GetAsyncFileUtil(FileSystemType type) OVERRIDE;
virtual CopyOrMoveFileValidatorFactory* GetCopyOrMoveFileValidatorFactory(
FileSystemType type,
- base::PlatformFileError* error_code) OVERRIDE;
+ base::File::Error* error_code) OVERRIDE;
virtual FileSystemOperation* CreateFileSystemOperation(
const FileSystemURL& url,
FileSystemContext* context,
- base::PlatformFileError* error_code) const OVERRIDE;
+ base::File::Error* error_code) const OVERRIDE;
virtual scoped_ptr<webkit_blob::FileStreamReader> CreateFileStreamReader(
const FileSystemURL& url,
int64 offset,
@@ -86,7 +86,7 @@
virtual FileSystemQuotaUtil* GetQuotaUtil() OVERRIDE;
// FileSystemQuotaUtil overrides.
- virtual base::PlatformFileError DeleteOriginDataOnFileTaskRunner(
+ virtual base::File::Error DeleteOriginDataOnFileTaskRunner(
FileSystemContext* context,
quota::QuotaManagerProxy* proxy,
const GURL& origin_url,
diff --git a/webkit/browser/fileapi/quota/quota_backend_impl.cc b/webkit/browser/fileapi/quota/quota_backend_impl.cc
index 05e199b..62cd5a86 100644
--- a/webkit/browser/fileapi/quota/quota_backend_impl.cc
+++ b/webkit/browser/fileapi/quota/quota_backend_impl.cc
@@ -39,7 +39,7 @@
DCHECK(file_task_runner_->RunsTasksOnCurrentThread());
DCHECK(origin.is_valid());
if (!delta) {
- callback.Run(base::PLATFORM_FILE_OK);
+ callback.Run(base::File::FILE_OK);
return;
}
DCHECK(quota_manager_proxy_);
@@ -70,7 +70,7 @@
return;
ReserveQuotaInternal(QuotaReservationInfo(origin, type, delta));
base::FilePath path;
- if (GetUsageCachePath(origin, type, &path) != base::PLATFORM_FILE_OK)
+ if (GetUsageCachePath(origin, type, &path) != base::File::FILE_OK)
return;
bool result = file_system_usage_cache_->AtomicUpdateUsageByDelta(path, delta);
DCHECK(result);
@@ -81,7 +81,7 @@
DCHECK(file_task_runner_->RunsTasksOnCurrentThread());
DCHECK(origin.is_valid());
base::FilePath path;
- if (GetUsageCachePath(origin, type, &path) != base::PLATFORM_FILE_OK)
+ if (GetUsageCachePath(origin, type, &path) != base::File::FILE_OK)
return;
DCHECK(file_system_usage_cache_);
file_system_usage_cache_->IncrementDirty(path);
@@ -92,7 +92,7 @@
DCHECK(file_task_runner_->RunsTasksOnCurrentThread());
DCHECK(origin.is_valid());
base::FilePath path;
- if (GetUsageCachePath(origin, type, &path) != base::PLATFORM_FILE_OK)
+ if (GetUsageCachePath(origin, type, &path) != base::File::FILE_OK)
return;
DCHECK(file_system_usage_cache_);
file_system_usage_cache_->DecrementDirty(path);
@@ -105,17 +105,17 @@
DCHECK(file_task_runner_->RunsTasksOnCurrentThread());
DCHECK(info.origin.is_valid());
if (status != quota::kQuotaStatusOk) {
- callback.Run(base::PLATFORM_FILE_ERROR_FAILED);
+ callback.Run(base::File::FILE_ERROR_FAILED);
return;
}
if (quota < usage + info.delta) {
- callback.Run(base::PLATFORM_FILE_ERROR_NO_SPACE);
+ callback.Run(base::File::FILE_ERROR_NO_SPACE);
return;
}
ReserveQuotaInternal(info);
- if (callback.Run(base::PLATFORM_FILE_OK))
+ if (callback.Run(base::File::FILE_OK))
return;
// The requester could not accept the reserved quota. Revert it.
ReserveQuotaInternal(
@@ -131,14 +131,14 @@
FileSystemTypeToQuotaStorageType(info.type), info.delta);
}
-base::PlatformFileError QuotaBackendImpl::GetUsageCachePath(
+base::File::Error QuotaBackendImpl::GetUsageCachePath(
const GURL& origin,
FileSystemType type,
base::FilePath* usage_file_path) {
DCHECK(file_task_runner_->RunsTasksOnCurrentThread());
DCHECK(origin.is_valid());
DCHECK(usage_file_path);
- base::PlatformFileError error = base::PLATFORM_FILE_OK;
+ base::File::Error error = base::File::FILE_OK;
*usage_file_path =
SandboxFileSystemBackendDelegate::GetUsageCachePathForOriginAndType(
obfuscated_file_util_, origin, type, &error);
diff --git a/webkit/browser/fileapi/quota/quota_backend_impl.h b/webkit/browser/fileapi/quota/quota_backend_impl.h
index 10c38e7..787f5389 100644
--- a/webkit/browser/fileapi/quota/quota_backend_impl.h
+++ b/webkit/browser/fileapi/quota/quota_backend_impl.h
@@ -80,7 +80,7 @@
void ReserveQuotaInternal(
const QuotaReservationInfo& info);
- base::PlatformFileError GetUsageCachePath(
+ base::File::Error GetUsageCachePath(
const GURL& origin,
FileSystemType type,
base::FilePath* usage_file_path);
diff --git a/webkit/browser/fileapi/quota/quota_backend_impl_unittest.cc b/webkit/browser/fileapi/quota/quota_backend_impl_unittest.cc
index edc554c5..35deca0a 100644
--- a/webkit/browser/fileapi/quota/quota_backend_impl_unittest.cc
+++ b/webkit/browser/fileapi/quota/quota_backend_impl_unittest.cc
@@ -20,8 +20,8 @@
const char kOrigin[] = "http://example.com";
bool DidReserveQuota(bool accepted,
- base::PlatformFileError* error_out,
- base::PlatformFileError error) {
+ base::File::Error* error_out,
+ base::File::Error error) {
DCHECK(error_out);
*error_out = error;
return accepted;
@@ -108,10 +108,10 @@
std::string type_string =
SandboxFileSystemBackendDelegate::GetTypeString(type);
- base::PlatformFileError error = base::PLATFORM_FILE_ERROR_FAILED;
+ base::File::Error error = base::File::FILE_ERROR_FAILED;
base::FilePath path = file_util_->GetDirectoryForOriginAndType(
origin, type_string, true /* create */, &error);
- ASSERT_EQ(base::PLATFORM_FILE_OK, error);
+ ASSERT_EQ(base::File::FILE_OK, error);
ASSERT_TRUE(file_system_usage_cache_.UpdateUsage(
GetUsageCachePath(origin, type), 0));
@@ -123,9 +123,9 @@
base::FilePath GetUsageCachePath(const GURL& origin, FileSystemType type) {
base::FilePath path;
- base::PlatformFileError error =
+ base::File::Error error =
backend_->GetUsageCachePath(origin, type, &path);
- EXPECT_EQ(base::PLATFORM_FILE_OK, error);
+ EXPECT_EQ(base::File::FILE_OK, error);
EXPECT_FALSE(path.empty());
return path;
}
@@ -147,17 +147,17 @@
quota_manager_proxy_->set_quota(10000);
const int64 kDelta1 = 1000;
- base::PlatformFileError error = base::PLATFORM_FILE_ERROR_FAILED;
+ base::File::Error error = base::File::FILE_ERROR_FAILED;
backend_->ReserveQuota(GURL(kOrigin), type, kDelta1,
base::Bind(&DidReserveQuota, true, &error));
- EXPECT_EQ(base::PLATFORM_FILE_OK, error);
+ EXPECT_EQ(base::File::FILE_OK, error);
EXPECT_EQ(kDelta1, quota_manager_proxy_->usage());
const int64 kDelta2 = -300;
- error = base::PLATFORM_FILE_ERROR_FAILED;
+ error = base::File::FILE_ERROR_FAILED;
backend_->ReserveQuota(GURL(kOrigin), type, kDelta2,
base::Bind(&DidReserveQuota, true, &error));
- EXPECT_EQ(base::PLATFORM_FILE_OK, error);
+ EXPECT_EQ(base::File::FILE_OK, error);
EXPECT_EQ(kDelta1 + kDelta2, quota_manager_proxy_->usage());
EXPECT_EQ(2, quota_manager_proxy_->storage_modified_count());
@@ -169,10 +169,10 @@
quota_manager_proxy_->set_quota(100);
const int64 kDelta = 1000;
- base::PlatformFileError error = base::PLATFORM_FILE_ERROR_FAILED;
+ base::File::Error error = base::File::FILE_ERROR_FAILED;
backend_->ReserveQuota(GURL(kOrigin), type, kDelta,
base::Bind(&DidReserveQuota, true, &error));
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NO_SPACE, error);
+ EXPECT_EQ(base::File::FILE_ERROR_NO_SPACE, error);
EXPECT_EQ(0, quota_manager_proxy_->usage());
EXPECT_EQ(0, quota_manager_proxy_->storage_modified_count());
@@ -184,10 +184,10 @@
quota_manager_proxy_->set_quota(10000);
const int64 kDelta = 1000;
- base::PlatformFileError error = base::PLATFORM_FILE_ERROR_FAILED;
+ base::File::Error error = base::File::FILE_ERROR_FAILED;
backend_->ReserveQuota(GURL(kOrigin), type, kDelta,
base::Bind(&DidReserveQuota, false, &error));
- EXPECT_EQ(base::PLATFORM_FILE_OK, error);
+ EXPECT_EQ(base::File::FILE_OK, error);
EXPECT_EQ(0, quota_manager_proxy_->usage());
EXPECT_EQ(2, quota_manager_proxy_->storage_modified_count());
diff --git a/webkit/browser/fileapi/quota/quota_reservation.cc b/webkit/browser/fileapi/quota/quota_reservation.cc
index da4ef95..af74174 100644
--- a/webkit/browser/fileapi/quota/quota_reservation.cc
+++ b/webkit/browser/fileapi/quota/quota_reservation.cc
@@ -95,7 +95,7 @@
const base::WeakPtr<QuotaReservation>& reservation,
int64 new_reserved_size,
const StatusCallback& callback,
- base::PlatformFileError error) {
+ base::File::Error error) {
if (!reservation)
return false;
@@ -106,17 +106,17 @@
bool QuotaReservation::DidUpdateReservedQuota(
int64 new_reserved_size,
const StatusCallback& callback,
- base::PlatformFileError error) {
+ base::File::Error error) {
DCHECK(sequence_checker_.CalledOnValidSequencedThread());
DCHECK(running_refresh_request_);
running_refresh_request_ = false;
if (client_crashed_) {
- callback.Run(base::PLATFORM_FILE_ERROR_ABORT);
+ callback.Run(base::File::FILE_ERROR_ABORT);
return false;
}
- if (error == base::PLATFORM_FILE_OK)
+ if (error == base::File::FILE_OK)
remaining_quota_ = new_reserved_size;
callback.Run(error);
return true;
diff --git a/webkit/browser/fileapi/quota/quota_reservation.h b/webkit/browser/fileapi/quota/quota_reservation.h
index 18fbcb4..dad3b30de 100644
--- a/webkit/browser/fileapi/quota/quota_reservation.h
+++ b/webkit/browser/fileapi/quota/quota_reservation.h
@@ -6,6 +6,7 @@
#define WEBKIT_BROWSER_FILEAPI_QUOTA_QUOTA_RESERVATION_H_
#include "base/basictypes.h"
+#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
@@ -24,7 +25,7 @@
class WEBKIT_STORAGE_BROWSER_EXPORT QuotaReservation
: public base::RefCounted<QuotaReservation> {
public:
- typedef base::Callback<void(base::PlatformFileError error)> StatusCallback;
+ typedef base::Callback<void(base::File::Error error)> StatusCallback;
// Reclaims unused quota and reserves another |size| of quota. So that the
// resulting new |remaining_quota| will be same as |size|.
@@ -68,10 +69,10 @@
const base::WeakPtr<QuotaReservation>& reservation,
int64 new_reserved_size,
const StatusCallback& callback,
- base::PlatformFileError error);
+ base::File::Error error);
bool DidUpdateReservedQuota(int64 new_reserved_size,
const StatusCallback& callback,
- base::PlatformFileError error);
+ base::File::Error error);
bool client_crashed_;
bool running_refresh_request_;
diff --git a/webkit/browser/fileapi/quota/quota_reservation_buffer.cc b/webkit/browser/fileapi/quota/quota_reservation_buffer.cc
index 122674b..662c415 100644
--- a/webkit/browser/fileapi/quota/quota_reservation_buffer.cc
+++ b/webkit/browser/fileapi/quota/quota_reservation_buffer.cc
@@ -92,9 +92,9 @@
base::WeakPtr<QuotaReservationManager> reservation_manager,
const GURL& origin,
FileSystemType type,
- base::PlatformFileError error) {
+ base::File::Error error) {
DCHECK(origin.is_valid());
- if (error == base::PLATFORM_FILE_OK && reservation_manager) {
+ if (error == base::File::FILE_OK && reservation_manager) {
reservation_manager->DecrementDirtyCount(origin, type);
return true;
}
diff --git a/webkit/browser/fileapi/quota/quota_reservation_buffer.h b/webkit/browser/fileapi/quota/quota_reservation_buffer.h
index 9a11fa5f..cc6a435 100644
--- a/webkit/browser/fileapi/quota/quota_reservation_buffer.h
+++ b/webkit/browser/fileapi/quota/quota_reservation_buffer.h
@@ -8,10 +8,10 @@
#include <map>
#include "base/basictypes.h"
+#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
-#include "base/platform_file.h"
#include "url/gurl.h"
#include "webkit/browser/webkit_storage_browser_export.h"
#include "webkit/common/fileapi/file_system_types.h"
@@ -60,7 +60,7 @@
base::WeakPtr<QuotaReservationManager> reservation_manager,
const GURL& origin,
FileSystemType type,
- base::PlatformFileError error);
+ base::File::Error error);
typedef std::map<base::FilePath, OpenFileHandleContext*>
OpenFileHandleContextByPath;
diff --git a/webkit/browser/fileapi/quota/quota_reservation_manager.h b/webkit/browser/fileapi/quota/quota_reservation_manager.h
index 07beacc3..9b64a15 100644
--- a/webkit/browser/fileapi/quota/quota_reservation_manager.h
+++ b/webkit/browser/fileapi/quota/quota_reservation_manager.h
@@ -10,9 +10,9 @@
#include "base/basictypes.h"
#include "base/callback_forward.h"
+#include "base/files/file.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
-#include "base/platform_file.h"
#include "url/gurl.h"
#include "webkit/browser/webkit_storage_browser_export.h"
#include "webkit/common/fileapi/file_system_types.h"
@@ -28,7 +28,7 @@
public:
// Callback for ReserveQuota. When this callback returns false, ReserveQuota
// operation should be reverted.
- typedef base::Callback<bool(base::PlatformFileError error)>
+ typedef base::Callback<bool(base::File::Error error)>
ReserveQuotaCallback;
// An abstraction of backing quota system.
diff --git a/webkit/browser/fileapi/quota/quota_reservation_manager_unittest.cc b/webkit/browser/fileapi/quota/quota_reservation_manager_unittest.cc
index a406a7b..1ec2fb7 100644
--- a/webkit/browser/fileapi/quota/quota_reservation_manager_unittest.cc
+++ b/webkit/browser/fileapi/quota/quota_reservation_manager_unittest.cc
@@ -7,6 +7,7 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/file_util.h"
+#include "base/files/file.h"
#include "base/files/scoped_temp_dir.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
@@ -31,15 +32,9 @@
}
void SetFileSize(const base::FilePath& path, int64 size) {
- bool created = false;
- base::PlatformFileError error = base::PLATFORM_FILE_ERROR_FAILED;
- base::PlatformFile file = CreatePlatformFile(
- path,
- base::PLATFORM_FILE_OPEN_ALWAYS | base::PLATFORM_FILE_WRITE,
- &created, &error);
- ASSERT_EQ(base::PLATFORM_FILE_OK, error);
- ASSERT_TRUE(base::TruncatePlatformFile(file, size));
- ASSERT_TRUE(base::ClosePlatformFile(file));
+ base::File file(path, base::File::FLAG_OPEN_ALWAYS | base::File::FLAG_WRITE);
+ ASSERT_TRUE(file.IsValid());
+ ASSERT_TRUE(file.SetLength(size));
}
class FakeBackend : public QuotaReservationManager::QuotaBackend {
@@ -58,7 +53,7 @@
on_memory_usage_ += delta;
base::MessageLoopProxy::current()->PostTask(
FROM_HERE,
- base::Bind(base::IgnoreResult(callback), base::PLATFORM_FILE_OK));
+ base::Bind(base::IgnoreResult(callback), base::File::FILE_OK));
}
virtual void ReleaseReservedQuota(const GURL& origin,
@@ -160,10 +155,10 @@
bool dirty_;
};
-void ExpectSuccess(bool* done, base::PlatformFileError error) {
+void ExpectSuccess(bool* done, base::File::Error error) {
EXPECT_FALSE(*done);
*done = true;
- EXPECT_EQ(base::PLATFORM_FILE_OK, error);
+ EXPECT_EQ(base::File::FILE_OK, error);
}
void RefreshReservation(QuotaReservation* reservation, int64 size) {
diff --git a/webkit/browser/fileapi/recursive_operation_delegate.cc b/webkit/browser/fileapi/recursive_operation_delegate.cc
index 7adc596..9ad2a8c 100644
--- a/webkit/browser/fileapi/recursive_operation_delegate.cc
+++ b/webkit/browser/fileapi/recursive_operation_delegate.cc
@@ -54,13 +54,13 @@
void RecursiveOperationDelegate::DidTryProcessFile(
const FileSystemURL& root,
- base::PlatformFileError error) {
+ base::File::Error error) {
DCHECK(pending_directory_stack_.empty());
DCHECK(pending_files_.empty());
DCHECK_EQ(1, inflight_operations_);
--inflight_operations_;
- if (canceled_ || error != base::PLATFORM_FILE_ERROR_NOT_A_FILE) {
+ if (canceled_ || error != base::File::FILE_ERROR_NOT_A_FILE) {
Done(error);
return;
}
@@ -86,14 +86,14 @@
}
void RecursiveOperationDelegate::DidProcessDirectory(
- base::PlatformFileError error) {
+ base::File::Error error) {
DCHECK(pending_files_.empty());
DCHECK(!pending_directory_stack_.empty());
DCHECK(!pending_directory_stack_.top().empty());
DCHECK_EQ(1, inflight_operations_);
--inflight_operations_;
- if (canceled_ || error != base::PLATFORM_FILE_OK) {
+ if (canceled_ || error != base::File::FILE_OK) {
Done(error);
return;
}
@@ -108,14 +108,14 @@
void RecursiveOperationDelegate::DidReadDirectory(
const FileSystemURL& parent,
- base::PlatformFileError error,
+ base::File::Error error,
const FileEntryList& entries,
bool has_more) {
DCHECK(pending_files_.empty());
DCHECK(!pending_directory_stack_.empty());
DCHECK_EQ(0, inflight_operations_);
- if (canceled_ || error != base::PLATFORM_FILE_OK) {
+ if (canceled_ || error != base::File::FILE_OK) {
Done(error);
return;
}
@@ -167,9 +167,9 @@
}
void RecursiveOperationDelegate::DidProcessFile(
- base::PlatformFileError error) {
+ base::File::Error error) {
--inflight_operations_;
- if (error != base::PLATFORM_FILE_OK) {
+ if (error != base::File::FILE_OK) {
// If an error occurs, invoke Done immediately (even if there remain
// running operations). It is because in the callback, this instance is
// deleted.
@@ -186,7 +186,7 @@
DCHECK_EQ(0, inflight_operations_);
if (canceled_) {
- Done(base::PLATFORM_FILE_ERROR_ABORT);
+ Done(base::File::FILE_ERROR_ABORT);
return;
}
@@ -200,7 +200,7 @@
pending_directory_stack_.pop();
if (pending_directory_stack_.empty()) {
// All files/directories are processed.
- Done(base::PLATFORM_FILE_OK);
+ Done(base::File::FILE_OK);
return;
}
@@ -213,7 +213,7 @@
}
void RecursiveOperationDelegate::DidPostProcessDirectory(
- base::PlatformFileError error) {
+ base::File::Error error) {
DCHECK(pending_files_.empty());
DCHECK(!pending_directory_stack_.empty());
DCHECK(!pending_directory_stack_.top().empty());
@@ -221,7 +221,7 @@
--inflight_operations_;
pending_directory_stack_.top().pop();
- if (canceled_ || error != base::PLATFORM_FILE_OK) {
+ if (canceled_ || error != base::File::FILE_OK) {
Done(error);
return;
}
@@ -229,9 +229,9 @@
ProcessSubDirectory();
}
-void RecursiveOperationDelegate::Done(base::PlatformFileError error) {
- if (canceled_ && error == base::PLATFORM_FILE_OK) {
- callback_.Run(base::PLATFORM_FILE_ERROR_ABORT);
+void RecursiveOperationDelegate::Done(base::File::Error error) {
+ if (canceled_ && error == base::File::FILE_OK) {
+ callback_.Run(base::File::FILE_ERROR_ABORT);
} else {
callback_.Run(error);
}
diff --git a/webkit/browser/fileapi/recursive_operation_delegate.h b/webkit/browser/fileapi/recursive_operation_delegate.h
index 08e3050..56dad91 100644
--- a/webkit/browser/fileapi/recursive_operation_delegate.h
+++ b/webkit/browser/fileapi/recursive_operation_delegate.h
@@ -121,20 +121,20 @@
private:
void DidTryProcessFile(const FileSystemURL& root,
- base::PlatformFileError error);
+ base::File::Error error);
void ProcessNextDirectory();
- void DidProcessDirectory(base::PlatformFileError error);
+ void DidProcessDirectory(base::File::Error error);
void DidReadDirectory(const FileSystemURL& parent,
- base::PlatformFileError error,
+ base::File::Error error,
const FileEntryList& entries,
bool has_more);
void ProcessPendingFiles();
- void DidProcessFile(base::PlatformFileError error);
+ void DidProcessFile(base::File::Error error);
void ProcessSubDirectory();
- void DidPostProcessDirectory(base::PlatformFileError error);
+ void DidPostProcessDirectory(base::File::Error error);
// Called when all recursive operation is done (or an error occurs).
- void Done(base::PlatformFileError error);
+ void Done(base::File::Error error);
FileSystemContext* file_system_context_;
StatusCallback callback_;
diff --git a/webkit/browser/fileapi/remove_operation_delegate.cc b/webkit/browser/fileapi/remove_operation_delegate.cc
index 4819f01..6c7b2def 100644
--- a/webkit/browser/fileapi/remove_operation_delegate.cc
+++ b/webkit/browser/fileapi/remove_operation_delegate.cc
@@ -41,7 +41,7 @@
void RemoveOperationDelegate::ProcessDirectory(const FileSystemURL& url,
const StatusCallback& callback) {
- callback.Run(base::PLATFORM_FILE_OK);
+ callback.Run(base::File::FILE_OK);
}
void RemoveOperationDelegate::PostProcessDirectory(
@@ -49,10 +49,9 @@
operation_runner()->RemoveDirectory(url, callback);
}
-void RemoveOperationDelegate::DidTryRemoveFile(
- base::PlatformFileError error) {
- if (error != base::PLATFORM_FILE_ERROR_NOT_A_FILE &&
- error != base::PLATFORM_FILE_ERROR_SECURITY) {
+void RemoveOperationDelegate::DidTryRemoveFile(base::File::Error error) {
+ if (error != base::File::FILE_ERROR_NOT_A_FILE &&
+ error != base::File::FILE_ERROR_SECURITY) {
callback_.Run(error);
return;
}
@@ -63,18 +62,18 @@
}
void RemoveOperationDelegate::DidTryRemoveDirectory(
- base::PlatformFileError remove_file_error,
- base::PlatformFileError remove_directory_error) {
+ base::File::Error remove_file_error,
+ base::File::Error remove_directory_error) {
callback_.Run(
- remove_directory_error == base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY ?
+ remove_directory_error == base::File::FILE_ERROR_NOT_A_DIRECTORY ?
remove_file_error :
remove_directory_error);
}
void RemoveOperationDelegate::DidRemoveFile(const StatusCallback& callback,
- base::PlatformFileError error) {
- if (error == base::PLATFORM_FILE_ERROR_NOT_FOUND) {
- callback.Run(base::PLATFORM_FILE_OK);
+ base::File::Error error) {
+ if (error == base::File::FILE_ERROR_NOT_FOUND) {
+ callback.Run(base::File::FILE_OK);
return;
}
callback.Run(error);
diff --git a/webkit/browser/fileapi/remove_operation_delegate.h b/webkit/browser/fileapi/remove_operation_delegate.h
index 22d25cb..ee0252a7 100644
--- a/webkit/browser/fileapi/remove_operation_delegate.h
+++ b/webkit/browser/fileapi/remove_operation_delegate.h
@@ -29,11 +29,11 @@
const StatusCallback& callback) OVERRIDE;
private:
- void DidTryRemoveFile(base::PlatformFileError error);
- void DidTryRemoveDirectory(base::PlatformFileError remove_file_error,
- base::PlatformFileError remove_directory_error);
+ void DidTryRemoveFile(base::File::Error error);
+ void DidTryRemoveDirectory(base::File::Error remove_file_error,
+ base::File::Error remove_directory_error);
void DidRemoveFile(const StatusCallback& callback,
- base::PlatformFileError error);
+ base::File::Error error);
FileSystemURL url_;
StatusCallback callback_;
diff --git a/webkit/browser/fileapi/sandbox_directory_database.cc b/webkit/browser/fileapi/sandbox_directory_database.cc
index 1eb23b23..351b67c 100644
--- a/webkit/browser/fileapi/sandbox_directory_database.cc
+++ b/webkit/browser/fileapi/sandbox_directory_database.cc
@@ -518,10 +518,10 @@
return false;
}
-base::PlatformFileError SandboxDirectoryDatabase::AddFileInfo(
+base::File::Error SandboxDirectoryDatabase::AddFileInfo(
const FileInfo& info, FileId* file_id) {
if (!Init(REPAIR_ON_CORRUPTION))
- return base::PLATFORM_FILE_ERROR_FAILED;
+ return base::File::FILE_ERROR_FAILED;
DCHECK(file_id);
std::string child_key = GetChildLookupKey(info.parent_id, info.name);
std::string child_id_string;
@@ -529,16 +529,16 @@
db_->Get(leveldb::ReadOptions(), child_key, &child_id_string);
if (status.ok()) {
LOG(ERROR) << "File exists already!";
- return base::PLATFORM_FILE_ERROR_EXISTS;
+ return base::File::FILE_ERROR_EXISTS;
}
if (!status.IsNotFound()) {
HandleError(FROM_HERE, status);
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ return base::File::FILE_ERROR_NOT_FOUND;
}
if (!IsDirectory(info.parent_id)) {
LOG(ERROR) << "New parent directory is a file!";
- return base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY;
+ return base::File::FILE_ERROR_NOT_A_DIRECTORY;
}
// This would be a fine place to limit the number of files in a directory, if
@@ -546,21 +546,21 @@
FileId temp_id;
if (!GetLastFileId(&temp_id))
- return base::PLATFORM_FILE_ERROR_FAILED;
+ return base::File::FILE_ERROR_FAILED;
++temp_id;
leveldb::WriteBatch batch;
if (!AddFileInfoHelper(info, temp_id, &batch))
- return base::PLATFORM_FILE_ERROR_FAILED;
+ return base::File::FILE_ERROR_FAILED;
batch.Put(LastFileIdKey(), base::Int64ToString(temp_id));
status = db_->Write(leveldb::WriteOptions(), &batch);
if (!status.ok()) {
HandleError(FROM_HERE, status);
- return base::PLATFORM_FILE_ERROR_FAILED;
+ return base::File::FILE_ERROR_FAILED;
}
*file_id = temp_id;
- return base::PLATFORM_FILE_OK;
+ return base::File::FILE_OK;
}
bool SandboxDirectoryDatabase::RemoveFileInfo(FileId file_id) {
diff --git a/webkit/browser/fileapi/sandbox_directory_database.h b/webkit/browser/fileapi/sandbox_directory_database.h
index 67be432..a984cc4d 100644
--- a/webkit/browser/fileapi/sandbox_directory_database.h
+++ b/webkit/browser/fileapi/sandbox_directory_database.h
@@ -8,9 +8,9 @@
#include <string>
#include <vector>
+#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/memory/scoped_ptr.h"
-#include "base/platform_file.h"
#include "base/time/time.h"
#include "webkit/browser/webkit_storage_browser_export.h"
@@ -69,7 +69,7 @@
// exist.
bool ListChildren(FileId parent_id, std::vector<FileId>* children);
bool GetFileInfo(FileId file_id, FileInfo* info);
- base::PlatformFileError AddFileInfo(const FileInfo& info, FileId* file_id);
+ base::File::Error AddFileInfo(const FileInfo& info, FileId* file_id);
bool RemoveFileInfo(FileId file_id);
// This does a full update of the FileInfo, and is what you'd use for moves
// and renames. If you just want to update the modification_time, use
diff --git a/webkit/browser/fileapi/sandbox_directory_database_unittest.cc b/webkit/browser/fileapi/sandbox_directory_database_unittest.cc
index b43dc23..9b5e9ba 100644
--- a/webkit/browser/fileapi/sandbox_directory_database_unittest.cc
+++ b/webkit/browser/fileapi/sandbox_directory_database_unittest.cc
@@ -8,9 +8,9 @@
#include <limits>
#include "base/file_util.h"
+#include "base/files/file.h"
#include "base/files/scoped_temp_dir.h"
#include "base/memory/scoped_ptr.h"
-#include "base/platform_file.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -51,7 +51,7 @@
db_.reset();
}
- base::PlatformFileError AddFileInfo(
+ base::File::Error AddFileInfo(
FileId parent_id, const base::FilePath::StringType& name) {
FileId file_id;
FileInfo info;
@@ -66,7 +66,7 @@
FileInfo info;
info.parent_id = parent_id;
info.name = name;
- ASSERT_EQ(base::PLATFORM_FILE_OK, db_->AddFileInfo(info, file_id_out));
+ ASSERT_EQ(base::File::FILE_OK, db_->AddFileInfo(info, file_id_out));
}
void CreateFile(FileId parent_id,
@@ -79,21 +79,16 @@
info.parent_id = parent_id;
info.name = name;
info.data_path = base::FilePath(data_path).NormalizePathSeparators();
- ASSERT_EQ(base::PLATFORM_FILE_OK, db_->AddFileInfo(info, &file_id));
+ ASSERT_EQ(base::File::FILE_OK, db_->AddFileInfo(info, &file_id));
base::FilePath local_path = path().Append(data_path);
if (!base::DirectoryExists(local_path.DirName()))
ASSERT_TRUE(base::CreateDirectory(local_path.DirName()));
- bool created = false;
- base::PlatformFileError error = base::PLATFORM_FILE_ERROR_FAILED;
- base::PlatformFile file = base::CreatePlatformFile(
- local_path,
- base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_WRITE,
- &created, &error);
- ASSERT_EQ(base::PLATFORM_FILE_OK, error);
- ASSERT_TRUE(created);
- ASSERT_TRUE(base::ClosePlatformFile(file));
+ base::File file(local_path,
+ base::File::FLAG_CREATE | base::File::FLAG_WRITE);
+ ASSERT_TRUE(file.IsValid());
+ ASSERT_TRUE(file.created());
if (file_id_out)
*file_id_out = file_id;
@@ -162,7 +157,7 @@
TEST_F(SandboxDirectoryDatabaseTest, TestMissingParentAddFileInfo) {
FileId parent_id = 7;
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY,
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_A_DIRECTORY,
AddFileInfo(parent_id, FILE_PATH_LITERAL("foo")));
}
@@ -171,21 +166,21 @@
FileId file_id;
info.parent_id = 0;
info.name = FILE_PATH_LITERAL("dir 0");
- EXPECT_EQ(base::PLATFORM_FILE_OK, db()->AddFileInfo(info, &file_id));
+ EXPECT_EQ(base::File::FILE_OK, db()->AddFileInfo(info, &file_id));
// Check for name clash in the root directory.
base::FilePath::StringType name = info.name;
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_EXISTS, AddFileInfo(0, name));
+ EXPECT_EQ(base::File::FILE_ERROR_EXISTS, AddFileInfo(0, name));
name = FILE_PATH_LITERAL("dir 1");
- EXPECT_EQ(base::PLATFORM_FILE_OK, AddFileInfo(0, name));
+ EXPECT_EQ(base::File::FILE_OK, AddFileInfo(0, name));
name = FILE_PATH_LITERAL("subdir 0");
- EXPECT_EQ(base::PLATFORM_FILE_OK, AddFileInfo(file_id, name));
+ EXPECT_EQ(base::File::FILE_OK, AddFileInfo(file_id, name));
// Check for name clash in a subdirectory.
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_EXISTS, AddFileInfo(file_id, name));
+ EXPECT_EQ(base::File::FILE_ERROR_EXISTS, AddFileInfo(file_id, name));
name = FILE_PATH_LITERAL("subdir 1");
- EXPECT_EQ(base::PLATFORM_FILE_OK, AddFileInfo(file_id, name));
+ EXPECT_EQ(base::File::FILE_OK, AddFileInfo(file_id, name));
}
TEST_F(SandboxDirectoryDatabaseTest, TestRenameNoMoveNameClash) {
@@ -196,8 +191,8 @@
base::FilePath::StringType name2 = FILE_PATH_LITERAL("bas");
info.parent_id = 0;
info.name = name0;
- EXPECT_EQ(base::PLATFORM_FILE_OK, db()->AddFileInfo(info, &file_id0));
- EXPECT_EQ(base::PLATFORM_FILE_OK, AddFileInfo(0, name1));
+ EXPECT_EQ(base::File::FILE_OK, db()->AddFileInfo(info, &file_id0));
+ EXPECT_EQ(base::File::FILE_OK, AddFileInfo(0, name1));
info.name = name1;
EXPECT_FALSE(db()->UpdateFileInfo(file_id0, info));
info.name = name2;
@@ -212,9 +207,9 @@
base::FilePath::StringType name1 = FILE_PATH_LITERAL("bar");
info.parent_id = 0;
info.name = name0;
- EXPECT_EQ(base::PLATFORM_FILE_OK, db()->AddFileInfo(info, &file_id0));
+ EXPECT_EQ(base::File::FILE_OK, db()->AddFileInfo(info, &file_id0));
info.parent_id = file_id0;
- EXPECT_EQ(base::PLATFORM_FILE_OK, db()->AddFileInfo(info, &file_id1));
+ EXPECT_EQ(base::File::FILE_OK, db()->AddFileInfo(info, &file_id1));
info.parent_id = 0;
EXPECT_FALSE(db()->UpdateFileInfo(file_id1, info));
info.name = name1;
@@ -230,10 +225,10 @@
base::FilePath::StringType name2 = FILE_PATH_LITERAL("bas");
info.parent_id = 0;
info.name = name0;
- EXPECT_EQ(base::PLATFORM_FILE_OK, db()->AddFileInfo(info, &file_id0));
+ EXPECT_EQ(base::File::FILE_OK, db()->AddFileInfo(info, &file_id0));
info.parent_id = file_id0;
info.name = name1;
- EXPECT_EQ(base::PLATFORM_FILE_OK, db()->AddFileInfo(info, &file_id1));
+ EXPECT_EQ(base::File::FILE_OK, db()->AddFileInfo(info, &file_id1));
info.parent_id = 0;
info.name = name0;
EXPECT_FALSE(db()->UpdateFileInfo(file_id1, info));
@@ -251,9 +246,9 @@
FileId file_id1;
info.parent_id = 0;
info.name = FILE_PATH_LITERAL("foo");
- EXPECT_EQ(base::PLATFORM_FILE_OK, db()->AddFileInfo(info, &file_id0));
+ EXPECT_EQ(base::File::FILE_OK, db()->AddFileInfo(info, &file_id0));
info.parent_id = file_id0;
- EXPECT_EQ(base::PLATFORM_FILE_OK, db()->AddFileInfo(info, &file_id1));
+ EXPECT_EQ(base::File::FILE_OK, db()->AddFileInfo(info, &file_id1));
EXPECT_FALSE(db()->RemoveFileInfo(file_id0));
EXPECT_TRUE(db()->RemoveFileInfo(file_id1));
EXPECT_TRUE(db()->RemoveFileInfo(file_id0));
@@ -267,10 +262,10 @@
base::FilePath::StringType name1 = FILE_PATH_LITERAL("bar");
info.parent_id = 0;
info.name = name0;
- EXPECT_EQ(base::PLATFORM_FILE_OK, db()->AddFileInfo(info, &file_id0));
+ EXPECT_EQ(base::File::FILE_OK, db()->AddFileInfo(info, &file_id0));
info.parent_id = file_id0;
info.name = name1;
- EXPECT_EQ(base::PLATFORM_FILE_OK, db()->AddFileInfo(info, &file_id1));
+ EXPECT_EQ(base::File::FILE_OK, db()->AddFileInfo(info, &file_id1));
EXPECT_NE(file_id0, file_id1);
FileId check_file_id;
@@ -293,14 +288,14 @@
info.parent_id = 0;
info.name = name0;
- EXPECT_EQ(base::PLATFORM_FILE_OK, db()->AddFileInfo(info, &file_id0));
+ EXPECT_EQ(base::File::FILE_OK, db()->AddFileInfo(info, &file_id0));
info.parent_id = file_id0;
info.name = name1;
- EXPECT_EQ(base::PLATFORM_FILE_OK, db()->AddFileInfo(info, &file_id1));
+ EXPECT_EQ(base::File::FILE_OK, db()->AddFileInfo(info, &file_id1));
EXPECT_NE(file_id0, file_id1);
info.parent_id = file_id1;
info.name = name2;
- EXPECT_EQ(base::PLATFORM_FILE_OK, db()->AddFileInfo(info, &file_id2));
+ EXPECT_EQ(base::File::FILE_OK, db()->AddFileInfo(info, &file_id2));
EXPECT_NE(file_id0, file_id2);
EXPECT_NE(file_id1, file_id2);
@@ -329,7 +324,7 @@
FileInfo info;
info.parent_id = 0;
info.name = FILE_PATH_LITERAL("foo");
- EXPECT_EQ(base::PLATFORM_FILE_OK, db()->AddFileInfo(info, &file_id0));
+ EXPECT_EQ(base::File::FILE_OK, db()->AddFileInfo(info, &file_id0));
EXPECT_TRUE(db()->ListChildren(0, &children));
EXPECT_EQ(children.size(), 1UL);
EXPECT_EQ(children[0], file_id0);
@@ -337,7 +332,7 @@
// Two children in the root.
FileId file_id1;
info.name = FILE_PATH_LITERAL("bar");
- EXPECT_EQ(base::PLATFORM_FILE_OK, db()->AddFileInfo(info, &file_id1));
+ EXPECT_EQ(base::File::FILE_OK, db()->AddFileInfo(info, &file_id1));
EXPECT_TRUE(db()->ListChildren(0, &children));
EXPECT_EQ(2UL, children.size());
if (children[0] == file_id0) {
@@ -356,14 +351,14 @@
info.name = FILE_PATH_LITERAL("foo");
FileId file_id2;
FileId file_id3;
- EXPECT_EQ(base::PLATFORM_FILE_OK, db()->AddFileInfo(info, &file_id2));
+ EXPECT_EQ(base::File::FILE_OK, db()->AddFileInfo(info, &file_id2));
EXPECT_TRUE(db()->ListChildren(file_id0, &children));
EXPECT_EQ(1UL, children.size());
EXPECT_EQ(children[0], file_id2);
// Two children in a subdirectory.
info.name = FILE_PATH_LITERAL("bar");
- EXPECT_EQ(base::PLATFORM_FILE_OK, db()->AddFileInfo(info, &file_id3));
+ EXPECT_EQ(base::File::FILE_OK, db()->AddFileInfo(info, &file_id3));
EXPECT_TRUE(db()->ListChildren(file_id0, &children));
EXPECT_EQ(2UL, children.size());
if (children[0] == file_id2) {
@@ -381,7 +376,7 @@
info0.name = FILE_PATH_LITERAL("name");
info0.data_path = base::FilePath(FILE_PATH_LITERAL("fake path"));
info0.modification_time = base::Time::Now();
- EXPECT_EQ(base::PLATFORM_FILE_OK, db()->AddFileInfo(info0, &file_id));
+ EXPECT_EQ(base::File::FILE_OK, db()->AddFileInfo(info0, &file_id));
FileInfo info1;
EXPECT_TRUE(db()->GetFileInfo(file_id, &info1));
EXPECT_EQ(info0.name, info1.name);
@@ -412,7 +407,7 @@
info0.data_path = base::FilePath(FILE_PATH_LITERAL("foo"));
info0.name = FILE_PATH_LITERAL("file name");
info0.modification_time = base::Time::Now();
- EXPECT_EQ(base::PLATFORM_FILE_OK, db()->AddFileInfo(info0, &file_id));
+ EXPECT_EQ(base::File::FILE_OK, db()->AddFileInfo(info0, &file_id));
FileInfo info1;
EXPECT_TRUE(db()->GetFileInfo(file_id, &info1));
EXPECT_EQ(info0.parent_id, info1.parent_id);
@@ -429,7 +424,7 @@
info0.parent_id = 0;
info0.name = FILE_PATH_LITERAL("directory");
info0.modification_time = base::Time::Now();
- EXPECT_EQ(base::PLATFORM_FILE_OK, db()->AddFileInfo(info0, &directory_id));
+ EXPECT_EQ(base::File::FILE_OK, db()->AddFileInfo(info0, &directory_id));
FileId file_id;
FileInfo info1;
@@ -437,7 +432,7 @@
info1.data_path = base::FilePath(FILE_PATH_LITERAL("bar"));
info1.name = FILE_PATH_LITERAL("file");
info1.modification_time = base::Time::UnixEpoch();
- EXPECT_EQ(base::PLATFORM_FILE_OK, db()->AddFileInfo(info1, &file_id));
+ EXPECT_EQ(base::File::FILE_OK, db()->AddFileInfo(info1, &file_id));
EXPECT_FALSE(db()->OverwritingMoveFile(directory_id, file_id));
}
@@ -449,14 +444,14 @@
info0.name = FILE_PATH_LITERAL("file");
info0.data_path = base::FilePath(FILE_PATH_LITERAL("bar"));
info0.modification_time = base::Time::Now();
- EXPECT_EQ(base::PLATFORM_FILE_OK, db()->AddFileInfo(info0, &file_id));
+ EXPECT_EQ(base::File::FILE_OK, db()->AddFileInfo(info0, &file_id));
FileId directory_id;
FileInfo info1;
info1.parent_id = 0;
info1.name = FILE_PATH_LITERAL("directory");
info1.modification_time = base::Time::UnixEpoch();
- EXPECT_EQ(base::PLATFORM_FILE_OK, db()->AddFileInfo(info1, &directory_id));
+ EXPECT_EQ(base::File::FILE_OK, db()->AddFileInfo(info1, &directory_id));
EXPECT_FALSE(db()->OverwritingMoveFile(file_id, directory_id));
}
@@ -468,13 +463,13 @@
info0.data_path = base::FilePath(FILE_PATH_LITERAL("foo"));
info0.name = FILE_PATH_LITERAL("file name 0");
info0.modification_time = base::Time::Now();
- EXPECT_EQ(base::PLATFORM_FILE_OK, db()->AddFileInfo(info0, &file_id0));
+ EXPECT_EQ(base::File::FILE_OK, db()->AddFileInfo(info0, &file_id0));
FileInfo dir_info;
FileId dir_id;
dir_info.parent_id = 0;
dir_info.name = FILE_PATH_LITERAL("directory name");
- EXPECT_EQ(base::PLATFORM_FILE_OK, db()->AddFileInfo(dir_info, &dir_id));
+ EXPECT_EQ(base::File::FILE_OK, db()->AddFileInfo(dir_info, &dir_id));
FileId file_id1;
FileInfo info1;
@@ -482,7 +477,7 @@
info1.data_path = base::FilePath(FILE_PATH_LITERAL("bar"));
info1.name = FILE_PATH_LITERAL("file name 1");
info1.modification_time = base::Time::UnixEpoch();
- EXPECT_EQ(base::PLATFORM_FILE_OK, db()->AddFileInfo(info1, &file_id1));
+ EXPECT_EQ(base::File::FILE_OK, db()->AddFileInfo(info1, &file_id1));
EXPECT_TRUE(db()->OverwritingMoveFile(file_id0, file_id1));
@@ -557,15 +552,11 @@
EXPECT_TRUE(db()->IsFileSystemConsistent());
- bool created = false;
- base::PlatformFileError error = base::PLATFORM_FILE_ERROR_FAILED;
- base::PlatformFile file = base::CreatePlatformFile(
- path().Append(FPL("Orphan File")),
- base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_WRITE,
- &created, &error);
- ASSERT_EQ(base::PLATFORM_FILE_OK, error);
- ASSERT_TRUE(created);
- ASSERT_TRUE(base::ClosePlatformFile(file));
+ base::File file(path().Append(FPL("Orphan File")),
+ base::File::FLAG_CREATE | base::File::FLAG_WRITE);
+ ASSERT_TRUE(file.IsValid());
+ ASSERT_TRUE(file.created());
+ file.Close();
EXPECT_TRUE(db()->IsFileSystemConsistent());
}
diff --git a/webkit/browser/fileapi/sandbox_file_stream_writer.cc b/webkit/browser/fileapi/sandbox_file_stream_writer.cc
index 404bdba..a4e5df1 100644
--- a/webkit/browser/fileapi/sandbox_file_stream_writer.cc
+++ b/webkit/browser/fileapi/sandbox_file_stream_writer.cc
@@ -112,16 +112,16 @@
void SandboxFileStreamWriter::DidCreateSnapshotFile(
const net::CompletionCallback& callback,
- base::PlatformFileError file_error,
- const base::PlatformFileInfo& file_info,
+ base::File::Error file_error,
+ const base::File::Info& file_info,
const base::FilePath& platform_path,
const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref) {
DCHECK(!file_ref.get());
if (CancelIfRequested())
return;
- if (file_error != base::PLATFORM_FILE_OK) {
- callback.Run(net::PlatformFileErrorToNetError(file_error));
+ if (file_error != base::File::FILE_OK) {
+ callback.Run(net::FileErrorToNetError(file_error));
return;
}
if (file_info.is_directory) {
diff --git a/webkit/browser/fileapi/sandbox_file_stream_writer.h b/webkit/browser/fileapi/sandbox_file_stream_writer.h
index 8112337..53cbb50 100644
--- a/webkit/browser/fileapi/sandbox_file_stream_writer.h
+++ b/webkit/browser/fileapi/sandbox_file_stream_writer.h
@@ -5,9 +5,9 @@
#ifndef WEBKIT_BROWSER_FILEAPI_SANDBOX_FILE_STREAM_WRITER_H_
#define WEBKIT_BROWSER_FILEAPI_SANDBOX_FILE_STREAM_WRITER_H_
+#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/memory/scoped_ptr.h"
-#include "base/platform_file.h"
#include "url/gurl.h"
#include "webkit/browser/fileapi/file_stream_writer.h"
#include "webkit/browser/fileapi/file_system_url.h"
@@ -52,8 +52,8 @@
// WriteInternal.
void DidCreateSnapshotFile(
const net::CompletionCallback& callback,
- base::PlatformFileError file_error,
- const base::PlatformFileInfo& file_info,
+ base::File::Error file_error,
+ const base::File::Info& file_info,
const base::FilePath& platform_path,
const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref);
void DidGetUsageAndQuota(const net::CompletionCallback& callback,
diff --git a/webkit/browser/fileapi/sandbox_file_system_backend.cc b/webkit/browser/fileapi/sandbox_file_system_backend.cc
index cc02278..f068a774 100644
--- a/webkit/browser/fileapi/sandbox_file_system_backend.cc
+++ b/webkit/browser/fileapi/sandbox_file_system_backend.cc
@@ -71,7 +71,7 @@
!(type == kFileSystemTypeTemporary &&
enable_temporary_file_system_in_incognito_)) {
// TODO(kinuko): return an isolated temporary directory.
- callback.Run(GURL(), std::string(), base::PLATFORM_FILE_ERROR_SECURITY);
+ callback.Run(GURL(), std::string(), base::File::FILE_ERROR_SECURITY);
return;
}
@@ -89,16 +89,16 @@
CopyOrMoveFileValidatorFactory*
SandboxFileSystemBackend::GetCopyOrMoveFileValidatorFactory(
FileSystemType type,
- base::PlatformFileError* error_code) {
+ base::File::Error* error_code) {
DCHECK(error_code);
- *error_code = base::PLATFORM_FILE_OK;
+ *error_code = base::File::FILE_OK;
return NULL;
}
FileSystemOperation* SandboxFileSystemBackend::CreateFileSystemOperation(
const FileSystemURL& url,
FileSystemContext* context,
- base::PlatformFileError* error_code) const {
+ base::File::Error* error_code) const {
DCHECK(CanHandleType(url.type()));
DCHECK(error_code);
diff --git a/webkit/browser/fileapi/sandbox_file_system_backend.h b/webkit/browser/fileapi/sandbox_file_system_backend.h
index 8531cf862..c3bde3e 100644
--- a/webkit/browser/fileapi/sandbox_file_system_backend.h
+++ b/webkit/browser/fileapi/sandbox_file_system_backend.h
@@ -43,11 +43,11 @@
virtual AsyncFileUtil* GetAsyncFileUtil(FileSystemType type) OVERRIDE;
virtual CopyOrMoveFileValidatorFactory* GetCopyOrMoveFileValidatorFactory(
FileSystemType type,
- base::PlatformFileError* error_code) OVERRIDE;
+ base::File::Error* error_code) OVERRIDE;
virtual FileSystemOperation* CreateFileSystemOperation(
const FileSystemURL& url,
FileSystemContext* context,
- base::PlatformFileError* error_code) const OVERRIDE;
+ base::File::Error* error_code) const OVERRIDE;
virtual scoped_ptr<webkit_blob::FileStreamReader> CreateFileStreamReader(
const FileSystemURL& url,
int64 offset,
diff --git a/webkit/browser/fileapi/sandbox_file_system_backend_delegate.cc b/webkit/browser/fileapi/sandbox_file_system_backend_delegate.cc
index ce18afe1..92545a1 100644
--- a/webkit/browser/fileapi/sandbox_file_system_backend_delegate.cc
+++ b/webkit/browser/fileapi/sandbox_file_system_backend_delegate.cc
@@ -112,13 +112,13 @@
const GURL& origin_url,
FileSystemType type,
OpenFileSystemMode mode,
- base::PlatformFileError* error_ptr) {
+ base::File::Error* error_ptr) {
DCHECK(error_ptr);
const bool create = (mode == OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT);
file_util->GetDirectoryForOriginAndType(
origin_url, SandboxFileSystemBackendDelegate::GetTypeString(type),
create, error_ptr);
- if (*error_ptr != base::PLATFORM_FILE_OK) {
+ if (*error_ptr != base::File::FILE_OK) {
UMA_HISTOGRAM_ENUMERATION(kOpenFileSystemLabel,
kCreateDirectoryError,
kFileSystemErrorMax);
@@ -132,8 +132,8 @@
void DidOpenFileSystem(
base::WeakPtr<SandboxFileSystemBackendDelegate> delegate,
- const base::Callback<void(base::PlatformFileError error)>& callback,
- base::PlatformFileError* error) {
+ const base::Callback<void(base::File::Error error)>& callback,
+ base::File::Error* error) {
if (delegate.get())
delegate.get()->CollectOpenFileSystemMetrics(*error);
callback.Run(*error);
@@ -236,10 +236,10 @@
const GURL& origin_url,
FileSystemType type,
bool create) {
- base::PlatformFileError error = base::PLATFORM_FILE_OK;
+ base::File::Error error = base::File::FILE_OK;
base::FilePath path = obfuscated_file_util()->GetDirectoryForOriginAndType(
origin_url, GetTypeString(type), create, &error);
- if (error != base::PLATFORM_FILE_OK)
+ if (error != base::File::FILE_OK)
return base::FilePath();
return path;
}
@@ -251,13 +251,13 @@
const OpenFileSystemCallback& callback,
const GURL& root_url) {
if (!IsAllowedScheme(origin_url)) {
- callback.Run(GURL(), std::string(), base::PLATFORM_FILE_ERROR_SECURITY);
+ callback.Run(GURL(), std::string(), base::File::FILE_ERROR_SECURITY);
return;
}
std::string name = GetFileSystemName(origin_url, type);
- base::PlatformFileError* error_ptr = new base::PlatformFileError;
+ base::File::Error* error_ptr = new base::File::Error;
file_task_runner_->PostTaskAndReply(
FROM_HERE,
base::Bind(&OpenFileSystemOnFileTaskRunner,
@@ -276,9 +276,9 @@
SandboxFileSystemBackendDelegate::CreateFileSystemOperationContext(
const FileSystemURL& url,
FileSystemContext* context,
- base::PlatformFileError* error_code) const {
+ base::File::Error* error_code) const {
if (!IsAccessValid(url)) {
- *error_code = base::PLATFORM_FILE_ERROR_SECURITY;
+ *error_code = base::File::FILE_ERROR_SECURITY;
return scoped_ptr<FileSystemOperationContext>();
}
@@ -322,7 +322,7 @@
new SandboxFileStreamWriter(context, url, offset, *observers));
}
-base::PlatformFileError
+base::File::Error
SandboxFileSystemBackendDelegate::DeleteOriginDataOnFileTaskRunner(
FileSystemContext* file_system_context,
quota::QuotaManagerProxy* proxy,
@@ -343,8 +343,8 @@
}
if (result)
- return base::PLATFORM_FILE_OK;
- return base::PLATFORM_FILE_ERROR_FAILED;
+ return base::File::FILE_OK;
+ return base::File::FILE_ERROR_FAILED;
}
void SandboxFileSystemBackendDelegate::GetOriginsForTypeOnFileTaskRunner(
@@ -494,10 +494,10 @@
void SandboxFileSystemBackendDelegate::InvalidateUsageCache(
const GURL& origin,
FileSystemType type) {
- base::PlatformFileError error = base::PLATFORM_FILE_OK;
+ base::File::Error error = base::File::FILE_OK;
base::FilePath usage_file_path = GetUsageCachePathForOriginAndType(
obfuscated_file_util(), origin, type, &error);
- if (error != base::PLATFORM_FILE_OK)
+ if (error != base::File::FILE_OK)
return;
usage_cache()->IncrementDirty(usage_file_path);
}
@@ -568,10 +568,10 @@
SandboxFileSystemBackendDelegate::GetUsageCachePathForOriginAndType(
const GURL& origin_url,
FileSystemType type) {
- base::PlatformFileError error;
+ base::File::Error error;
base::FilePath path = GetUsageCachePathForOriginAndType(
obfuscated_file_util(), origin_url, type, &error);
- if (error != base::PLATFORM_FILE_OK)
+ if (error != base::File::FILE_OK)
return base::FilePath();
return path;
}
@@ -582,12 +582,12 @@
ObfuscatedFileUtil* sandbox_file_util,
const GURL& origin_url,
FileSystemType type,
- base::PlatformFileError* error_out) {
+ base::File::Error* error_out) {
DCHECK(error_out);
- *error_out = base::PLATFORM_FILE_OK;
+ *error_out = base::File::FILE_OK;
base::FilePath base_path = sandbox_file_util->GetDirectoryForOriginAndType(
origin_url, GetTypeString(type), false /* create */, error_out);
- if (*error_out != base::PLATFORM_FILE_OK)
+ if (*error_out != base::File::FILE_OK)
return base::FilePath();
return base_path.Append(FileSystemUsageCache::kUsageFileName);
}
@@ -615,7 +615,7 @@
}
void SandboxFileSystemBackendDelegate::CollectOpenFileSystemMetrics(
- base::PlatformFileError error_code) {
+ base::File::Error error_code) {
base::Time now = base::Time::Now();
bool throttled = now < next_release_time_for_open_filesystem_stat_;
if (!throttled) {
@@ -634,16 +634,16 @@
}
switch (error_code) {
- case base::PLATFORM_FILE_OK:
+ case base::File::FILE_OK:
REPORT(kOK);
break;
- case base::PLATFORM_FILE_ERROR_INVALID_URL:
+ case base::File::FILE_ERROR_INVALID_URL:
REPORT(kInvalidSchemeError);
break;
- case base::PLATFORM_FILE_ERROR_NOT_FOUND:
+ case base::File::FILE_ERROR_NOT_FOUND:
REPORT(kNotFound);
break;
- case base::PLATFORM_FILE_ERROR_FAILED:
+ case base::File::FILE_ERROR_FAILED:
default:
REPORT(kUnknownError);
break;
diff --git a/webkit/browser/fileapi/sandbox_file_system_backend_delegate.h b/webkit/browser/fileapi/sandbox_file_system_backend_delegate.h
index 9595cda..2b67cfc 100644
--- a/webkit/browser/fileapi/sandbox_file_system_backend_delegate.h
+++ b/webkit/browser/fileapi/sandbox_file_system_backend_delegate.h
@@ -113,7 +113,7 @@
scoped_ptr<FileSystemOperationContext> CreateFileSystemOperationContext(
const FileSystemURL& url,
FileSystemContext* context,
- base::PlatformFileError* error_code) const;
+ base::File::Error* error_code) const;
scoped_ptr<webkit_blob::FileStreamReader> CreateFileStreamReader(
const FileSystemURL& url,
int64 offset,
@@ -126,7 +126,7 @@
FileSystemType type) const;
// FileSystemQuotaUtil overrides.
- virtual base::PlatformFileError DeleteOriginDataOnFileTaskRunner(
+ virtual base::File::Error DeleteOriginDataOnFileTaskRunner(
FileSystemContext* context,
quota::QuotaManagerProxy* proxy,
const GURL& origin_url,
@@ -173,7 +173,7 @@
void StickyInvalidateUsageCache(const GURL& origin_url,
FileSystemType type);
- void CollectOpenFileSystemMetrics(base::PlatformFileError error_code);
+ void CollectOpenFileSystemMetrics(base::File::Error error_code);
base::SequencedTaskRunner* file_task_runner() {
return file_task_runner_.get();
@@ -217,7 +217,7 @@
ObfuscatedFileUtil* sandbox_file_util,
const GURL& origin_url,
FileSystemType type,
- base::PlatformFileError* error_out);
+ base::File::Error* error_out);
int64 RecalculateUsage(FileSystemContext* context,
const GURL& origin,
diff --git a/webkit/browser/fileapi/sandbox_quota_observer.cc b/webkit/browser/fileapi/sandbox_quota_observer.cc
index e81e4405..42b6d086 100644
--- a/webkit/browser/fileapi/sandbox_quota_observer.cc
+++ b/webkit/browser/fileapi/sandbox_quota_observer.cc
@@ -105,11 +105,11 @@
base::FilePath SandboxQuotaObserver::GetUsageCachePath(
const FileSystemURL& url) {
DCHECK(sandbox_file_util_);
- base::PlatformFileError error = base::PLATFORM_FILE_OK;
+ base::File::Error error = base::File::FILE_OK;
base::FilePath path =
SandboxFileSystemBackendDelegate::GetUsageCachePathForOriginAndType(
sandbox_file_util_, url.origin(), url.type(), &error);
- if (error != base::PLATFORM_FILE_OK) {
+ if (error != base::File::FILE_OK) {
LOG(WARNING) << "Could not get usage cache path for: "
<< url.DebugString();
return base::FilePath();
diff --git a/webkit/browser/fileapi/transient_file_util.cc b/webkit/browser/fileapi/transient_file_util.cc
index 74c2dbea..4cac5ca 100644
--- a/webkit/browser/fileapi/transient_file_util.cc
+++ b/webkit/browser/fileapi/transient_file_util.cc
@@ -28,14 +28,14 @@
ScopedFile TransientFileUtil::CreateSnapshotFile(
FileSystemOperationContext* context,
const FileSystemURL& url,
- base::PlatformFileError* error,
- base::PlatformFileInfo* file_info,
+ base::File::Error* error,
+ base::File::Info* file_info,
base::FilePath* platform_path) {
DCHECK(file_info);
*error = GetFileInfo(context, url, file_info, platform_path);
- if (*error == base::PLATFORM_FILE_OK && file_info->is_directory)
- *error = base::PLATFORM_FILE_ERROR_NOT_A_FILE;
- if (*error != base::PLATFORM_FILE_OK)
+ if (*error == base::File::FILE_OK && file_info->is_directory)
+ *error = base::File::FILE_ERROR_NOT_A_FILE;
+ if (*error != base::File::FILE_OK)
return ScopedFile();
// Sets-up a transient filesystem.
diff --git a/webkit/browser/fileapi/transient_file_util.h b/webkit/browser/fileapi/transient_file_util.h
index 1e67c85..6ffb48c 100644
--- a/webkit/browser/fileapi/transient_file_util.h
+++ b/webkit/browser/fileapi/transient_file_util.h
@@ -23,8 +23,8 @@
virtual webkit_blob::ScopedFile CreateSnapshotFile(
FileSystemOperationContext* context,
const FileSystemURL& url,
- base::PlatformFileError* error,
- base::PlatformFileInfo* file_info,
+ base::File::Error* error,
+ base::File::Info* file_info,
base::FilePath* platform_path) OVERRIDE;
private:
diff --git a/webkit/common/fileapi/file_system_util.cc b/webkit/common/fileapi/file_system_util.cc
index 6825f32..9f01b3e8 100644
--- a/webkit/common/fileapi/file_system_util.cc
+++ b/webkit/common/fileapi/file_system_util.cc
@@ -284,29 +284,29 @@
#endif
}
-blink::WebFileError PlatformFileErrorToWebFileError(
- base::PlatformFileError error_code) {
+blink::WebFileError FileErrorToWebFileError(
+ base::File::Error error_code) {
switch (error_code) {
- case base::PLATFORM_FILE_ERROR_NOT_FOUND:
+ case base::File::FILE_ERROR_NOT_FOUND:
return blink::WebFileErrorNotFound;
- case base::PLATFORM_FILE_ERROR_INVALID_OPERATION:
- case base::PLATFORM_FILE_ERROR_EXISTS:
- case base::PLATFORM_FILE_ERROR_NOT_EMPTY:
+ case base::File::FILE_ERROR_INVALID_OPERATION:
+ case base::File::FILE_ERROR_EXISTS:
+ case base::File::FILE_ERROR_NOT_EMPTY:
return blink::WebFileErrorInvalidModification;
- case base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY:
- case base::PLATFORM_FILE_ERROR_NOT_A_FILE:
+ case base::File::FILE_ERROR_NOT_A_DIRECTORY:
+ case base::File::FILE_ERROR_NOT_A_FILE:
return blink::WebFileErrorTypeMismatch;
- case base::PLATFORM_FILE_ERROR_ACCESS_DENIED:
+ case base::File::FILE_ERROR_ACCESS_DENIED:
return blink::WebFileErrorNoModificationAllowed;
- case base::PLATFORM_FILE_ERROR_FAILED:
+ case base::File::FILE_ERROR_FAILED:
return blink::WebFileErrorInvalidState;
- case base::PLATFORM_FILE_ERROR_ABORT:
+ case base::File::FILE_ERROR_ABORT:
return blink::WebFileErrorAbort;
- case base::PLATFORM_FILE_ERROR_SECURITY:
+ case base::File::FILE_ERROR_SECURITY:
return blink::WebFileErrorSecurity;
- case base::PLATFORM_FILE_ERROR_NO_SPACE:
+ case base::File::FILE_ERROR_NO_SPACE:
return blink::WebFileErrorQuotaExceeded;
- case base::PLATFORM_FILE_ERROR_INVALID_URL:
+ case base::File::FILE_ERROR_INVALID_URL:
return blink::WebFileErrorEncoding;
default:
return blink::WebFileErrorInvalidModification;
@@ -413,35 +413,35 @@
return root;
}
-base::PlatformFileError NetErrorToPlatformFileError(int error) {
+base::File::Error NetErrorToFileError(int error) {
switch (error) {
case net::OK:
- return base::PLATFORM_FILE_OK;
+ return base::File::FILE_OK;
case net::ERR_ADDRESS_IN_USE:
- return base::PLATFORM_FILE_ERROR_IN_USE;
+ return base::File::FILE_ERROR_IN_USE;
case net::ERR_FILE_EXISTS:
- return base::PLATFORM_FILE_ERROR_EXISTS;
+ return base::File::FILE_ERROR_EXISTS;
case net::ERR_FILE_NOT_FOUND:
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ return base::File::FILE_ERROR_NOT_FOUND;
case net::ERR_ACCESS_DENIED:
- return base::PLATFORM_FILE_ERROR_ACCESS_DENIED;
+ return base::File::FILE_ERROR_ACCESS_DENIED;
case net::ERR_TOO_MANY_SOCKET_STREAMS:
- return base::PLATFORM_FILE_ERROR_TOO_MANY_OPENED;
+ return base::File::FILE_ERROR_TOO_MANY_OPENED;
case net::ERR_OUT_OF_MEMORY:
- return base::PLATFORM_FILE_ERROR_NO_MEMORY;
+ return base::File::FILE_ERROR_NO_MEMORY;
case net::ERR_FILE_NO_SPACE:
- return base::PLATFORM_FILE_ERROR_NO_SPACE;
+ return base::File::FILE_ERROR_NO_SPACE;
case net::ERR_INVALID_ARGUMENT:
case net::ERR_INVALID_HANDLE:
- return base::PLATFORM_FILE_ERROR_INVALID_OPERATION;
+ return base::File::FILE_ERROR_INVALID_OPERATION;
case net::ERR_ABORTED:
case net::ERR_CONNECTION_ABORTED:
- return base::PLATFORM_FILE_ERROR_ABORT;
+ return base::File::FILE_ERROR_ABORT;
case net::ERR_ADDRESS_INVALID:
case net::ERR_INVALID_URL:
- return base::PLATFORM_FILE_ERROR_INVALID_URL;
+ return base::File::FILE_ERROR_INVALID_URL;
default:
- return base::PLATFORM_FILE_ERROR_FAILED;
+ return base::File::FILE_ERROR_FAILED;
}
}
diff --git a/webkit/common/fileapi/file_system_util.h b/webkit/common/fileapi/file_system_util.h
index 335d62c..3ed3769 100644
--- a/webkit/common/fileapi/file_system_util.h
+++ b/webkit/common/fileapi/file_system_util.h
@@ -8,6 +8,7 @@
#include <string>
#include <vector>
+#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/platform_file.h"
#include "third_party/WebKit/public/platform/WebFileError.h"
@@ -129,7 +130,7 @@
// File error conversion
WEBKIT_STORAGE_COMMON_EXPORT blink::WebFileError
-PlatformFileErrorToWebFileError(base::PlatformFileError error_code);
+FileErrorToWebFileError(base::File::Error error_code);
// Generate a file system name for the given arguments. Should only be used by
// platform apps.
@@ -163,9 +164,9 @@
const GURL& origin_url,
const std::string& mount_name);
-// Translates the net::Error to base::PlatformFileError.
-WEBKIT_STORAGE_COMMON_EXPORT base::PlatformFileError
-NetErrorToPlatformFileError(int error);
+// Translates the net::Error to base::File::Error.
+WEBKIT_STORAGE_COMMON_EXPORT base::File::Error
+NetErrorToFileError(int error);
#if defined(OS_CHROMEOS)
// Returns the filesystem info that can be specified by |origin_url|.
diff --git a/webkit/glue/webfileutilities_impl.cc b/webkit/glue/webfileutilities_impl.cc
index 6e70ff5..eca5326 100644
--- a/webkit/glue/webfileutilities_impl.cc
+++ b/webkit/glue/webfileutilities_impl.cc
@@ -32,12 +32,12 @@
return false;
}
// TODO(rvargas): convert this code to use base::File::Info.
- base::PlatformFileInfo file_info;
+ base::File::Info file_info;
if (!base::GetFileInfo(base::FilePath::FromUTF16Unsafe(path),
reinterpret_cast<base::File::Info*>(&file_info)))
return false;
- webkit_glue::PlatformFileInfoToWebFileInfo(file_info, &web_file_info);
+ webkit_glue::FileInfoToWebFileInfo(file_info, &web_file_info);
web_file_info.platformPath = path;
return true;
}
diff --git a/webkit/glue/webkit_glue.cc b/webkit/glue/webkit_glue.cc
index b051e43..3b332e2 100644
--- a/webkit/glue/webkit_glue.cc
+++ b/webkit/glue/webkit_glue.cc
@@ -14,8 +14,8 @@
v8::V8::SetFlagsFromString(str.data(), static_cast<int>(str.size()));
}
-void PlatformFileInfoToWebFileInfo(
- const base::PlatformFileInfo& file_info,
+void FileInfoToWebFileInfo(
+ const base::File::Info& file_info,
blink::WebFileInfo* web_file_info) {
DCHECK(web_file_info);
// WebKit now expects NaN as uninitialized/null Date.
diff --git a/webkit/glue/webkit_glue.h b/webkit/glue/webkit_glue.h
index 8f3a62b..6f11f7f 100644
--- a/webkit/glue/webkit_glue.h
+++ b/webkit/glue/webkit_glue.h
@@ -7,7 +7,7 @@
#include <string>
-#include "base/platform_file.h"
+#include "base/files/file.h"
#include "webkit/glue/webkit_glue_export.h"
namespace blink {
@@ -19,8 +19,8 @@
WEBKIT_GLUE_EXPORT void SetJavaScriptFlags(const std::string& flags);
// File info conversion
-WEBKIT_GLUE_EXPORT void PlatformFileInfoToWebFileInfo(
- const base::PlatformFileInfo& file_info,
+WEBKIT_GLUE_EXPORT void FileInfoToWebFileInfo(
+ const base::File::Info& file_info,
blink::WebFileInfo* web_file_info);
} // namespace webkit_glue