OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "storage/browser/fileapi/native_file_util.h" | 5 #include "storage/browser/fileapi/native_file_util.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/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 | 199 |
200 if (!base::GetFileInfo(path, file_info)) | 200 if (!base::GetFileInfo(path, file_info)) |
201 return base::File::FILE_ERROR_FAILED; | 201 return base::File::FILE_ERROR_FAILED; |
202 return base::File::FILE_OK; | 202 return base::File::FILE_OK; |
203 } | 203 } |
204 | 204 |
205 scoped_ptr<FileSystemFileUtil::AbstractFileEnumerator> | 205 scoped_ptr<FileSystemFileUtil::AbstractFileEnumerator> |
206 NativeFileUtil::CreateFileEnumerator(const base::FilePath& root_path, | 206 NativeFileUtil::CreateFileEnumerator(const base::FilePath& root_path, |
207 bool recursive) { | 207 bool recursive) { |
208 return make_scoped_ptr(new NativeFileEnumerator( | 208 return make_scoped_ptr(new NativeFileEnumerator( |
209 root_path, recursive, | 209 root_path, |
210 base::FileEnumerator::FILES | base::FileEnumerator::DIRECTORIES)) | 210 recursive, |
211 .PassAs<FileSystemFileUtil::AbstractFileEnumerator>(); | 211 base::FileEnumerator::FILES | base::FileEnumerator::DIRECTORIES)); |
212 } | 212 } |
213 | 213 |
214 base::File::Error NativeFileUtil::Touch( | 214 base::File::Error NativeFileUtil::Touch( |
215 const base::FilePath& path, | 215 const base::FilePath& path, |
216 const base::Time& last_access_time, | 216 const base::Time& last_access_time, |
217 const base::Time& last_modified_time) { | 217 const base::Time& last_modified_time) { |
218 if (!base::TouchFile(path, last_access_time, last_modified_time)) | 218 if (!base::TouchFile(path, last_access_time, last_modified_time)) |
219 return base::File::FILE_ERROR_FAILED; | 219 return base::File::FILE_ERROR_FAILED; |
220 return base::File::FILE_OK; | 220 return base::File::FILE_OK; |
221 } | 221 } |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 if (!base::DirectoryExists(path)) | 306 if (!base::DirectoryExists(path)) |
307 return base::File::FILE_ERROR_NOT_A_DIRECTORY; | 307 return base::File::FILE_ERROR_NOT_A_DIRECTORY; |
308 if (!base::IsDirectoryEmpty(path)) | 308 if (!base::IsDirectoryEmpty(path)) |
309 return base::File::FILE_ERROR_NOT_EMPTY; | 309 return base::File::FILE_ERROR_NOT_EMPTY; |
310 if (!base::DeleteFile(path, false)) | 310 if (!base::DeleteFile(path, false)) |
311 return base::File::FILE_ERROR_FAILED; | 311 return base::File::FILE_ERROR_FAILED; |
312 return base::File::FILE_OK; | 312 return base::File::FILE_OK; |
313 } | 313 } |
314 | 314 |
315 } // namespace storage | 315 } // namespace storage |
OLD | NEW |