| Index: components/filesystem/directory_impl.cc
|
| diff --git a/components/filesystem/directory_impl.cc b/components/filesystem/directory_impl.cc
|
| index 4a6caac01d4e4951bb316b94b7af2f37f21c274e..3d63f0e147e847ec80b237110f6e82087a25b445 100644
|
| --- a/components/filesystem/directory_impl.cc
|
| +++ b/components/filesystem/directory_impl.cc
|
| @@ -171,4 +171,42 @@ void DirectoryImpl::Delete(const mojo::String& raw_path,
|
| callback.Run(FILE_ERROR_OK);
|
| }
|
|
|
| +void DirectoryImpl::Exists(const mojo::String& raw_path,
|
| + const ExistsCallback& callback) {
|
| + base::FilePath path;
|
| + if (FileError error = ValidatePath(raw_path, directory_path_, &path)) {
|
| + callback.Run(error, false);
|
| + return;
|
| + }
|
| +
|
| + bool exists = base::PathExists(path);
|
| + callback.Run(FILE_ERROR_OK, exists);
|
| +}
|
| +
|
| +void DirectoryImpl::IsWritable(const mojo::String& raw_path,
|
| + const IsWritableCallback& callback) {
|
| + base::FilePath path;
|
| + if (FileError error = ValidatePath(raw_path, directory_path_, &path)) {
|
| + callback.Run(error, false);
|
| + return;
|
| + }
|
| +
|
| + callback.Run(FILE_ERROR_OK, base::PathIsWritable(path));
|
| +}
|
| +
|
| +void DirectoryImpl::Flush(const FlushCallback& callback) {
|
| + base::File file(directory_path_, base::File::FLAG_READ);
|
| + if (!file.IsValid()) {
|
| + callback.Run(FILE_ERROR_FAILED);
|
| + return;
|
| + }
|
| +
|
| + if (!file.Flush()) {
|
| + callback.Run(FILE_ERROR_FAILED);
|
| + return;
|
| + }
|
| +
|
| + callback.Run(FILE_ERROR_OK);
|
| +}
|
| +
|
| } // namespace filesystem
|
|
|