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_LOCAL_FILE_UTIL_H_ | 5 #ifndef WEBKIT_FILEAPI_LOCAL_FILE_UTIL_H_ |
6 #define WEBKIT_FILEAPI_LOCAL_FILE_UTIL_H_ | 6 #define WEBKIT_FILEAPI_LOCAL_FILE_UTIL_H_ |
7 | 7 |
8 #include <vector> | |
9 | |
10 #include "base/callback_forward.h" | |
11 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
12 #include "base/file_path.h" | |
13 #include "base/file_util.h" | |
14 #include "base/file_util_proxy.h" | |
15 #include "base/logging.h" | |
16 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
17 #include "base/platform_file.h" | 10 #include "base/platform_file.h" |
18 #include "webkit/blob/shareable_file_reference.h" | |
19 #include "webkit/fileapi/file_system_file_util.h" | 11 #include "webkit/fileapi/file_system_file_util.h" |
20 #include "webkit/fileapi/file_system_types.h" | |
21 #include "webkit/storage/webkit_storage_export.h" | 12 #include "webkit/storage/webkit_storage_export.h" |
22 | 13 |
23 namespace base { | 14 namespace base { |
24 struct PlatformFileInfo; | |
25 class Time; | 15 class Time; |
26 } | 16 } |
27 | 17 |
| 18 class FilePath; |
28 class GURL; | 19 class GURL; |
29 | 20 |
30 namespace fileapi { | 21 namespace fileapi { |
31 | 22 |
32 using base::PlatformFile; | |
33 using base::PlatformFileError; | |
34 | |
35 class FileSystemOperationContext; | 23 class FileSystemOperationContext; |
36 class FileSystemURL; | 24 class FileSystemURL; |
37 | 25 |
38 // An instance of this class is created and owned by *MountPointProvider. | 26 // An instance of this class is created and owned by *MountPointProvider. |
39 class WEBKIT_STORAGE_EXPORT_PRIVATE LocalFileUtil : public FileSystemFileUtil { | 27 class WEBKIT_STORAGE_EXPORT_PRIVATE LocalFileUtil : public FileSystemFileUtil { |
40 public: | 28 public: |
41 LocalFileUtil(); | 29 LocalFileUtil(); |
42 virtual ~LocalFileUtil(); | 30 virtual ~LocalFileUtil(); |
43 | 31 |
44 virtual PlatformFileError CreateOrOpen( | 32 virtual base::PlatformFileError CreateOrOpen( |
45 FileSystemOperationContext* context, | 33 FileSystemOperationContext* context, |
46 const FileSystemURL& url, | 34 const FileSystemURL& url, |
47 int file_flags, | 35 int file_flags, |
48 PlatformFile* file_handle, | 36 base::PlatformFile* file_handle, |
49 bool* created) OVERRIDE; | 37 bool* created) OVERRIDE; |
50 virtual PlatformFileError Close( | 38 virtual base::PlatformFileError Close( |
51 FileSystemOperationContext* context, | 39 FileSystemOperationContext* context, |
52 PlatformFile file) OVERRIDE; | 40 base::PlatformFile file) OVERRIDE; |
53 virtual PlatformFileError EnsureFileExists( | 41 virtual base::PlatformFileError EnsureFileExists( |
54 FileSystemOperationContext* context, | 42 FileSystemOperationContext* context, |
55 const FileSystemURL& url, bool* created) OVERRIDE; | 43 const FileSystemURL& url, bool* created) OVERRIDE; |
56 virtual PlatformFileError CreateDirectory( | 44 virtual base::PlatformFileError CreateDirectory( |
57 FileSystemOperationContext* context, | 45 FileSystemOperationContext* context, |
58 const FileSystemURL& url, | 46 const FileSystemURL& url, |
59 bool exclusive, | 47 bool exclusive, |
60 bool recursive) OVERRIDE; | 48 bool recursive) OVERRIDE; |
61 virtual PlatformFileError GetFileInfo( | 49 virtual base::PlatformFileError GetFileInfo( |
62 FileSystemOperationContext* context, | 50 FileSystemOperationContext* context, |
63 const FileSystemURL& url, | 51 const FileSystemURL& url, |
64 base::PlatformFileInfo* file_info, | 52 base::PlatformFileInfo* file_info, |
65 FilePath* platform_file) OVERRIDE; | 53 FilePath* platform_file) OVERRIDE; |
66 virtual scoped_ptr<AbstractFileEnumerator> CreateFileEnumerator( | 54 virtual scoped_ptr<AbstractFileEnumerator> CreateFileEnumerator( |
67 FileSystemOperationContext* context, | 55 FileSystemOperationContext* context, |
68 const FileSystemURL& root_url, | 56 const FileSystemURL& root_url, |
69 bool recursive) OVERRIDE; | 57 bool recursive) OVERRIDE; |
70 virtual PlatformFileError GetLocalFilePath( | 58 virtual base::PlatformFileError GetLocalFilePath( |
71 FileSystemOperationContext* context, | 59 FileSystemOperationContext* context, |
72 const FileSystemURL& file_system_url, | 60 const FileSystemURL& file_system_url, |
73 FilePath* local_file_path) OVERRIDE; | 61 FilePath* local_file_path) OVERRIDE; |
74 virtual PlatformFileError Touch( | 62 virtual base::PlatformFileError Touch( |
75 FileSystemOperationContext* context, | 63 FileSystemOperationContext* context, |
76 const FileSystemURL& url, | 64 const FileSystemURL& url, |
77 const base::Time& last_access_time, | 65 const base::Time& last_access_time, |
78 const base::Time& last_modified_time) OVERRIDE; | 66 const base::Time& last_modified_time) OVERRIDE; |
79 virtual PlatformFileError Truncate( | 67 virtual base::PlatformFileError Truncate( |
80 FileSystemOperationContext* context, | 68 FileSystemOperationContext* context, |
81 const FileSystemURL& url, | 69 const FileSystemURL& url, |
82 int64 length) OVERRIDE; | 70 int64 length) OVERRIDE; |
83 virtual bool IsDirectoryEmpty( | 71 virtual bool IsDirectoryEmpty( |
84 FileSystemOperationContext* context, | 72 FileSystemOperationContext* context, |
85 const FileSystemURL& url) OVERRIDE; | 73 const FileSystemURL& url) OVERRIDE; |
86 virtual PlatformFileError CopyOrMoveFile( | 74 virtual base::PlatformFileError CopyOrMoveFile( |
87 FileSystemOperationContext* context, | 75 FileSystemOperationContext* context, |
88 const FileSystemURL& src_url, | 76 const FileSystemURL& src_url, |
89 const FileSystemURL& dest_url, | 77 const FileSystemURL& dest_url, |
90 bool copy) OVERRIDE; | 78 bool copy) OVERRIDE; |
91 virtual PlatformFileError CopyInForeignFile( | 79 virtual base::PlatformFileError CopyInForeignFile( |
92 FileSystemOperationContext* context, | 80 FileSystemOperationContext* context, |
93 const FilePath& src_file_path, | 81 const FilePath& src_file_path, |
94 const FileSystemURL& dest_url) OVERRIDE; | 82 const FileSystemURL& dest_url) OVERRIDE; |
95 virtual PlatformFileError DeleteFile( | 83 virtual base::PlatformFileError DeleteFile( |
96 FileSystemOperationContext* context, | 84 FileSystemOperationContext* context, |
97 const FileSystemURL& url) OVERRIDE; | 85 const FileSystemURL& url) OVERRIDE; |
98 virtual PlatformFileError DeleteSingleDirectory( | 86 virtual base::PlatformFileError DeleteSingleDirectory( |
99 FileSystemOperationContext* context, | 87 FileSystemOperationContext* context, |
100 const FileSystemURL& url) OVERRIDE; | 88 const FileSystemURL& url) OVERRIDE; |
101 virtual PlatformFileError CreateSnapshotFile( | 89 virtual base::PlatformFileError CreateSnapshotFile( |
102 FileSystemOperationContext* context, | 90 FileSystemOperationContext* context, |
103 const FileSystemURL& url, | 91 const FileSystemURL& url, |
104 base::PlatformFileInfo* file_info, | 92 base::PlatformFileInfo* file_info, |
105 FilePath* platform_path, | 93 FilePath* platform_path, |
106 SnapshotFilePolicy* snapshot_policy) OVERRIDE; | 94 SnapshotFilePolicy* snapshot_policy) OVERRIDE; |
107 | 95 |
108 private: | 96 private: |
109 // Given the filesystem url, produces a real, full local path for the | 97 // Given the filesystem url, produces a real, full local path for the |
110 // underlying filesystem (which is usually the native filesystem). | 98 // underlying filesystem (which is usually the native filesystem). |
111 FileSystemURL GetLocalPath( | 99 FileSystemURL GetLocalPath( |
112 FileSystemOperationContext* context, | 100 FileSystemOperationContext* context, |
113 const FileSystemURL& url); | 101 const FileSystemURL& url); |
114 | 102 |
115 DISALLOW_COPY_AND_ASSIGN(LocalFileUtil); | 103 DISALLOW_COPY_AND_ASSIGN(LocalFileUtil); |
116 }; | 104 }; |
117 | 105 |
118 } // namespace fileapi | 106 } // namespace fileapi |
119 | 107 |
120 #endif // WEBKIT_FILEAPI_LOCAL_FILE_UTIL_H_ | 108 #endif // WEBKIT_FILEAPI_LOCAL_FILE_UTIL_H_ |
OLD | NEW |