Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(286)

Unified Diff: components/filesystem/directory_impl.cc

Issue 1166763002: Reland "Mandoline filesystem: Build the filesystem on windows." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: DWORD -> INT for real checking. (This was wrong.) Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | components/filesystem/directory_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | components/filesystem/directory_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698