diff options
12 files changed, 16 insertions, 92 deletions
diff --git a/chrome/browser/chromeos/fileapi/cros_mount_point_provider.cc b/chrome/browser/chromeos/fileapi/cros_mount_point_provider.cc index 82da083..3e78aa0 100644 --- a/chrome/browser/chromeos/fileapi/cros_mount_point_provider.cc +++ b/chrome/browser/chromeos/fileapi/cros_mount_point_provider.cc @@ -119,15 +119,6 @@ fileapi::FileSystemQuotaUtil* CrosMountPointProvider::GetQuotaUtil() { return NULL; } -void CrosMountPointProvider::DeleteFileSystem( - const GURL& origin_url, - fileapi::FileSystemType type, - fileapi::FileSystemContext* context, - const DeleteFileSystemCallback& callback) { - NOTREACHED(); - callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION); -} - bool CrosMountPointProvider::IsAccessAllowed( const fileapi::FileSystemURL& url) const { if (!url.is_valid()) diff --git a/chrome/browser/chromeos/fileapi/cros_mount_point_provider.h b/chrome/browser/chromeos/fileapi/cros_mount_point_provider.h index c68589d..daa1343 100644 --- a/chrome/browser/chromeos/fileapi/cros_mount_point_provider.h +++ b/chrome/browser/chromeos/fileapi/cros_mount_point_provider.h @@ -67,7 +67,6 @@ class CrosMountPointProvider : public fileapi::ExternalFileSystemMountPointProvider { public: using fileapi::FileSystemMountPointProvider::OpenFileSystemCallback; - using fileapi::FileSystemMountPointProvider::DeleteFileSystemCallback; // CrosMountPointProvider will take an ownership of a |mount_points| // reference. On the other hand, |system_mount_points| will be kept as a raw @@ -116,11 +115,6 @@ class CrosMountPointProvider int64 offset, fileapi::FileSystemContext* context) const OVERRIDE; virtual fileapi::FileSystemQuotaUtil* GetQuotaUtil() OVERRIDE; - virtual void DeleteFileSystem( - const GURL& origin_url, - fileapi::FileSystemType type, - fileapi::FileSystemContext* context, - const DeleteFileSystemCallback& callback) OVERRIDE; // fileapi::ExternalFileSystemMountPointProvider overrides. virtual bool IsAccessAllowed(const fileapi::FileSystemURL& url) diff --git a/chrome/browser/media_galleries/fileapi/media_file_system_mount_point_provider.cc b/chrome/browser/media_galleries/fileapi/media_file_system_mount_point_provider.cc index 7d65431..3512e97 100644 --- a/chrome/browser/media_galleries/fileapi/media_file_system_mount_point_provider.cc +++ b/chrome/browser/media_galleries/fileapi/media_file_system_mount_point_provider.cc @@ -208,13 +208,4 @@ MediaFileSystemMountPointProvider::GetQuotaUtil() { return NULL; } -void MediaFileSystemMountPointProvider::DeleteFileSystem( - const GURL& origin_url, - fileapi::FileSystemType type, - FileSystemContext* context, - const DeleteFileSystemCallback& callback) { - NOTREACHED(); - callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION); -} - } // namespace chrome diff --git a/chrome/browser/media_galleries/fileapi/media_file_system_mount_point_provider.h b/chrome/browser/media_galleries/fileapi/media_file_system_mount_point_provider.h index dbe18cf..45ba5eb 100644 --- a/chrome/browser/media_galleries/fileapi/media_file_system_mount_point_provider.h +++ b/chrome/browser/media_galleries/fileapi/media_file_system_mount_point_provider.h @@ -67,11 +67,6 @@ class MediaFileSystemMountPointProvider int64 offset, fileapi::FileSystemContext* context) const OVERRIDE; virtual fileapi::FileSystemQuotaUtil* GetQuotaUtil() OVERRIDE; - virtual void DeleteFileSystem( - const GURL& origin_url, - fileapi::FileSystemType type, - fileapi::FileSystemContext* context, - const DeleteFileSystemCallback& callback) OVERRIDE; private: // Store the profile path. We need this to create temporary snapshot files. diff --git a/webkit/browser/fileapi/file_system_context.cc b/webkit/browser/fileapi/file_system_context.cc index 97f4205..b552522 100644 --- a/webkit/browser/fileapi/file_system_context.cc +++ b/webkit/browser/fileapi/file_system_context.cc @@ -7,6 +7,7 @@ #include "base/bind.h" #include "base/single_thread_task_runner.h" #include "base/stl_util.h" +#include "base/task_runner_util.h" #include "url/gurl.h" #include "webkit/browser/blob/file_stream_reader.h" #include "webkit/browser/fileapi/copy_or_move_file_validator.h" @@ -297,8 +298,22 @@ void FileSystemContext::DeleteFileSystem( callback.Run(base::PLATFORM_FILE_ERROR_SECURITY); return; } + if (!mount_point_provider->GetQuotaUtil()) { + callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION); + return; + } - mount_point_provider->DeleteFileSystem(origin_url, type, this, callback); + base::PostTaskAndReplyWithResult( + task_runners()->file_task_runner(), + FROM_HERE, + // It is safe to pass Unretained(quota_util) since context owns it. + base::Bind(&FileSystemQuotaUtil::DeleteOriginDataOnFileThread, + base::Unretained(mount_point_provider->GetQuotaUtil()), + make_scoped_refptr(this), + base::Unretained(quota_manager_proxy()), + origin_url, + type), + callback); } scoped_ptr<webkit_blob::FileStreamReader> diff --git a/webkit/browser/fileapi/file_system_mount_point_provider.h b/webkit/browser/fileapi/file_system_mount_point_provider.h index eaaf471..3de8793 100644 --- a/webkit/browser/fileapi/file_system_mount_point_provider.h +++ b/webkit/browser/fileapi/file_system_mount_point_provider.h @@ -46,8 +46,6 @@ class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemMountPointProvider { // Callback for OpenFileSystem. typedef base::Callback<void(base::PlatformFileError error)> OpenFileSystemCallback; - typedef base::Callback<void(base::PlatformFileError error)> - DeleteFileSystemCallback; virtual ~FileSystemMountPointProvider() {} // Returns true if this mount point provider can handle |type|. @@ -117,13 +115,6 @@ class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemMountPointProvider { // Returns the specialized FileSystemQuotaUtil for this mount point. // This could return NULL if this mount point does not support quota. virtual FileSystemQuotaUtil* GetQuotaUtil() = 0; - - // Deletes the filesystem for the given |origin_url| and |type|. - virtual void DeleteFileSystem( - const GURL& origin_url, - FileSystemType type, - FileSystemContext* context, - const DeleteFileSystemCallback& callback) = 0; }; // An interface to control external file system access permissions. diff --git a/webkit/browser/fileapi/isolated_mount_point_provider.cc b/webkit/browser/fileapi/isolated_mount_point_provider.cc index 5d0137b..362c528 100644 --- a/webkit/browser/fileapi/isolated_mount_point_provider.cc +++ b/webkit/browser/fileapi/isolated_mount_point_provider.cc @@ -138,13 +138,4 @@ FileSystemQuotaUtil* IsolatedMountPointProvider::GetQuotaUtil() { return NULL; } -void IsolatedMountPointProvider::DeleteFileSystem( - const GURL& origin_url, - FileSystemType type, - FileSystemContext* context, - const DeleteFileSystemCallback& callback) { - NOTREACHED(); - callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION); -} - } // namespace fileapi diff --git a/webkit/browser/fileapi/isolated_mount_point_provider.h b/webkit/browser/fileapi/isolated_mount_point_provider.h index cadc66f..449ecf5 100644 --- a/webkit/browser/fileapi/isolated_mount_point_provider.h +++ b/webkit/browser/fileapi/isolated_mount_point_provider.h @@ -43,11 +43,6 @@ class IsolatedMountPointProvider : public FileSystemMountPointProvider { int64 offset, FileSystemContext* context) const OVERRIDE; virtual FileSystemQuotaUtil* GetQuotaUtil() OVERRIDE; - virtual void DeleteFileSystem( - const GURL& origin_url, - FileSystemType type, - FileSystemContext* context, - const DeleteFileSystemCallback& callback) OVERRIDE; private: scoped_ptr<AsyncFileUtilAdapter> isolated_file_util_; diff --git a/webkit/browser/fileapi/sandbox_mount_point_provider.cc b/webkit/browser/fileapi/sandbox_mount_point_provider.cc index 63f1ce2..89d0538 100644 --- a/webkit/browser/fileapi/sandbox_mount_point_provider.cc +++ b/webkit/browser/fileapi/sandbox_mount_point_provider.cc @@ -334,24 +334,6 @@ FileSystemQuotaUtil* SandboxMountPointProvider::GetQuotaUtil() { return this; } -void SandboxMountPointProvider::DeleteFileSystem( - const GURL& origin_url, - FileSystemType type, - FileSystemContext* context, - const DeleteFileSystemCallback& callback) { - base::PostTaskAndReplyWithResult( - context->task_runners()->file_task_runner(), - FROM_HERE, - // It is safe to pass Unretained(this) since context owns it. - base::Bind(&SandboxMountPointProvider::DeleteOriginDataOnFileThread, - base::Unretained(this), - make_scoped_refptr(context), - base::Unretained(context->quota_manager_proxy()), - origin_url, - type), - callback); -} - SandboxMountPointProvider::OriginEnumerator* SandboxMountPointProvider::CreateOriginEnumerator() { return new ObfuscatedOriginEnumerator(sandbox_sync_file_util()); diff --git a/webkit/browser/fileapi/sandbox_mount_point_provider.h b/webkit/browser/fileapi/sandbox_mount_point_provider.h index 0f9b030..99e91f0 100644 --- a/webkit/browser/fileapi/sandbox_mount_point_provider.h +++ b/webkit/browser/fileapi/sandbox_mount_point_provider.h @@ -105,11 +105,6 @@ class WEBKIT_STORAGE_BROWSER_EXPORT SandboxMountPointProvider int64 offset, FileSystemContext* context) const OVERRIDE; virtual FileSystemQuotaUtil* GetQuotaUtil() OVERRIDE; - virtual void DeleteFileSystem( - const GURL& origin_url, - FileSystemType type, - FileSystemContext* context, - const DeleteFileSystemCallback& callback) OVERRIDE; // Returns an origin enumerator of this provider. // This method can only be called on the file thread. diff --git a/webkit/browser/fileapi/test_mount_point_provider.cc b/webkit/browser/fileapi/test_mount_point_provider.cc index b2cc68a..20a1a4a 100644 --- a/webkit/browser/fileapi/test_mount_point_provider.cc +++ b/webkit/browser/fileapi/test_mount_point_provider.cc @@ -175,17 +175,6 @@ FileSystemQuotaUtil* TestMountPointProvider::GetQuotaUtil() { return quota_util_.get(); } -void TestMountPointProvider::DeleteFileSystem( - const GURL& origin_url, - FileSystemType type, - FileSystemContext* context, - const DeleteFileSystemCallback& callback) { - // This won't be called unless we add test code that opens a test - // filesystem by OpenFileSystem. - NOTREACHED(); - callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION); -} - const UpdateObserverList* TestMountPointProvider::GetUpdateObservers( FileSystemType type) const { return &update_observers_; diff --git a/webkit/browser/fileapi/test_mount_point_provider.h b/webkit/browser/fileapi/test_mount_point_provider.h index faaefcd0..0bb139b 100644 --- a/webkit/browser/fileapi/test_mount_point_provider.h +++ b/webkit/browser/fileapi/test_mount_point_provider.h @@ -59,11 +59,6 @@ class WEBKIT_STORAGE_BROWSER_EXPORT_PRIVATE TestMountPointProvider int64 offset, FileSystemContext* context) const OVERRIDE; virtual FileSystemQuotaUtil* GetQuotaUtil() OVERRIDE; - virtual void DeleteFileSystem( - const GURL& origin_url, - FileSystemType type, - FileSystemContext* context, - const DeleteFileSystemCallback& callback) OVERRIDE; // Initialize the CopyOrMoveFileValidatorFactory. Invalid to call more than // once. |