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

Unified Diff: components/filesystem/directory_impl.cc

Issue 1176653002: mandoline filesystem: add a sqlite3 vfs to proxy filesystem usage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge with ToT and fix the test import. Created 5 years, 6 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
Index: components/filesystem/directory_impl.cc
diff --git a/components/filesystem/directory_impl.cc b/components/filesystem/directory_impl.cc
index fca0a212afba2ae9ec9ea4ed669dada3e611642e..4c8957f99aab6b92c4c6b85852e2205cfb39f7bf 100644
--- a/components/filesystem/directory_impl.cc
+++ b/components/filesystem/directory_impl.cc
@@ -165,4 +165,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

Powered by Google App Engine
This is Rietveld 408576698