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_OBFUSCATED_FILE_UTIL_H_ | 5 #ifndef WEBKIT_FILEAPI_OBFUSCATED_FILE_UTIL_H_ |
6 #define WEBKIT_FILEAPI_OBFUSCATED_FILE_UTIL_H_ | 6 #define WEBKIT_FILEAPI_OBFUSCATED_FILE_UTIL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/file_path.h" | 12 #include "base/file_path.h" |
13 #include "base/file_util_proxy.h" | 13 #include "base/file_util_proxy.h" |
14 #include "base/platform_file.h" | 14 #include "base/platform_file.h" |
15 #include "base/timer.h" | 15 #include "base/timer.h" |
| 16 #include "webkit/blob/shareable_file_reference.h" |
16 #include "webkit/fileapi/file_system_directory_database.h" | 17 #include "webkit/fileapi/file_system_directory_database.h" |
17 #include "webkit/fileapi/file_system_file_util.h" | 18 #include "webkit/fileapi/file_system_file_util.h" |
18 #include "webkit/fileapi/file_system_origin_database.h" | 19 #include "webkit/fileapi/file_system_origin_database.h" |
19 #include "webkit/fileapi/file_system_types.h" | 20 #include "webkit/fileapi/file_system_types.h" |
20 #include "webkit/fileapi/file_system_url.h" | 21 #include "webkit/fileapi/file_system_url.h" |
21 #include "webkit/fileapi/fileapi_export.h" | 22 #include "webkit/fileapi/fileapi_export.h" |
22 | 23 |
23 namespace base { | 24 namespace base { |
24 struct PlatformFileInfo; | 25 struct PlatformFileInfo; |
25 class Time; | 26 class Time; |
(...skipping 24 matching lines...) Expand all Loading... |
50 // Returns the next origin. Returns empty if there are no more origins. | 51 // Returns the next origin. Returns empty if there are no more origins. |
51 virtual GURL Next() = 0; | 52 virtual GURL Next() = 0; |
52 | 53 |
53 // Returns the current origin's information. | 54 // Returns the current origin's information. |
54 virtual bool HasFileSystemType(FileSystemType type) const = 0; | 55 virtual bool HasFileSystemType(FileSystemType type) const = 0; |
55 }; | 56 }; |
56 | 57 |
57 explicit ObfuscatedFileUtil(const FilePath& file_system_directory); | 58 explicit ObfuscatedFileUtil(const FilePath& file_system_directory); |
58 virtual ~ObfuscatedFileUtil(); | 59 virtual ~ObfuscatedFileUtil(); |
59 | 60 |
| 61 // FileSystemFileUtil overrides. |
60 virtual base::PlatformFileError CreateOrOpen( | 62 virtual base::PlatformFileError CreateOrOpen( |
61 FileSystemOperationContext* context, | 63 FileSystemOperationContext* context, |
62 const FileSystemURL& url, | 64 const FileSystemURL& url, |
63 int file_flags, | 65 int file_flags, |
64 base::PlatformFile* file_handle, | 66 base::PlatformFile* file_handle, |
65 bool* created) OVERRIDE; | 67 bool* created) OVERRIDE; |
66 | |
67 virtual PlatformFileError Close( | 68 virtual PlatformFileError Close( |
68 FileSystemOperationContext* context, | 69 FileSystemOperationContext* context, |
69 PlatformFile file) OVERRIDE; | 70 PlatformFile file) OVERRIDE; |
70 | |
71 virtual base::PlatformFileError EnsureFileExists( | 71 virtual base::PlatformFileError EnsureFileExists( |
72 FileSystemOperationContext* context, | 72 FileSystemOperationContext* context, |
73 const FileSystemURL& url, bool* created) OVERRIDE; | 73 const FileSystemURL& url, bool* created) OVERRIDE; |
74 | |
75 virtual base::PlatformFileError CreateDirectory( | 74 virtual base::PlatformFileError CreateDirectory( |
76 FileSystemOperationContext* context, | 75 FileSystemOperationContext* context, |
77 const FileSystemURL& url, | 76 const FileSystemURL& url, |
78 bool exclusive, | 77 bool exclusive, |
79 bool recursive) OVERRIDE; | 78 bool recursive) OVERRIDE; |
80 | |
81 virtual base::PlatformFileError GetFileInfo( | 79 virtual base::PlatformFileError GetFileInfo( |
82 FileSystemOperationContext* context, | 80 FileSystemOperationContext* context, |
83 const FileSystemURL& url, | 81 const FileSystemURL& url, |
84 base::PlatformFileInfo* file_info, | 82 base::PlatformFileInfo* file_info, |
85 FilePath* platform_file) OVERRIDE; | 83 FilePath* platform_file) OVERRIDE; |
86 | |
87 virtual AbstractFileEnumerator* CreateFileEnumerator( | 84 virtual AbstractFileEnumerator* CreateFileEnumerator( |
88 FileSystemOperationContext* context, | 85 FileSystemOperationContext* context, |
89 const FileSystemURL& root_url, | 86 const FileSystemURL& root_url, |
90 bool recursive) OVERRIDE; | 87 bool recursive) OVERRIDE; |
91 | |
92 virtual base::PlatformFileError GetLocalFilePath( | 88 virtual base::PlatformFileError GetLocalFilePath( |
93 FileSystemOperationContext* context, | 89 FileSystemOperationContext* context, |
94 const FileSystemURL& file_system_url, | 90 const FileSystemURL& file_system_url, |
95 FilePath* local_path) OVERRIDE; | 91 FilePath* local_path) OVERRIDE; |
96 | |
97 virtual base::PlatformFileError Touch( | 92 virtual base::PlatformFileError Touch( |
98 FileSystemOperationContext* context, | 93 FileSystemOperationContext* context, |
99 const FileSystemURL& url, | 94 const FileSystemURL& url, |
100 const base::Time& last_access_time, | 95 const base::Time& last_access_time, |
101 const base::Time& last_modified_time) OVERRIDE; | 96 const base::Time& last_modified_time) OVERRIDE; |
102 | |
103 virtual base::PlatformFileError Truncate( | 97 virtual base::PlatformFileError Truncate( |
104 FileSystemOperationContext* context, | 98 FileSystemOperationContext* context, |
105 const FileSystemURL& url, | 99 const FileSystemURL& url, |
106 int64 length) OVERRIDE; | 100 int64 length) OVERRIDE; |
107 | |
108 virtual bool PathExists( | 101 virtual bool PathExists( |
109 FileSystemOperationContext* context, | 102 FileSystemOperationContext* context, |
110 const FileSystemURL& url) OVERRIDE; | 103 const FileSystemURL& url) OVERRIDE; |
111 | |
112 virtual bool DirectoryExists( | 104 virtual bool DirectoryExists( |
113 FileSystemOperationContext* context, | 105 FileSystemOperationContext* context, |
114 const FileSystemURL& url) OVERRIDE; | 106 const FileSystemURL& url) OVERRIDE; |
115 | |
116 virtual bool IsDirectoryEmpty( | 107 virtual bool IsDirectoryEmpty( |
117 FileSystemOperationContext* context, | 108 FileSystemOperationContext* context, |
118 const FileSystemURL& url) OVERRIDE; | 109 const FileSystemURL& url) OVERRIDE; |
119 | |
120 virtual base::PlatformFileError CopyOrMoveFile( | 110 virtual base::PlatformFileError CopyOrMoveFile( |
121 FileSystemOperationContext* context, | 111 FileSystemOperationContext* context, |
122 const FileSystemURL& src_url, | 112 const FileSystemURL& src_url, |
123 const FileSystemURL& dest_url, | 113 const FileSystemURL& dest_url, |
124 bool copy) OVERRIDE; | 114 bool copy) OVERRIDE; |
125 | |
126 virtual PlatformFileError CopyInForeignFile( | 115 virtual PlatformFileError CopyInForeignFile( |
127 FileSystemOperationContext* context, | 116 FileSystemOperationContext* context, |
128 const FilePath& src_file_path, | 117 const FilePath& src_file_path, |
129 const FileSystemURL& dest_url) OVERRIDE; | 118 const FileSystemURL& dest_url) OVERRIDE; |
130 | |
131 virtual base::PlatformFileError DeleteFile( | 119 virtual base::PlatformFileError DeleteFile( |
132 FileSystemOperationContext* context, | 120 FileSystemOperationContext* context, |
133 const FileSystemURL& url) OVERRIDE; | 121 const FileSystemURL& url) OVERRIDE; |
134 | |
135 virtual base::PlatformFileError DeleteSingleDirectory( | 122 virtual base::PlatformFileError DeleteSingleDirectory( |
136 FileSystemOperationContext* context, | 123 FileSystemOperationContext* context, |
137 const FileSystemURL& url) OVERRIDE; | 124 const FileSystemURL& url) OVERRIDE; |
| 125 virtual scoped_refptr<webkit_blob::ShareableFileReference> |
| 126 CreateSnapshotFile(FileSystemOperationContext* context, |
| 127 const FileSystemURL& url, |
| 128 base::PlatformFileError* result, |
| 129 base::PlatformFileInfo* file_info, |
| 130 FilePath* platform_path) OVERRIDE; |
138 | 131 |
139 // Gets the topmost directory specific to this origin and type. This will | 132 // Gets the topmost directory specific to this origin and type. This will |
140 // contain both the directory database's files and all the backing file | 133 // contain both the directory database's files and all the backing file |
141 // subdirectories. | 134 // subdirectories. |
142 // Returns an empty path if the directory is undefined (e.g. because |type| | 135 // Returns an empty path if the directory is undefined (e.g. because |type| |
143 // is invalid). If the directory is defined, it will be returned, even if | 136 // is invalid). If the directory is defined, it will be returned, even if |
144 // there is a file system error (e.g. the directory doesn't exist on disk and | 137 // there is a file system error (e.g. the directory doesn't exist on disk and |
145 // |create| is false). Callers should always check |error_code| to make sure | 138 // |create| is false). Callers should always check |error_code| to make sure |
146 // the returned path is usable. | 139 // the returned path is usable. |
147 FilePath GetDirectoryForOriginAndType( | 140 FilePath GetDirectoryForOriginAndType( |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 scoped_ptr<FileSystemOriginDatabase> origin_database_; | 257 scoped_ptr<FileSystemOriginDatabase> origin_database_; |
265 FilePath file_system_directory_; | 258 FilePath file_system_directory_; |
266 base::OneShotTimer<ObfuscatedFileUtil> timer_; | 259 base::OneShotTimer<ObfuscatedFileUtil> timer_; |
267 | 260 |
268 DISALLOW_COPY_AND_ASSIGN(ObfuscatedFileUtil); | 261 DISALLOW_COPY_AND_ASSIGN(ObfuscatedFileUtil); |
269 }; | 262 }; |
270 | 263 |
271 } // namespace fileapi | 264 } // namespace fileapi |
272 | 265 |
273 #endif // WEBKIT_FILEAPI_OBFUSCATED_FILE_UTIL_H_ | 266 #endif // WEBKIT_FILEAPI_OBFUSCATED_FILE_UTIL_H_ |
OLD | NEW |