Index: components/filesystem/directory_impl.cc |
diff --git a/components/filesystem/directory_impl.cc b/components/filesystem/directory_impl.cc |
index 487f755503800d5b0feb92b61e9a8c72a9dfc889..fca0a212afba2ae9ec9ea4ed669dada3e611642e 100644 |
--- a/components/filesystem/directory_impl.cc |
+++ b/components/filesystem/directory_impl.cc |
@@ -37,12 +37,12 @@ void DirectoryImpl::Read(const ReadCallback& callback) { |
base::FileEnumerator::FileInfo info = directory_enumerator.GetInfo(); |
DirectoryEntryPtr entry = DirectoryEntry::New(); |
entry->type = info.IsDirectory() |
- ? FILE_TYPE_DIRECTORY : FILE_TYPE_REGULAR_FILE; |
+ ? FS_FILE_TYPE_DIRECTORY : FS_FILE_TYPE_REGULAR_FILE; |
entry->name = info.GetName().AsUTF8Unsafe(); |
entries.push_back(entry.Pass()); |
} |
- callback.Run(ERROR_OK, entries.Pass()); |
+ callback.Run(FILE_ERROR_OK, entries.Pass()); |
} |
// TODO(erg): Consider adding an implementation of Stat()/Touch() to the |
@@ -55,20 +55,20 @@ void DirectoryImpl::OpenFile(const mojo::String& raw_path, |
uint32_t open_flags, |
const OpenFileCallback& callback) { |
base::FilePath path; |
- if (Error error = ValidatePath(raw_path, directory_path_, &path)) { |
+ if (FileError error = ValidatePath(raw_path, directory_path_, &path)) { |
callback.Run(error); |
return; |
} |
base::File base_file(path, open_flags); |
if (!base_file.IsValid()) { |
- callback.Run(ERROR_FAILED); |
+ callback.Run(FILE_ERROR_FAILED); |
return; |
} |
base::File::Info info; |
if (!base_file.GetInfo(&info)) { |
- callback.Run(ERROR_FAILED); |
+ callback.Run(FILE_ERROR_FAILED); |
return; |
} |
@@ -76,14 +76,14 @@ void DirectoryImpl::OpenFile(const mojo::String& raw_path, |
// We must not return directories as files. In the file abstraction, we can |
// fetch raw file descriptors over mojo pipes, and passing a file |
// descriptor to a directory is a sandbox escape on Windows. |
- callback.Run(ERROR_NOT_A_FILE); |
+ callback.Run(FILE_ERROR_NOT_A_FILE); |
return; |
} |
if (file.is_pending()) { |
new FileImpl(file.Pass(), base_file.Pass()); |
} |
- callback.Run(ERROR_OK); |
+ callback.Run(FILE_ERROR_OK); |
} |
void DirectoryImpl::OpenDirectory(const mojo::String& raw_path, |
@@ -91,27 +91,27 @@ void DirectoryImpl::OpenDirectory(const mojo::String& raw_path, |
uint32_t open_flags, |
const OpenDirectoryCallback& callback) { |
base::FilePath path; |
- if (Error error = ValidatePath(raw_path, directory_path_, &path)) { |
+ if (FileError error = ValidatePath(raw_path, directory_path_, &path)) { |
callback.Run(error); |
return; |
} |
if (!base::DirectoryExists(path)) { |
if (base::PathExists(path)) { |
- callback.Run(ERROR_NOT_A_DIRECTORY); |
+ callback.Run(FILE_ERROR_NOT_A_DIRECTORY); |
return; |
} |
if (!(open_flags & kFlagOpenAlways || open_flags & kFlagCreate)) { |
// The directory doesn't exist, and we weren't passed parameters to |
// create it. |
- callback.Run(ERROR_NOT_FOUND); |
+ callback.Run(FILE_ERROR_NOT_FOUND); |
return; |
} |
base::File::Error error; |
if (!base::CreateDirectoryAndGetError(path, &error)) { |
- callback.Run(static_cast<filesystem::Error>(error)); |
+ callback.Run(static_cast<filesystem::FileError>(error)); |
return; |
} |
} |
@@ -119,48 +119,50 @@ void DirectoryImpl::OpenDirectory(const mojo::String& raw_path, |
if (directory.is_pending()) |
new DirectoryImpl(directory.Pass(), path, |
scoped_ptr<base::ScopedTempDir>()); |
- callback.Run(ERROR_OK); |
+ callback.Run(FILE_ERROR_OK); |
} |
void DirectoryImpl::Rename(const mojo::String& raw_old_path, |
const mojo::String& raw_new_path, |
const RenameCallback& callback) { |
base::FilePath old_path; |
- if (Error error = ValidatePath(raw_old_path, directory_path_, &old_path)) { |
+ if (FileError error = |
+ ValidatePath(raw_old_path, directory_path_, &old_path)) { |
callback.Run(error); |
return; |
} |
base::FilePath new_path; |
- if (Error error = ValidatePath(raw_new_path, directory_path_, &new_path)) { |
+ if (FileError error = |
+ ValidatePath(raw_new_path, directory_path_, &new_path)) { |
callback.Run(error); |
return; |
} |
if (!base::Move(old_path, new_path)) { |
- callback.Run(ERROR_FAILED); |
+ callback.Run(FILE_ERROR_FAILED); |
return; |
} |
- callback.Run(ERROR_OK); |
+ callback.Run(FILE_ERROR_OK); |
} |
void DirectoryImpl::Delete(const mojo::String& raw_path, |
uint32_t delete_flags, |
const DeleteCallback& callback) { |
base::FilePath path; |
- if (Error error = ValidatePath(raw_path, directory_path_, &path)) { |
+ if (FileError error = ValidatePath(raw_path, directory_path_, &path)) { |
callback.Run(error); |
return; |
} |
bool recursive = delete_flags & kDeleteFlagRecursive; |
if (!base::DeleteFile(path, recursive)) { |
- callback.Run(ERROR_FAILED); |
+ callback.Run(FILE_ERROR_FAILED); |
return; |
} |
- callback.Run(ERROR_OK); |
+ callback.Run(FILE_ERROR_OK); |
} |
} // namespace filesystem |