Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(27)

Side by Side Diff: webkit/fileapi/obfuscated_file_util.h

Issue 14885021: Cleanup: Prefix HTML5 Sandbox FileSystem related files with 'sandbox_' (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 10
11 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
12 #include "base/files/file_util_proxy.h" 12 #include "base/files/file_util_proxy.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.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/blob/shareable_file_reference.h"
17 #include "webkit/fileapi/file_system_directory_database.h"
18 #include "webkit/fileapi/file_system_file_util.h" 17 #include "webkit/fileapi/file_system_file_util.h"
19 #include "webkit/fileapi/file_system_origin_database.h"
20 #include "webkit/fileapi/file_system_types.h" 18 #include "webkit/fileapi/file_system_types.h"
21 #include "webkit/fileapi/file_system_url.h" 19 #include "webkit/fileapi/file_system_url.h"
20 #include "webkit/fileapi/sandbox_directory_database.h"
21 #include "webkit/fileapi/sandbox_origin_database.h"
22 #include "webkit/storage/webkit_storage_export.h" 22 #include "webkit/storage/webkit_storage_export.h"
23 23
24 namespace base { 24 namespace base {
25 class Time; 25 class Time;
26 } 26 }
27 27
28 class GURL; 28 class GURL;
29 29
30 namespace fileapi { 30 namespace fileapi {
31 31
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 bool DestroyDirectoryDatabase(const GURL& origin, FileSystemType type); 164 bool DestroyDirectoryDatabase(const GURL& origin, FileSystemType type);
165 165
166 // Computes a cost for storing a given file in the obfuscated FSFU. 166 // Computes a cost for storing a given file in the obfuscated FSFU.
167 // As the cost of a file is independent of the cost of its parent directories, 167 // As the cost of a file is independent of the cost of its parent directories,
168 // this ignores all but the BaseName of the supplied path. In order to 168 // this ignores all but the BaseName of the supplied path. In order to
169 // compute the cost of adding a multi-segment directory recursively, call this 169 // compute the cost of adding a multi-segment directory recursively, call this
170 // on each path segment and add the results. 170 // on each path segment and add the results.
171 static int64 ComputeFilePathCost(const base::FilePath& path); 171 static int64 ComputeFilePathCost(const base::FilePath& path);
172 172
173 private: 173 private:
174 typedef FileSystemDirectoryDatabase::FileId FileId; 174 typedef SandboxDirectoryDatabase::FileId FileId;
175 typedef FileSystemDirectoryDatabase::FileInfo FileInfo; 175 typedef SandboxDirectoryDatabase::FileInfo FileInfo;
176 176
177 friend class ObfuscatedFileEnumerator; 177 friend class ObfuscatedFileEnumerator;
178 178
179 base::PlatformFileError GetFileInfoInternal( 179 base::PlatformFileError GetFileInfoInternal(
180 FileSystemDirectoryDatabase* db, 180 SandboxDirectoryDatabase* db,
181 FileSystemOperationContext* context, 181 FileSystemOperationContext* context,
182 const GURL& origin, 182 const GURL& origin,
183 FileSystemType type, 183 FileSystemType type,
184 FileId file_id, 184 FileId file_id,
185 FileInfo* local_info, 185 FileInfo* local_info,
186 base::PlatformFileInfo* file_info, 186 base::PlatformFileInfo* file_info,
187 base::FilePath* platform_file_path); 187 base::FilePath* platform_file_path);
188 188
189 // Creates a new file, both the underlying backing file and the entry in the 189 // Creates a new file, both the underlying backing file and the entry in the
190 // database. |dest_file_info| is an in-out parameter. Supply the name and 190 // database. |dest_file_info| is an in-out parameter. Supply the name and
(...skipping 19 matching lines...) Expand all
210 // field] to an absolute platform path that can be given to the native 210 // field] to an absolute platform path that can be given to the native
211 // filesystem. 211 // filesystem.
212 base::FilePath DataPathToLocalPath( 212 base::FilePath DataPathToLocalPath(
213 const GURL& origin, 213 const GURL& origin,
214 FileSystemType type, 214 FileSystemType type,
215 const base::FilePath& data_file_path); 215 const base::FilePath& data_file_path);
216 216
217 // This returns NULL if |create| flag is false and a filesystem does not 217 // This returns NULL if |create| flag is false and a filesystem does not
218 // exist for the given |origin_url| and |type|. 218 // exist for the given |origin_url| and |type|.
219 // For read operations |create| should be false. 219 // For read operations |create| should be false.
220 FileSystemDirectoryDatabase* GetDirectoryDatabase( 220 SandboxDirectoryDatabase* GetDirectoryDatabase(
221 const GURL& origin_url, FileSystemType type, bool create); 221 const GURL& origin_url, FileSystemType type, bool create);
222 222
223 // Gets the topmost directory specific to this origin. This will 223 // Gets the topmost directory specific to this origin. This will
224 // contain both the filesystem type subdirectories. 224 // contain both the filesystem type subdirectories.
225 base::FilePath GetDirectoryForOrigin(const GURL& origin, 225 base::FilePath GetDirectoryForOrigin(const GURL& origin,
226 bool create, 226 bool create,
227 base::PlatformFileError* error_code); 227 base::PlatformFileError* error_code);
228 228
229 void InvalidateUsageCache(FileSystemOperationContext* context, 229 void InvalidateUsageCache(FileSystemOperationContext* context,
230 const GURL& origin, 230 const GURL& origin,
231 FileSystemType type); 231 FileSystemType type);
232 232
233 void MarkUsed(); 233 void MarkUsed();
234 void DropDatabases(); 234 void DropDatabases();
235 bool InitOriginDatabase(bool create); 235 bool InitOriginDatabase(bool create);
236 236
237 base::PlatformFileError GenerateNewLocalPath( 237 base::PlatformFileError GenerateNewLocalPath(
238 FileSystemDirectoryDatabase* db, 238 SandboxDirectoryDatabase* db,
239 FileSystemOperationContext* context, 239 FileSystemOperationContext* context,
240 const GURL& origin, 240 const GURL& origin,
241 FileSystemType type, 241 FileSystemType type,
242 base::FilePath* local_path); 242 base::FilePath* local_path);
243 243
244 base::PlatformFileError CreateOrOpenInternal( 244 base::PlatformFileError CreateOrOpenInternal(
245 FileSystemOperationContext* context, 245 FileSystemOperationContext* context,
246 const FileSystemURL& url, 246 const FileSystemURL& url,
247 int file_flags, 247 int file_flags,
248 base::PlatformFile* file_handle, 248 base::PlatformFile* file_handle,
249 bool* created); 249 bool* created);
250 250
251 typedef std::map<std::string, FileSystemDirectoryDatabase*> DirectoryMap; 251 typedef std::map<std::string, SandboxDirectoryDatabase*> DirectoryMap;
252 DirectoryMap directories_; 252 DirectoryMap directories_;
253 scoped_ptr<FileSystemOriginDatabase> origin_database_; 253 scoped_ptr<SandboxOriginDatabase> origin_database_;
254 base::FilePath file_system_directory_; 254 base::FilePath file_system_directory_;
255 base::OneShotTimer<ObfuscatedFileUtil> timer_; 255 base::OneShotTimer<ObfuscatedFileUtil> timer_;
256 256
257 DISALLOW_COPY_AND_ASSIGN(ObfuscatedFileUtil); 257 DISALLOW_COPY_AND_ASSIGN(ObfuscatedFileUtil);
258 }; 258 };
259 259
260 } // namespace fileapi 260 } // namespace fileapi
261 261
262 #endif // WEBKIT_FILEAPI_OBFUSCATED_FILE_UTIL_H_ 262 #endif // WEBKIT_FILEAPI_OBFUSCATED_FILE_UTIL_H_
OLDNEW
« no previous file with comments | « webkit/fileapi/file_system_origin_database_unittest.cc ('k') | webkit/fileapi/obfuscated_file_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698