| Index: storage/browser/fileapi/obfuscated_file_util.h
|
| diff --git a/webkit/browser/fileapi/obfuscated_file_util.h b/storage/browser/fileapi/obfuscated_file_util.h
|
| similarity index 65%
|
| rename from webkit/browser/fileapi/obfuscated_file_util.h
|
| rename to storage/browser/fileapi/obfuscated_file_util.h
|
| index ada4e6f955af91c8db509e0fb2fbaafea63c29fc..ab46fc5f81a1cfb8b2d5e70600121240171d3c7e 100644
|
| --- a/webkit/browser/fileapi/obfuscated_file_util.h
|
| +++ b/storage/browser/fileapi/obfuscated_file_util.h
|
| @@ -16,13 +16,13 @@
|
| #include "base/files/file_util_proxy.h"
|
| #include "base/gtest_prod_util.h"
|
| #include "base/memory/scoped_ptr.h"
|
| -#include "webkit/browser/fileapi/file_system_file_util.h"
|
| -#include "webkit/browser/fileapi/file_system_url.h"
|
| -#include "webkit/browser/fileapi/sandbox_directory_database.h"
|
| -#include "webkit/browser/fileapi/sandbox_file_system_backend_delegate.h"
|
| -#include "webkit/browser/webkit_storage_browser_export.h"
|
| -#include "webkit/common/blob/shareable_file_reference.h"
|
| -#include "webkit/common/fileapi/file_system_types.h"
|
| +#include "storage/browser/fileapi/file_system_file_util.h"
|
| +#include "storage/browser/fileapi/file_system_url.h"
|
| +#include "storage/browser/fileapi/sandbox_directory_database.h"
|
| +#include "storage/browser/fileapi/sandbox_file_system_backend_delegate.h"
|
| +#include "storage/common/storage_export.h"
|
| +#include "storage/common/blob/shareable_file_reference.h"
|
| +#include "storage/common/fileapi/file_system_types.h"
|
|
|
| namespace base {
|
| class SequencedTaskRunner;
|
| @@ -40,7 +40,7 @@ class SpecialStoragePolicy;
|
|
|
| class GURL;
|
|
|
| -namespace fileapi {
|
| +namespace storage {
|
|
|
| class FileSystemOperationContext;
|
| class SandboxOriginDatabaseInterface;
|
| @@ -69,8 +69,7 @@ class TimedTaskHelper;
|
| //
|
| // This class must be deleted on the FILE thread, because that's where
|
| // DropDatabases needs to be called.
|
| -class WEBKIT_STORAGE_BROWSER_EXPORT_PRIVATE ObfuscatedFileUtil
|
| - : public FileSystemFileUtil {
|
| +class STORAGE_EXPORT_PRIVATE ObfuscatedFileUtil : public FileSystemFileUtil {
|
| public:
|
| // Origin enumerator interface.
|
| // An instance of this interface is assumed to be called on the file thread.
|
| @@ -101,34 +100,31 @@ class WEBKIT_STORAGE_BROWSER_EXPORT_PRIVATE ObfuscatedFileUtil
|
| // for any known type exists the origin directory may get deleted when
|
| // one origin/type pair is deleted.
|
| //
|
| - ObfuscatedFileUtil(
|
| - quota::SpecialStoragePolicy* special_storage_policy,
|
| - const base::FilePath& file_system_directory,
|
| - leveldb::Env* env_override,
|
| - base::SequencedTaskRunner* file_task_runner,
|
| - const GetTypeStringForURLCallback& get_type_string_for_url,
|
| - const std::set<std::string>& known_type_strings,
|
| - SandboxFileSystemBackendDelegate* sandbox_delegate);
|
| + ObfuscatedFileUtil(quota::SpecialStoragePolicy* special_storage_policy,
|
| + const base::FilePath& file_system_directory,
|
| + leveldb::Env* env_override,
|
| + base::SequencedTaskRunner* file_task_runner,
|
| + const GetTypeStringForURLCallback& get_type_string_for_url,
|
| + const std::set<std::string>& known_type_strings,
|
| + SandboxFileSystemBackendDelegate* sandbox_delegate);
|
| virtual ~ObfuscatedFileUtil();
|
|
|
| // FileSystemFileUtil overrides.
|
| - virtual base::File CreateOrOpen(
|
| - FileSystemOperationContext* context,
|
| - const FileSystemURL& url,
|
| - int file_flags) OVERRIDE;
|
| + virtual base::File CreateOrOpen(FileSystemOperationContext* context,
|
| + const FileSystemURL& url,
|
| + int file_flags) OVERRIDE;
|
| virtual base::File::Error EnsureFileExists(
|
| FileSystemOperationContext* context,
|
| - const FileSystemURL& url, bool* created) OVERRIDE;
|
| - virtual base::File::Error CreateDirectory(
|
| - FileSystemOperationContext* context,
|
| const FileSystemURL& url,
|
| - bool exclusive,
|
| - bool recursive) OVERRIDE;
|
| - virtual base::File::Error GetFileInfo(
|
| - FileSystemOperationContext* context,
|
| - const FileSystemURL& url,
|
| - base::File::Info* file_info,
|
| - base::FilePath* platform_file) OVERRIDE;
|
| + bool* created) OVERRIDE;
|
| + virtual base::File::Error CreateDirectory(FileSystemOperationContext* context,
|
| + const FileSystemURL& url,
|
| + bool exclusive,
|
| + bool recursive) OVERRIDE;
|
| + virtual base::File::Error GetFileInfo(FileSystemOperationContext* context,
|
| + const FileSystemURL& url,
|
| + base::File::Info* file_info,
|
| + base::FilePath* platform_file) OVERRIDE;
|
| virtual scoped_ptr<AbstractFileEnumerator> CreateFileEnumerator(
|
| FileSystemOperationContext* context,
|
| const FileSystemURL& root_url) OVERRIDE;
|
| @@ -141,27 +137,23 @@ class WEBKIT_STORAGE_BROWSER_EXPORT_PRIVATE ObfuscatedFileUtil
|
| const FileSystemURL& url,
|
| const base::Time& last_access_time,
|
| const base::Time& last_modified_time) OVERRIDE;
|
| - virtual base::File::Error Truncate(
|
| - FileSystemOperationContext* context,
|
| - const FileSystemURL& url,
|
| - int64 length) OVERRIDE;
|
| - virtual base::File::Error CopyOrMoveFile(
|
| - FileSystemOperationContext* context,
|
| - const FileSystemURL& src_url,
|
| - const FileSystemURL& dest_url,
|
| - CopyOrMoveOption option,
|
| - bool copy) OVERRIDE;
|
| + virtual base::File::Error Truncate(FileSystemOperationContext* context,
|
| + const FileSystemURL& url,
|
| + int64 length) OVERRIDE;
|
| + virtual base::File::Error CopyOrMoveFile(FileSystemOperationContext* context,
|
| + const FileSystemURL& src_url,
|
| + const FileSystemURL& dest_url,
|
| + CopyOrMoveOption option,
|
| + bool copy) OVERRIDE;
|
| virtual base::File::Error CopyInForeignFile(
|
| - FileSystemOperationContext* context,
|
| - const base::FilePath& src_file_path,
|
| - const FileSystemURL& dest_url) OVERRIDE;
|
| - virtual base::File::Error DeleteFile(
|
| - FileSystemOperationContext* context,
|
| - const FileSystemURL& url) OVERRIDE;
|
| - virtual base::File::Error DeleteDirectory(
|
| FileSystemOperationContext* context,
|
| - const FileSystemURL& url) OVERRIDE;
|
| - virtual webkit_blob::ScopedFile CreateSnapshotFile(
|
| + const base::FilePath& src_file_path,
|
| + const FileSystemURL& dest_url) OVERRIDE;
|
| + virtual base::File::Error DeleteFile(FileSystemOperationContext* context,
|
| + const FileSystemURL& url) OVERRIDE;
|
| + virtual base::File::Error DeleteDirectory(FileSystemOperationContext* context,
|
| + const FileSystemURL& url) OVERRIDE;
|
| + virtual storage::ScopedFile CreateSnapshotFile(
|
| FileSystemOperationContext* context,
|
| const FileSystemURL& url,
|
| base::File::Error* error,
|
| @@ -175,9 +167,8 @@ class WEBKIT_STORAGE_BROWSER_EXPORT_PRIVATE ObfuscatedFileUtil
|
| bool recursive);
|
|
|
| // Returns true if the directory |url| is empty.
|
| - bool IsDirectoryEmpty(
|
| - FileSystemOperationContext* context,
|
| - const FileSystemURL& url);
|
| + bool IsDirectoryEmpty(FileSystemOperationContext* context,
|
| + const FileSystemURL& url);
|
|
|
| // Gets the topmost directory specific to this origin and type. This will
|
| // contain both the directory database's files and all the backing file
|
| @@ -188,18 +179,16 @@ class WEBKIT_STORAGE_BROWSER_EXPORT_PRIVATE ObfuscatedFileUtil
|
| // there is a file system error (e.g. the directory doesn't exist on disk and
|
| // |create| is false). Callers should always check |error_code| to make sure
|
| // the returned path is usable.
|
| - base::FilePath GetDirectoryForOriginAndType(
|
| - const GURL& origin,
|
| - const std::string& type_string,
|
| - bool create,
|
| - base::File::Error* error_code);
|
| + base::FilePath GetDirectoryForOriginAndType(const GURL& origin,
|
| + const std::string& type_string,
|
| + bool create,
|
| + base::File::Error* error_code);
|
|
|
| // Deletes the topmost directory specific to this origin and type. This will
|
| // delete its directory database.
|
| // Deletes the topmost origin directory if |type_string| is empty.
|
| - bool DeleteDirectoryForOriginAndType(
|
| - const GURL& origin,
|
| - const std::string& type_string);
|
| + bool DeleteDirectoryForOriginAndType(const GURL& origin,
|
| + const std::string& type_string);
|
|
|
| // This method and all methods of its returned class must be called only on
|
| // the FILE thread. The caller is responsible for deleting the returned
|
| @@ -242,56 +231,50 @@ class WEBKIT_STORAGE_BROWSER_EXPORT_PRIVATE ObfuscatedFileUtil
|
| leveldb::Env* env_override,
|
| base::SequencedTaskRunner* file_task_runner);
|
|
|
| - base::FilePath GetDirectoryForURL(
|
| - const FileSystemURL& url,
|
| - bool create,
|
| - base::File::Error* error_code);
|
| + base::FilePath GetDirectoryForURL(const FileSystemURL& url,
|
| + bool create,
|
| + base::File::Error* error_code);
|
|
|
| // This just calls get_type_string_for_url_ callback that is given in ctor.
|
| std::string CallGetTypeStringForURL(const FileSystemURL& url);
|
|
|
| - base::File::Error GetFileInfoInternal(
|
| - SandboxDirectoryDatabase* db,
|
| - FileSystemOperationContext* context,
|
| - const FileSystemURL& url,
|
| - FileId file_id,
|
| - FileInfo* local_info,
|
| - base::File::Info* file_info,
|
| - base::FilePath* platform_file_path);
|
| + base::File::Error GetFileInfoInternal(SandboxDirectoryDatabase* db,
|
| + FileSystemOperationContext* context,
|
| + const FileSystemURL& url,
|
| + FileId file_id,
|
| + FileInfo* local_info,
|
| + base::File::Info* file_info,
|
| + base::FilePath* platform_file_path);
|
|
|
| // Creates a new file, both the underlying backing file and the entry in the
|
| // database. |dest_file_info| is an in-out parameter. Supply the name and
|
| // parent_id; data_path is ignored. On success, data_path will
|
| // always be set to the relative path [from the root of the type-specific
|
| // filesystem directory] of a NEW backing file. Returns the new file.
|
| - base::File CreateAndOpenFile(
|
| - FileSystemOperationContext* context,
|
| - const FileSystemURL& dest_url,
|
| - FileInfo* dest_file_info,
|
| - int file_flags);
|
| + base::File CreateAndOpenFile(FileSystemOperationContext* context,
|
| + const FileSystemURL& dest_url,
|
| + FileInfo* dest_file_info,
|
| + int file_flags);
|
|
|
| // The same as CreateAndOpenFile except that a file is not returned and if a
|
| // path is provided in |source_path|, it will be used as a source from which
|
| // to COPY data.
|
| - base::File::Error CreateFile(
|
| - FileSystemOperationContext* context,
|
| - const base::FilePath& source_file_path,
|
| - const FileSystemURL& dest_url,
|
| - FileInfo* dest_file_info);
|
| + base::File::Error CreateFile(FileSystemOperationContext* context,
|
| + const base::FilePath& source_file_path,
|
| + const FileSystemURL& dest_url,
|
| + FileInfo* dest_file_info);
|
|
|
| // Updates |db| and |dest_file_info| at the end of creating a new file.
|
| - base::File::Error CommitCreateFile(
|
| - const base::FilePath& root,
|
| - const base::FilePath& local_path,
|
| - SandboxDirectoryDatabase* db,
|
| - FileInfo* dest_file_info);
|
| + base::File::Error CommitCreateFile(const base::FilePath& root,
|
| + const base::FilePath& local_path,
|
| + SandboxDirectoryDatabase* db,
|
| + FileInfo* dest_file_info);
|
|
|
| // This converts from a relative path [as is stored in the FileInfo.data_path
|
| // field] to an absolute platform path that can be given to the native
|
| // filesystem.
|
| - base::FilePath DataPathToLocalPath(
|
| - const FileSystemURL& url,
|
| - const base::FilePath& data_file_path);
|
| + base::FilePath DataPathToLocalPath(const FileSystemURL& url,
|
| + const base::FilePath& data_file_path);
|
|
|
| std::string GetDirectoryDatabaseKey(const GURL& origin,
|
| const std::string& type_string);
|
| @@ -319,17 +302,15 @@ class WEBKIT_STORAGE_BROWSER_EXPORT_PRIVATE ObfuscatedFileUtil
|
| // for initializing database if it's not empty.
|
| bool InitOriginDatabase(const GURL& origin_hint, bool create);
|
|
|
| - base::File::Error GenerateNewLocalPath(
|
| - SandboxDirectoryDatabase* db,
|
| - FileSystemOperationContext* context,
|
| - const FileSystemURL& url,
|
| - base::FilePath* root,
|
| - base::FilePath* local_path);
|
| + base::File::Error GenerateNewLocalPath(SandboxDirectoryDatabase* db,
|
| + FileSystemOperationContext* context,
|
| + const FileSystemURL& url,
|
| + base::FilePath* root,
|
| + base::FilePath* local_path);
|
|
|
| - base::File CreateOrOpenInternal(
|
| - FileSystemOperationContext* context,
|
| - const FileSystemURL& url,
|
| - int file_flags);
|
| + base::File CreateOrOpenInternal(FileSystemOperationContext* context,
|
| + const FileSystemURL& url,
|
| + int file_flags);
|
|
|
| bool HasIsolatedStorage(const GURL& origin);
|
|
|
| @@ -355,6 +336,6 @@ class WEBKIT_STORAGE_BROWSER_EXPORT_PRIVATE ObfuscatedFileUtil
|
| DISALLOW_COPY_AND_ASSIGN(ObfuscatedFileUtil);
|
| };
|
|
|
| -} // namespace fileapi
|
| +} // namespace storage
|
|
|
| #endif // WEBKIT_BROWSER_FILEAPI_OBFUSCATED_FILE_UTIL_H_
|
|
|