| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef WEBKIT_FILEAPI_FILE_SYSTEM_FILE_UTIL_BASE_H_ |
| 6 #define WEBKIT_FILEAPI_FILE_SYSTEM_FILE_UTIL_BASE_H_ |
| 7 |
| 8 #include "base/file_util.h" |
| 9 #include "base/file_util_proxy.h" |
| 10 #include "base/scoped_ptr.h" |
| 11 #include "base/singleton.h" |
| 12 #include "webkit/fileapi/file_system_operation_context.h" |
| 13 |
| 14 namespace fileapi { |
| 15 |
| 16 class FileSystemFileUtilBase { |
| 17 public: |
| 18 static FileSystemFileUtilBase* GetInstance(); |
| 19 virtual ~FileSystemFileUtilBase() {} |
| 20 |
| 21 virtual base::PlatformFileError CreateOrOpen( |
| 22 FileSystemOperationContext* fs_context, |
| 23 const FilePath& file_path, |
| 24 int file_flags, |
| 25 base::PlatformFile& file_handle, |
| 26 bool& created); |
| 27 |
| 28 virtual base::PlatformFileError CreateTemporary( |
| 29 FileSystemOperationContext* fs_context, |
| 30 FilePath& file_path, |
| 31 base::PlatformFile& file_handle); |
| 32 |
| 33 virtual base::PlatformFileError Close( |
| 34 FileSystemOperationContext* fs_context, |
| 35 base::PlatformFile file_handle); |
| 36 |
| 37 virtual base::PlatformFileError EnsureFileExists( |
| 38 FileSystemOperationContext* fs_context, |
| 39 const FilePath& file_path, |
| 40 bool* created); |
| 41 |
| 42 virtual base::PlatformFileError Delete( |
| 43 FileSystemOperationContext* fs_context, |
| 44 const FilePath& file_path, |
| 45 bool recursive); |
| 46 |
| 47 virtual base::PlatformFileError Copy( |
| 48 FileSystemOperationContext* fs_context, |
| 49 const FilePath& src_file_path, |
| 50 const FilePath& dest_file_path); |
| 51 |
| 52 virtual base::PlatformFileError Move( |
| 53 FileSystemOperationContext* fs_context, |
| 54 const FilePath& src_file_path, |
| 55 const FilePath& dest_file_path); |
| 56 |
| 57 virtual base::PlatformFileError CreateDirectory( |
| 58 FileSystemOperationContext* fs_context, |
| 59 const FilePath& file_path, |
| 60 bool exclusive, |
| 61 bool recursive); |
| 62 |
| 63 virtual base::PlatformFileError ReadDirectory( |
| 64 FileSystemOperationContext* fs_context, |
| 65 const FilePath& file_path, |
| 66 std::vector<base::FileUtilProxy::Entry>& entries); |
| 67 |
| 68 virtual base::PlatformFileError GetFileInfo( |
| 69 FileSystemOperationContext* fs_context, |
| 70 const FilePath& file_path, |
| 71 base::PlatformFileInfo& file_info); |
| 72 |
| 73 virtual base::PlatformFileError GetFileInfoFromPlatformFile( |
| 74 FileSystemOperationContext* fs_context, |
| 75 base::PlatformFile file, |
| 76 base::PlatformFileInfo& file_info); |
| 77 |
| 78 virtual base::PlatformFileError Read( |
| 79 FileSystemOperationContext* fs_context, |
| 80 base::PlatformFile file, |
| 81 int64 offset, |
| 82 int bytes_to_read, |
| 83 int& bytes_read, |
| 84 char* buffer); |
| 85 |
| 86 virtual base::PlatformFileError Write( |
| 87 FileSystemOperationContext* fs_context, |
| 88 base::PlatformFile file, |
| 89 int64 offset, |
| 90 int bytes_to_write, |
| 91 int& bytes_written, |
| 92 char* buffer); |
| 93 |
| 94 virtual base::PlatformFileError Touch( |
| 95 FileSystemOperationContext* fs_context, |
| 96 base::PlatformFile file, |
| 97 const base::Time& last_access_time, |
| 98 const base::Time& last_modified_time); |
| 99 |
| 100 virtual base::PlatformFileError TouchFilePath( |
| 101 FileSystemOperationContext* fs_context, |
| 102 const FilePath& file_path, |
| 103 const base::Time& last_access_time, |
| 104 const base::Time& last_modified_time); |
| 105 |
| 106 virtual base::PlatformFileError TruncatePlatformFile( |
| 107 FileSystemOperationContext* fs_context, |
| 108 base::PlatformFile file, |
| 109 int64 length); |
| 110 |
| 111 virtual base::PlatformFileError Truncate( |
| 112 FileSystemOperationContext* fs_context, |
| 113 const FilePath& path, |
| 114 int64 length); |
| 115 |
| 116 virtual base::PlatformFileError Flush( |
| 117 FileSystemOperationContext* fs_context, |
| 118 base::PlatformFile file); |
| 119 |
| 120 protected: |
| 121 FileSystemFileUtilBase() {} |
| 122 |
| 123 private: |
| 124 friend struct DefaultSingletonTraits<FileSystemFileUtilBase>; |
| 125 DISALLOW_COPY_AND_ASSIGN(FileSystemFileUtilBase); |
| 126 }; |
| 127 |
| 128 } // namespace fileapi |
| 129 |
| 130 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_FILE_UTIL_BASE_H_ |
| OLD | NEW |