| Index: components/filesystem/directory_impl.cc
|
| diff --git a/components/filesystem/directory_impl.cc b/components/filesystem/directory_impl.cc
|
| index fca0a212afba2ae9ec9ea4ed669dada3e611642e..487f755503800d5b0feb92b61e9a8c72a9dfc889 100644
|
| --- a/components/filesystem/directory_impl.cc
|
| +++ b/components/filesystem/directory_impl.cc
|
| @@ -37,12 +37,12 @@
|
| base::FileEnumerator::FileInfo info = directory_enumerator.GetInfo();
|
| DirectoryEntryPtr entry = DirectoryEntry::New();
|
| entry->type = info.IsDirectory()
|
| - ? FS_FILE_TYPE_DIRECTORY : FS_FILE_TYPE_REGULAR_FILE;
|
| + ? FILE_TYPE_DIRECTORY : FILE_TYPE_REGULAR_FILE;
|
| entry->name = info.GetName().AsUTF8Unsafe();
|
| entries.push_back(entry.Pass());
|
| }
|
|
|
| - callback.Run(FILE_ERROR_OK, entries.Pass());
|
| + callback.Run(ERROR_OK, entries.Pass());
|
| }
|
|
|
| // TODO(erg): Consider adding an implementation of Stat()/Touch() to the
|
| @@ -55,20 +55,20 @@
|
| uint32_t open_flags,
|
| const OpenFileCallback& callback) {
|
| base::FilePath path;
|
| - if (FileError error = ValidatePath(raw_path, directory_path_, &path)) {
|
| + if (Error error = ValidatePath(raw_path, directory_path_, &path)) {
|
| callback.Run(error);
|
| return;
|
| }
|
|
|
| base::File base_file(path, open_flags);
|
| if (!base_file.IsValid()) {
|
| - callback.Run(FILE_ERROR_FAILED);
|
| + callback.Run(ERROR_FAILED);
|
| return;
|
| }
|
|
|
| base::File::Info info;
|
| if (!base_file.GetInfo(&info)) {
|
| - callback.Run(FILE_ERROR_FAILED);
|
| + callback.Run(ERROR_FAILED);
|
| return;
|
| }
|
|
|
| @@ -76,14 +76,14 @@
|
| // 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(FILE_ERROR_NOT_A_FILE);
|
| + callback.Run(ERROR_NOT_A_FILE);
|
| return;
|
| }
|
|
|
| if (file.is_pending()) {
|
| new FileImpl(file.Pass(), base_file.Pass());
|
| }
|
| - callback.Run(FILE_ERROR_OK);
|
| + callback.Run(ERROR_OK);
|
| }
|
|
|
| void DirectoryImpl::OpenDirectory(const mojo::String& raw_path,
|
| @@ -91,27 +91,27 @@
|
| uint32_t open_flags,
|
| const OpenDirectoryCallback& callback) {
|
| base::FilePath path;
|
| - if (FileError error = ValidatePath(raw_path, directory_path_, &path)) {
|
| + if (Error error = ValidatePath(raw_path, directory_path_, &path)) {
|
| callback.Run(error);
|
| return;
|
| }
|
|
|
| if (!base::DirectoryExists(path)) {
|
| if (base::PathExists(path)) {
|
| - callback.Run(FILE_ERROR_NOT_A_DIRECTORY);
|
| + callback.Run(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(FILE_ERROR_NOT_FOUND);
|
| + callback.Run(ERROR_NOT_FOUND);
|
| return;
|
| }
|
|
|
| base::File::Error error;
|
| if (!base::CreateDirectoryAndGetError(path, &error)) {
|
| - callback.Run(static_cast<filesystem::FileError>(error));
|
| + callback.Run(static_cast<filesystem::Error>(error));
|
| return;
|
| }
|
| }
|
| @@ -119,50 +119,48 @@
|
| if (directory.is_pending())
|
| new DirectoryImpl(directory.Pass(), path,
|
| scoped_ptr<base::ScopedTempDir>());
|
| - callback.Run(FILE_ERROR_OK);
|
| + callback.Run(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 (FileError error =
|
| - ValidatePath(raw_old_path, directory_path_, &old_path)) {
|
| + if (Error error = ValidatePath(raw_old_path, directory_path_, &old_path)) {
|
| callback.Run(error);
|
| return;
|
| }
|
|
|
| base::FilePath new_path;
|
| - if (FileError error =
|
| - ValidatePath(raw_new_path, directory_path_, &new_path)) {
|
| + if (Error error = ValidatePath(raw_new_path, directory_path_, &new_path)) {
|
| callback.Run(error);
|
| return;
|
| }
|
|
|
| if (!base::Move(old_path, new_path)) {
|
| - callback.Run(FILE_ERROR_FAILED);
|
| + callback.Run(ERROR_FAILED);
|
| return;
|
| }
|
|
|
| - callback.Run(FILE_ERROR_OK);
|
| + callback.Run(ERROR_OK);
|
| }
|
|
|
| void DirectoryImpl::Delete(const mojo::String& raw_path,
|
| uint32_t delete_flags,
|
| const DeleteCallback& callback) {
|
| base::FilePath path;
|
| - if (FileError error = ValidatePath(raw_path, directory_path_, &path)) {
|
| + if (Error error = ValidatePath(raw_path, directory_path_, &path)) {
|
| callback.Run(error);
|
| return;
|
| }
|
|
|
| bool recursive = delete_flags & kDeleteFlagRecursive;
|
| if (!base::DeleteFile(path, recursive)) {
|
| - callback.Run(FILE_ERROR_FAILED);
|
| + callback.Run(ERROR_FAILED);
|
| return;
|
| }
|
|
|
| - callback.Run(FILE_ERROR_OK);
|
| + callback.Run(ERROR_OK);
|
| }
|
|
|
| } // namespace filesystem
|
|
|