| 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 #ifndef WEBKIT_FILEAPI_NATIVE_FILE_UTIL_H_ | 5 #ifndef WEBKIT_BROWSER_FILEAPI_NATIVE_FILE_UTIL_H_ |
| 6 #define WEBKIT_FILEAPI_NATIVE_FILE_UTIL_H_ | 6 #define WEBKIT_BROWSER_FILEAPI_NATIVE_FILE_UTIL_H_ |
| 7 | 7 |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/files/file_util_proxy.h" | 9 #include "base/files/file_util_proxy.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/platform_file.h" | 11 #include "base/platform_file.h" |
| 12 #include "webkit/fileapi/file_system_file_util.h" | 12 #include "webkit/browser/fileapi/file_system_file_util.h" |
| 13 #include "webkit/storage/webkit_storage_export.h" | 13 #include "webkit/storage/webkit_storage_export.h" |
| 14 | 14 |
| 15 namespace base { | 15 namespace base { |
| 16 class Time; | 16 class Time; |
| 17 } | 17 } |
| 18 | 18 |
| 19 namespace fileapi { | 19 namespace fileapi { |
| 20 | 20 |
| 21 // A thin wrapper class for accessing the OS native filesystem. | 21 // A thin wrapper class for accessing the OS native filesystem. |
| 22 // This performs common error checks necessary to implement FileUtil family | 22 // This performs common error checks necessary to implement FileUtil family |
| 23 // in addition to perform native filesystem operations. | 23 // in addition to perform native filesystem operations. |
| 24 // | 24 // |
| 25 // For the error checks it performs please see the comment for | 25 // For the error checks it performs please see the comment for |
| 26 // FileSystemFileUtil interface (webkit/fileapi/file_system_file_util.h). | 26 // FileSystemFileUtil interface |
| 27 // (webkit/browser/fileapi/file_system_file_util.h). |
| 27 // | 28 // |
| 28 // Note that all the methods of this class are static and this does NOT | 29 // Note that all the methods of this class are static and this does NOT |
| 29 // inherit from FileSystemFileUtil. | 30 // inherit from FileSystemFileUtil. |
| 30 class WEBKIT_STORAGE_EXPORT_PRIVATE NativeFileUtil { | 31 class WEBKIT_STORAGE_EXPORT_PRIVATE NativeFileUtil { |
| 31 public: | 32 public: |
| 32 static base::PlatformFileError CreateOrOpen( | 33 static base::PlatformFileError CreateOrOpen( |
| 33 const base::FilePath& path, | 34 const base::FilePath& path, |
| 34 int file_flags, | 35 int file_flags, |
| 35 base::PlatformFile* file_handle, | 36 base::PlatformFile* file_handle, |
| 36 bool* created); | 37 bool* created); |
| 37 static base::PlatformFileError Close(base::PlatformFile file); | 38 static base::PlatformFileError Close(base::PlatformFile file); |
| 38 static base::PlatformFileError EnsureFileExists(const base::FilePath& path, | 39 static base::PlatformFileError EnsureFileExists(const base::FilePath& path, |
| 39 bool* created); | 40 bool* created); |
| 40 static base::PlatformFileError CreateDirectory(const base::FilePath& path, | 41 static base::PlatformFileError CreateDirectory(const base::FilePath& path, |
| 41 bool exclusive, | 42 bool exclusive, |
| 42 bool recursive); | 43 bool recursive); |
| 43 static base::PlatformFileError GetFileInfo(const base::FilePath& path, | 44 static base::PlatformFileError GetFileInfo(const base::FilePath& path, |
| 44 base::PlatformFileInfo* file_info); | 45 base::PlatformFileInfo* file_info); |
| 45 static scoped_ptr<FileSystemFileUtil::AbstractFileEnumerator> | 46 static scoped_ptr<FileSystemFileUtil::AbstractFileEnumerator> |
| 46 CreateFileEnumerator(const base::FilePath& root_path, | 47 CreateFileEnumerator(const base::FilePath& root_path, |
| 47 bool recursive); | 48 bool recursive); |
| 48 static base::PlatformFileError Touch(const base::FilePath& path, | 49 static base::PlatformFileError Touch(const base::FilePath& path, |
| 49 const base::Time& last_access_time, | 50 const base::Time& last_access_time, |
| 50 const base::Time& last_modified_time); | 51 const base::Time& last_modified_time); |
| 51 static base::PlatformFileError Truncate(const base::FilePath& path, int64 leng
th); | 52 static base::PlatformFileError Truncate(const base::FilePath& path, |
| 53 int64 length); |
| 52 static bool PathExists(const base::FilePath& path); | 54 static bool PathExists(const base::FilePath& path); |
| 53 static bool DirectoryExists(const base::FilePath& path); | 55 static bool DirectoryExists(const base::FilePath& path); |
| 54 static base::PlatformFileError CopyOrMoveFile(const base::FilePath& src_path, | 56 static base::PlatformFileError CopyOrMoveFile(const base::FilePath& src_path, |
| 55 const base::FilePath& dest_path, | 57 const base::FilePath& dest_path, |
| 56 bool copy); | 58 bool copy); |
| 57 static base::PlatformFileError DeleteFile(const base::FilePath& path); | 59 static base::PlatformFileError DeleteFile(const base::FilePath& path); |
| 58 static base::PlatformFileError DeleteDirectory(const base::FilePath& path); | 60 static base::PlatformFileError DeleteDirectory(const base::FilePath& path); |
| 59 | 61 |
| 60 private: | 62 private: |
| 61 DISALLOW_IMPLICIT_CONSTRUCTORS(NativeFileUtil); | 63 DISALLOW_IMPLICIT_CONSTRUCTORS(NativeFileUtil); |
| 62 }; | 64 }; |
| 63 | 65 |
| 64 } // namespace fileapi | 66 } // namespace fileapi |
| 65 | 67 |
| 66 #endif // WEBKIT_FILEAPI_NATIVE_FILE_UTIL_H_ | 68 #endif // WEBKIT_BROWSER_FILEAPI_NATIVE_FILE_UTIL_H_ |
| OLD | NEW |