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_LOCAL_FILE_SYSTEM_FILE_UTIL_H_ |
| 6 #define WEBKIT_FILEAPI_LOCAL_FILE_SYSTEM_FILE_UTIL_H_ |
| 7 |
| 8 #include <vector> |
| 9 |
| 10 #include "base/callback.h" |
| 11 #include "base/file_path.h" |
| 12 #include "base/file_util.h" |
| 13 #include "base/file_util_proxy.h" |
| 14 #include "base/logging.h" |
| 15 #include "base/platform_file.h" |
| 16 #include "base/ref_counted.h" |
| 17 #include "base/singleton.h" |
| 18 #include "base/tracked_objects.h" |
| 19 #include "webkit/fileapi/file_system_file_util.h" |
| 20 #include "webkit/fileapi/file_system_types.h" |
| 21 |
| 22 namespace base { |
| 23 struct PlatformFileInfo; |
| 24 class MessageLoopProxy; |
| 25 class Time; |
| 26 } |
| 27 |
| 28 class GURL; |
| 29 |
| 30 namespace fileapi { |
| 31 |
| 32 using base::PlatformFile; |
| 33 using base::PlatformFileError; |
| 34 |
| 35 class FileSystemOperationContext; |
| 36 |
| 37 class LocalFileSystemFileUtil : public FileSystemFileUtil { |
| 38 public: |
| 39 static LocalFileSystemFileUtil* GetInstance(); |
| 40 |
| 41 virtual PlatformFileError CreateOrOpen( |
| 42 FileSystemOperationContext* context, |
| 43 const FilePath& file_path, |
| 44 int file_flags, |
| 45 PlatformFile* file_handle, |
| 46 bool* created); |
| 47 |
| 48 virtual PlatformFileError EnsureFileExists( |
| 49 FileSystemOperationContext* context, |
| 50 const FilePath& file_path, bool* created); |
| 51 |
| 52 virtual PlatformFileError GetFileInfo( |
| 53 FileSystemOperationContext* context, |
| 54 const FilePath& file_, base::PlatformFileInfo* file_info); |
| 55 |
| 56 virtual PlatformFileError ReadDirectory( |
| 57 FileSystemOperationContext* context, |
| 58 const FilePath& file_path, |
| 59 std::vector<base::FileUtilProxy::Entry>* entries); |
| 60 |
| 61 virtual PlatformFileError CreateDirectory( |
| 62 FileSystemOperationContext* context, |
| 63 const FilePath& file_path, |
| 64 bool exclusive, |
| 65 bool recursive); |
| 66 |
| 67 virtual PlatformFileError Copy( |
| 68 FileSystemOperationContext* context, |
| 69 const FilePath& src_file_path, |
| 70 const FilePath& dest_file_path); |
| 71 |
| 72 virtual PlatformFileError Move( |
| 73 FileSystemOperationContext* context, |
| 74 const FilePath& src_file_path, |
| 75 const FilePath& dest_file_path); |
| 76 |
| 77 virtual PlatformFileError Delete( |
| 78 FileSystemOperationContext* context, |
| 79 const FilePath& file_path, |
| 80 bool recursive); |
| 81 |
| 82 virtual PlatformFileError Touch( |
| 83 FileSystemOperationContext* context, |
| 84 const FilePath& file_path, |
| 85 const base::Time& last_access_time, |
| 86 const base::Time& last_modified_time); |
| 87 |
| 88 virtual PlatformFileError Truncate( |
| 89 FileSystemOperationContext* context, |
| 90 const FilePath& path, |
| 91 int64 length); |
| 92 |
| 93 protected: |
| 94 LocalFileSystemFileUtil() { } |
| 95 |
| 96 friend struct DefaultSingletonTraits<LocalFileSystemFileUtil>; |
| 97 DISALLOW_COPY_AND_ASSIGN(LocalFileSystemFileUtil); |
| 98 |
| 99 private: |
| 100 // Given the filesystem's root URL and a virtual path, produces a real, full |
| 101 // local path. |
| 102 FilePath GetLocalPath( |
| 103 FileSystemOperationContext* context, |
| 104 const GURL& origin_url, |
| 105 FileSystemType type, |
| 106 const FilePath& virtual_path); |
| 107 |
| 108 }; |
| 109 |
| 110 } // namespace fileapi |
| 111 |
| 112 #endif // WEBKIT_FILEAPI_LOCAL_FILE_SYSTEM_FILE_UTIL_H_ |
OLD | NEW |