diff options
author | kinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-04 05:54:46 +0000 |
---|---|---|
committer | kinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-04 05:54:46 +0000 |
commit | 3a458684b53920e859297c7c3c8d834a6a760e97 (patch) | |
tree | 190c5e1ef3de877586cea7b6f3846685ee37193f /webkit/browser | |
parent | a070edee04b24dfaa6176ddf0449cd324667d6ce (diff) | |
download | chromium_src-3a458684b53920e859297c7c3c8d834a6a760e97.zip chromium_src-3a458684b53920e859297c7c3c8d834a6a760e97.tar.gz chromium_src-3a458684b53920e859297c7c3c8d834a6a760e97.tar.bz2 |
Deprecate FileSystemMountPointProvider::DeleteFileSystem
FileSystem deletion (reset) should only work for sandboxed
filesystems, and the method must not be on the generic
FileSystemMountPointProvider interface.
BUG=241701
TEST=manual (devtools -> delete root -> see the filesystem goes away), layout tests
NOTRY=true
R=satorux@chromium.org, tzik@chromium.org, vandebo@chromium.org
Review URL: https://codereview.chromium.org/18586006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@210126 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/browser')
8 files changed, 16 insertions, 63 deletions
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. |