Chromium Code Reviews| Index: webkit/fileapi/obfuscated_file_system_file_util.h |
| diff --git a/webkit/fileapi/obfuscated_file_system_file_util.h b/webkit/fileapi/obfuscated_file_system_file_util.h |
| index c6a4498e338c31619437fc1eb34610a78561e530..529899ea0e5d482f461067bad188f815b14a93d2 100644 |
| --- a/webkit/fileapi/obfuscated_file_system_file_util.h |
| +++ b/webkit/fileapi/obfuscated_file_system_file_util.h |
| @@ -41,6 +41,9 @@ class FileSystemOperationContext; |
| // SandboxMountPointProvider [and the task it uses to drop the reference] and |
| // SandboxMountPointProvider::GetFileSystemRootPathTask. Without that last one, |
| // we wouldn't need ref counting. |
| +// |
| +// TODO(ericu): We don't ever update directory mtimes; which operations should |
| +// do that? |
| class ObfuscatedFileSystemFileUtil : public FileSystemFileUtil, |
| public base::RefCountedThreadSafe<ObfuscatedFileSystemFileUtil> { |
| public: |
| @@ -131,6 +134,21 @@ class ObfuscatedFileSystemFileUtil : public FileSystemFileUtil, |
| // about migration; TODO(ericu): implement migration and fix these comments. |
| FilePath GetDirectoryForOrigin(const GURL& origin, bool create); |
| + // This will migrate a filesystem from the old passthrough sandbox into the |
| + // new obfuscated one. It won't obfuscate the old filenames [it will maintain |
| + // the old structure, but move it to a new root], but any new files created |
| + // will go into the new standard locations. This will be completely |
| + // transparent to the user. This migration is atomic in that it won't alter |
| + // the source data until it's done, and that will be with a single directory |
| + // move [the directory with the unguessable name will move into the new |
| + // filesystem storage directory]. However, if this fails partway through, it |
| + // might leave a seemingly-valid database for this origin. When it starts up, |
| + // it will clear any such database, just in case. |
| + bool MigrateFromOldSandbox( |
| + const GURL& origin, FileSystemType type, const FilePath& root); |
| + |
| + FilePath::StringType GetDirectoryNameForType(FileSystemType type) const; |
| + |
| protected: |
| virtual AbstractFileEnumerator* CreateFileEnumerator( |
| FileSystemOperationContext* context, |
| @@ -153,18 +171,29 @@ class ObfuscatedFileSystemFileUtil : public FileSystemFileUtil, |
| base::PlatformFileError CreateFile( |
| FileSystemOperationContext* context, |
| const GURL& origin_url, FileSystemType type, |
| - FileInfo* file_info, |
| + const FilePath& source_path, FileInfo* file_info, |
| int file_flags, base::PlatformFile* handle); |
| // Given the filesystem's root URL and a virtual path, produces a real, full |
| - // local path to the underlying data file. |
| + // local path to the underlying data file. This does a database lookup, and |
| + // verifies that the file exists. |
| FilePath GetLocalPath( |
| const GURL& origin_url, |
| FileSystemType type, |
| const FilePath& virtual_path); |
| + // This converts from a relative path [as is stored in the FileInfo.data_path |
| + // field] to an absolute local path that can be given to the operating system. |
| + // It does no checks as to whether the file actually exists; it's pure path |
| + // manipulation. |
| + FilePath DataPathToLocalPath( |
| + const GURL& origin, FileSystemType type, const FilePath& virtual_path); |
|
michaeln
2011/05/20 02:15:16
virtual_path s/b data_path in the arg list
ericu
2011/05/20 02:23:25
Done.
|
| + // This does the reverse of DataPathToLocalPath. |
| + FilePath LocalPathToDataPath( |
| + const GURL& origin, FileSystemType type, const FilePath& data_path); |
| FileSystemDirectoryDatabase* GetDirectoryDatabase( |
| const GURL& origin_url, FileSystemType type); |
| void MarkUsed(); |
| void DropDatabases(); |
| + bool DestroyDirectoryDatabase(const GURL& origin, FileSystemType type); |
| typedef std::map<std::string, FileSystemDirectoryDatabase*> DirectoryMap; |
| DirectoryMap directories_; |