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

Side by Side 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: fix win 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/filesystem/directory_impl.h" 5 #include "components/filesystem/directory_impl.h"
6 6
7 #include "base/files/file.h" 7 #include "base/files/file.h"
8 #include "base/files/file_enumerator.h" 8 #include "base/files/file_enumerator.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 164
165 bool recursive = delete_flags & kDeleteFlagRecursive; 165 bool recursive = delete_flags & kDeleteFlagRecursive;
166 if (!base::DeleteFile(path, recursive)) { 166 if (!base::DeleteFile(path, recursive)) {
167 callback.Run(FILE_ERROR_FAILED); 167 callback.Run(FILE_ERROR_FAILED);
168 return; 168 return;
169 } 169 }
170 170
171 callback.Run(FILE_ERROR_OK); 171 callback.Run(FILE_ERROR_OK);
172 } 172 }
173 173
174 void DirectoryImpl::Exists(const mojo::String& raw_path,
175 const ExistsCallback& callback) {
176 base::FilePath path;
177 if (FileError error = ValidatePath(raw_path, directory_path_, &path)) {
178 callback.Run(error, false);
179 return;
180 }
181
182 bool exists = base::PathExists(path);
183 callback.Run(FILE_ERROR_OK, exists);
184 }
185
186 void DirectoryImpl::IsWritable(const mojo::String& raw_path,
187 const IsWritableCallback& callback) {
188 base::FilePath path;
189 if (FileError error = ValidatePath(raw_path, directory_path_, &path)) {
190 callback.Run(error, false);
191 return;
192 }
193
194 callback.Run(FILE_ERROR_OK, base::PathIsWritable(path));
195 }
196
197 void DirectoryImpl::Flush(const FlushCallback& callback) {
198 base::File file(directory_path_, base::File::FLAG_READ);
199 if (!file.IsValid()) {
200 callback.Run(FILE_ERROR_FAILED);
201 return;
202 }
203
204 if (!file.Flush()) {
205 callback.Run(FILE_ERROR_FAILED);
206 return;
207 }
208
209 callback.Run(FILE_ERROR_OK);
210 }
211
174 } // namespace filesystem 212 } // namespace filesystem
OLDNEW
« no previous file with comments | « components/filesystem/directory_impl.h ('k') | components/filesystem/directory_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698