diff options
author | nhiroki@google.com <nhiroki@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-02 21:43:40 +0000 |
---|---|---|
committer | nhiroki@google.com <nhiroki@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-02 21:43:40 +0000 |
commit | d5e0855885214a92671a6496581617cc627c63b6 (patch) | |
tree | 9e059d0aab633c0edd678164a15aebc4cb44742e | |
parent | 20013054967a7343a5e3ac0720fdc6ada52b6953 (diff) | |
download | chromium_src-d5e0855885214a92671a6496581617cc627c63b6.zip chromium_src-d5e0855885214a92671a6496581617cc627c63b6.tar.gz chromium_src-d5e0855885214a92671a6496581617cc627c63b6.tar.bz2 |
Wire up the deleteFileSystem operation.
BUG=139366
TEST="Will be tested from WebKit inspector test"
Review URL: https://chromiumcodereview.appspot.com/10828043
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149707 0039d316-1c4b-4281-b951-d872f2087c98
19 files changed, 227 insertions, 64 deletions
diff --git a/content/browser/fileapi/fileapi_message_filter.cc b/content/browser/fileapi/fileapi_message_filter.cc index 5097b6e..75977e5 100644 --- a/content/browser/fileapi/fileapi_message_filter.cc +++ b/content/browser/fileapi/fileapi_message_filter.cc @@ -150,6 +150,7 @@ bool FileAPIMessageFilter::OnMessageReceived( bool handled = true; IPC_BEGIN_MESSAGE_MAP_EX(FileAPIMessageFilter, message, *message_was_ok) IPC_MESSAGE_HANDLER(FileSystemHostMsg_Open, OnOpen) + IPC_MESSAGE_HANDLER(FileSystemHostMsg_DeleteFileSystem, OnDeleteFileSystem) IPC_MESSAGE_HANDLER(FileSystemHostMsg_Move, OnMove) IPC_MESSAGE_HANDLER(FileSystemHostMsg_Copy, OnCopy) IPC_MESSAGE_HANDLER(FileSystemMsg_Remove, OnRemove) @@ -207,6 +208,15 @@ void FileAPIMessageFilter::OnOpen( &FileAPIMessageFilter::DidOpenFileSystem, this, request_id)); } +void FileAPIMessageFilter::OnDeleteFileSystem( + int request_id, + const GURL& origin_url, + fileapi::FileSystemType type) { + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); + context_->DeleteFileSystem(origin_url, type, base::Bind( + &FileAPIMessageFilter::DidDeleteFileSystem, this, request_id)); +} + void FileAPIMessageFilter::OnMove( int request_id, const GURL& src_path, const GURL& dest_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); @@ -652,6 +662,17 @@ void FileAPIMessageFilter::DidOpenFileSystem(int request_id, // For OpenFileSystem we do not create a new operation, so no unregister here. } +void FileAPIMessageFilter::DidDeleteFileSystem( + int request_id, + base::PlatformFileError result) { + if (result == base::PLATFORM_FILE_OK) + Send(new FileSystemMsg_DidSucceed(request_id)); + else + Send(new FileSystemMsg_DidFail(request_id, result)); + // For DeleteFileSystem we do not create a new operation, + // so no unregister here. +} + void FileAPIMessageFilter::DidCreateSnapshot( int request_id, const base::Callback<void(const FilePath&)>& register_file_callback, diff --git a/content/browser/fileapi/fileapi_message_filter.h b/content/browser/fileapi/fileapi_message_filter.h index c7f49e5..dc2ab54 100644 --- a/content/browser/fileapi/fileapi_message_filter.h +++ b/content/browser/fileapi/fileapi_message_filter.h @@ -78,6 +78,9 @@ class FileAPIMessageFilter : public content::BrowserMessageFilter { fileapi::FileSystemType type, int64 requested_size, bool create); + void OnDeleteFileSystem(int request_id, + const GURL& origin_url, + fileapi::FileSystemType type); void OnMove(int request_id, const GURL& src_path, const GURL& dest_path); @@ -146,6 +149,8 @@ class FileAPIMessageFilter : public content::BrowserMessageFilter { base::PlatformFileError result, const std::string& name, const GURL& root); + void DidDeleteFileSystem(int request_id, + base::PlatformFileError result); void DidCreateSnapshot( int request_id, const base::Callback<void(const FilePath&)>& register_file_callback, diff --git a/content/common/fileapi/file_system_dispatcher.cc b/content/common/fileapi/file_system_dispatcher.cc index 359fe01..2c929fe 100644 --- a/content/common/fileapi/file_system_dispatcher.cc +++ b/content/common/fileapi/file_system_dispatcher.cc @@ -53,6 +53,19 @@ bool FileSystemDispatcher::OpenFileSystem( return true; } +bool FileSystemDispatcher::DeleteFileSystem( + const GURL& origin_url, + fileapi::FileSystemType type, + fileapi::FileSystemCallbackDispatcher* dispatcher) { + int request_id = dispatchers_.Add(dispatcher); + if (!ChildThread::current()->Send(new FileSystemHostMsg_DeleteFileSystem( + request_id, origin_url, type))) { + dispatchers_.Remove(request_id); + return false; + } + return true; +} + bool FileSystemDispatcher::Move( const GURL& src_path, const GURL& dest_path, diff --git a/content/common/fileapi/file_system_dispatcher.h b/content/common/fileapi/file_system_dispatcher.h index 59d9d5a..c2e4ce3 100644 --- a/content/common/fileapi/file_system_dispatcher.h +++ b/content/common/fileapi/file_system_dispatcher.h @@ -40,6 +40,9 @@ class FileSystemDispatcher : public IPC::Listener { long long size, bool create, fileapi::FileSystemCallbackDispatcher* dispatcher); + bool DeleteFileSystem(const GURL& origin_url, + fileapi::FileSystemType type, + fileapi::FileSystemCallbackDispatcher* dispatcher); bool Move(const GURL& src_path, const GURL& dest_path, fileapi::FileSystemCallbackDispatcher* dispatcher); diff --git a/content/common/fileapi/file_system_messages.h b/content/common/fileapi/file_system_messages.h index ba0e13d..24d864c 100644 --- a/content/common/fileapi/file_system_messages.h +++ b/content/common/fileapi/file_system_messages.h @@ -60,6 +60,12 @@ IPC_MESSAGE_CONTROL5(FileSystemHostMsg_Open, int64 /* requested_size */, bool /* create */) +// WebFrameClient::deleteFileSystem() message. +IPC_MESSAGE_CONTROL3(FileSystemHostMsg_DeleteFileSystem, + int /* request_id */, + GURL /* origin_url */, + fileapi::FileSystemType /* type */) + // WebFileSystem::move() message. IPC_MESSAGE_CONTROL3(FileSystemHostMsg_Move, int /* request_id */, diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc index 22a3a88..4d136cc 100644 --- a/content/renderer/render_view_impl.cc +++ b/content/renderer/render_view_impl.cc @@ -3687,6 +3687,25 @@ void RenderViewImpl::openFileSystem( size, create, new WebFileSystemCallbackDispatcher(callbacks)); } +void RenderViewImpl::deleteFileSystem( + WebFrame* frame, + WebFileSystem::Type type , + WebFileSystemCallbacks* callbacks) { + DCHECK(callbacks); + + WebSecurityOrigin origin = frame->document().securityOrigin(); + if (origin.isUnique()) { + // Unique origins cannot store persistent state. + callbacks->didSucceed(); + return; + } + + ChildThread::current()->file_system_dispatcher()->DeleteFileSystem( + GURL(origin.toString()), + static_cast<fileapi::FileSystemType>(type), + new WebFileSystemCallbackDispatcher(callbacks)); +} + void RenderViewImpl::queryStorageUsageAndQuota( WebFrame* frame, WebStorageQuotaType type, diff --git a/content/renderer/render_view_impl.h b/content/renderer/render_view_impl.h index 2fcb91a..a26b2b7 100644 --- a/content/renderer/render_view_impl.h +++ b/content/renderer/render_view_impl.h @@ -635,6 +635,9 @@ class RenderViewImpl : public RenderWidget, long long size, bool create, WebKit::WebFileSystemCallbacks* callbacks); + virtual void deleteFileSystem(WebKit::WebFrame* frame, + WebKit::WebFileSystem::Type type, + WebKit::WebFileSystemCallbacks* callbacks); virtual void queryStorageUsageAndQuota( WebKit::WebFrame* frame, WebKit::WebStorageQuotaType type, diff --git a/webkit/chromeos/fileapi/cros_mount_point_provider.cc b/webkit/chromeos/fileapi/cros_mount_point_provider.cc index 4b834a9..f30b5ce 100644 --- a/webkit/chromeos/fileapi/cros_mount_point_provider.cc +++ b/webkit/chromeos/fileapi/cros_mount_point_provider.cc @@ -138,6 +138,15 @@ 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::HasMountPoint(const FilePath& mount_point) { base::AutoLock locker(mount_point_map_lock_); MountPointMap::const_iterator iter = mount_point_map_.find( diff --git a/webkit/chromeos/fileapi/cros_mount_point_provider.h b/webkit/chromeos/fileapi/cros_mount_point_provider.h index a904e85..a7c410b 100644 --- a/webkit/chromeos/fileapi/cros_mount_point_provider.h +++ b/webkit/chromeos/fileapi/cros_mount_point_provider.h @@ -28,6 +28,9 @@ class FileAccessPermissions; class CrosMountPointProvider : public fileapi::ExternalFileSystemMountPointProvider { public: + using fileapi::FileSystemMountPointProvider::ValidateFileSystemCallback; + using fileapi::FileSystemMountPointProvider::DeleteFileSystemCallback; + // Mount point file system location enum. enum FileSystemLocation { // File system that is locally mounted by the underlying OS. @@ -36,9 +39,6 @@ class CrosMountPointProvider REMOTE, }; - typedef fileapi::FileSystemMountPointProvider::ValidateFileSystemCallback - ValidateFileSystemCallback; - CrosMountPointProvider( scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy); virtual ~CrosMountPointProvider(); @@ -67,14 +67,19 @@ class CrosMountPointProvider const fileapi::FileSystemURL& url, fileapi::FileSystemContext* context) const OVERRIDE; virtual webkit_blob::FileStreamReader* CreateFileStreamReader( - const fileapi::FileSystemURL& path, - int64 offset, - fileapi::FileSystemContext* context) const OVERRIDE; + const fileapi::FileSystemURL& path, + int64 offset, + fileapi::FileSystemContext* context) const OVERRIDE; virtual fileapi::FileStreamWriter* CreateFileStreamWriter( - const fileapi::FileSystemURL& url, - int64 offset, - fileapi::FileSystemContext* context) const OVERRIDE; + const fileapi::FileSystemURL& url, + 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 std::vector<FilePath> GetRootDirectories() const OVERRIDE; diff --git a/webkit/fileapi/file_system_context.cc b/webkit/fileapi/file_system_context.cc index 53afbb1..3e3679e 100644 --- a/webkit/fileapi/file_system_context.cc +++ b/webkit/fileapi/file_system_context.cc @@ -36,10 +36,11 @@ QuotaClient* CreateQuotaClient( return new FileSystemQuotaClient(context, is_incognito); } -void DidOpenFileSystem(FileSystemContext::OpenFileSystemCallback callback, - const GURL& filesystem_root, - const std::string& filesystem_name, - base::PlatformFileError error) { +void DidOpenFileSystem( + const FileSystemContext::OpenFileSystemCallback& callback, + const GURL& filesystem_root, + const std::string& filesystem_name, + base::PlatformFileError error) { callback.Run(error, filesystem_name, filesystem_root); } @@ -78,22 +79,12 @@ bool FileSystemContext::DeleteDataForOriginOnFileThread( // Delete temporary and persistent data. return - sandbox_provider()->DeleteOriginDataOnFileThread( - this, quota_manager_proxy(), origin_url, kFileSystemTypeTemporary) && - sandbox_provider()->DeleteOriginDataOnFileThread( - this, quota_manager_proxy(), origin_url, kFileSystemTypePersistent); -} - -bool FileSystemContext::DeleteDataForOriginAndTypeOnFileThread( - const GURL& origin_url, FileSystemType type) { - DCHECK(file_task_runner_->RunsTasksOnCurrentThread()); - if (type == fileapi::kFileSystemTypeTemporary || - type == fileapi::kFileSystemTypePersistent) { - DCHECK(sandbox_provider()); - return sandbox_provider()->DeleteOriginDataOnFileThread( - this, quota_manager_proxy(), origin_url, type); - } - return false; + (sandbox_provider()->DeleteOriginDataOnFileThread( + this, quota_manager_proxy(), origin_url, kFileSystemTypeTemporary) == + base::PLATFORM_FILE_OK) && + (sandbox_provider()->DeleteOriginDataOnFileThread( + this, quota_manager_proxy(), origin_url, kFileSystemTypePersistent) == + base::PLATFORM_FILE_OK); } FileSystemQuotaUtil* @@ -151,7 +142,7 @@ void FileSystemContext::OpenFileSystem( const GURL& origin_url, FileSystemType type, bool create, - OpenFileSystemCallback callback) { + const OpenFileSystemCallback& callback) { DCHECK(!callback.is_null()); FileSystemMountPointProvider* mount_point_provider = @@ -169,6 +160,20 @@ void FileSystemContext::OpenFileSystem( base::Bind(&DidOpenFileSystem, callback, root_url, name)); } +void FileSystemContext::DeleteFileSystem( + const GURL& origin_url, + FileSystemType type, + const DeleteFileSystemCallback& callback) { + FileSystemMountPointProvider* mount_point_provider = + GetMountPointProvider(type); + if (!mount_point_provider) { + callback.Run(base::PLATFORM_FILE_ERROR_SECURITY); + return; + } + + mount_point_provider->DeleteFileSystem(origin_url, type, this, callback); +} + FileSystemOperationInterface* FileSystemContext::CreateFileSystemOperation( const FileSystemURL& url) { if (!url.is_valid()) diff --git a/webkit/fileapi/file_system_context.h b/webkit/fileapi/file_system_context.h index 12906a9..232cb00 100644 --- a/webkit/fileapi/file_system_context.h +++ b/webkit/fileapi/file_system_context.h @@ -66,8 +66,6 @@ class FILEAPI_EXPORT FileSystemContext const FileSystemOptions& options); bool DeleteDataForOriginOnFileThread(const GURL& origin_url); - bool DeleteDataForOriginAndTypeOnFileThread(const GURL& origin_url, - FileSystemType type); quota::QuotaManagerProxy* quota_manager_proxy() const { return quota_manager_proxy_.get(); @@ -108,6 +106,10 @@ class FILEAPI_EXPORT FileSystemContext const std::string& name, const GURL& root)> OpenFileSystemCallback; + // Used for DeleteFileSystem. + typedef base::Callback<void(base::PlatformFileError result)> + DeleteFileSystemCallback; + // Opens the filesystem for the given |origin_url| and |type|, and dispatches // the DidOpenFileSystem callback of the given |dispatcher|. // If |create| is true this may actually set up a filesystem instance @@ -117,7 +119,13 @@ class FILEAPI_EXPORT FileSystemContext const GURL& origin_url, FileSystemType type, bool create, - OpenFileSystemCallback callback); + const OpenFileSystemCallback& callback); + + // Deletes the filesystem for the given |origin_url| and |type|. + void DeleteFileSystem( + const GURL& origin_url, + FileSystemType type, + const DeleteFileSystemCallback& callback); // Creates a new FileSystemOperation instance by cracking // the given filesystem URL |url| to get an appropriate MountPointProvider diff --git a/webkit/fileapi/file_system_mount_point_provider.h b/webkit/fileapi/file_system_mount_point_provider.h index b3309bc..fbc7b58 100644 --- a/webkit/fileapi/file_system_mount_point_provider.h +++ b/webkit/fileapi/file_system_mount_point_provider.h @@ -35,6 +35,8 @@ class FILEAPI_EXPORT FileSystemMountPointProvider { // Callback for ValidateFileSystemRoot. typedef base::Callback<void(base::PlatformFileError error)> ValidateFileSystemCallback; + typedef base::Callback<void(base::PlatformFileError error)> + DeleteFileSystemCallback; virtual ~FileSystemMountPointProvider() {} // Validates the filesystem for the given |origin_url| and |type|. @@ -107,6 +109,13 @@ class FILEAPI_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/fileapi/file_system_quota_client.cc b/webkit/fileapi/file_system_quota_client.cc index 9619ecc..9812ae0 100644 --- a/webkit/fileapi/file_system_quota_client.cc +++ b/webkit/fileapi/file_system_quota_client.cc @@ -18,6 +18,7 @@ #include "webkit/fileapi/file_system_quota_util.h" #include "webkit/fileapi/file_system_usage_cache.h" #include "webkit/fileapi/file_system_util.h" +#include "webkit/fileapi/sandbox_mount_point_provider.h" using base::SequencedTaskRunner; using quota::QuotaThreadTask; @@ -152,8 +153,13 @@ class FileSystemQuotaClient::DeleteOriginTask // QuotaThreadTask: virtual void RunOnTargetThread() OVERRIDE { - if (file_system_context_->DeleteDataForOriginAndTypeOnFileThread( - origin_, type_)) + base::PlatformFileError result = + file_system_context_->sandbox_provider()->DeleteOriginDataOnFileThread( + file_system_context_, + file_system_context_->quota_manager_proxy(), + origin_, + type_); + if (result == base::PLATFORM_FILE_OK) status_ = quota::kQuotaStatusOk; else status_ = quota::kQuotaErrorInvalidModification; diff --git a/webkit/fileapi/isolated_mount_point_provider.cc b/webkit/fileapi/isolated_mount_point_provider.cc index 7e66106..bca05fa 100644 --- a/webkit/fileapi/isolated_mount_point_provider.cc +++ b/webkit/fileapi/isolated_mount_point_provider.cc @@ -139,4 +139,13 @@ 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/fileapi/isolated_mount_point_provider.h b/webkit/fileapi/isolated_mount_point_provider.h index 0bd5182..f6340dc 100644 --- a/webkit/fileapi/isolated_mount_point_provider.h +++ b/webkit/fileapi/isolated_mount_point_provider.h @@ -20,8 +20,8 @@ class NativeMediaFileUtil; class IsolatedMountPointProvider : public FileSystemMountPointProvider { public: - typedef FileSystemMountPointProvider::ValidateFileSystemCallback - ValidateFileSystemCallback; + using FileSystemMountPointProvider::ValidateFileSystemCallback; + using FileSystemMountPointProvider::DeleteFileSystemCallback; IsolatedMountPointProvider(); virtual ~IsolatedMountPointProvider(); @@ -48,14 +48,19 @@ class IsolatedMountPointProvider : public FileSystemMountPointProvider { const FileSystemURL& url, FileSystemContext* context) const OVERRIDE; virtual webkit_blob::FileStreamReader* CreateFileStreamReader( - const FileSystemURL& url, - int64 offset, - FileSystemContext* context) const OVERRIDE; + const FileSystemURL& url, + int64 offset, + FileSystemContext* context) const OVERRIDE; virtual FileStreamWriter* CreateFileStreamWriter( - const FileSystemURL& url, - int64 offset, - FileSystemContext* context) const OVERRIDE; + const FileSystemURL& url, + 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<MediaPathFilter> media_path_filter_; diff --git a/webkit/fileapi/sandbox_mount_point_provider.cc b/webkit/fileapi/sandbox_mount_point_provider.cc index 30f6a97..b08927a 100644 --- a/webkit/fileapi/sandbox_mount_point_provider.cc +++ b/webkit/fileapi/sandbox_mount_point_provider.cc @@ -13,6 +13,7 @@ #include "base/sequenced_task_runner.h" #include "base/string_util.h" #include "base/stringprintf.h" +#include "base/task_runner_util.h" #include "googleurl/src/gurl.h" #include "net/base/net_util.h" #include "webkit/fileapi/file_system_file_stream_reader.h" @@ -268,16 +269,9 @@ void MigrateIfNeeded( MigrateAllOldFileSystems(file_util, old_base_path); } -void PassPointerErrorByValue( - const base::Callback<void(PlatformFileError)>& callback, - PlatformFileError* error_ptr) { - DCHECK(error_ptr); - callback.Run(*error_ptr); -} - void DidValidateFileSystemRoot( base::WeakPtr<SandboxMountPointProvider> mount_point_provider, - const base::Callback<void(PlatformFileError)>& callback, + const FileSystemMountPointProvider::ValidateFileSystemCallback& callback, base::PlatformFileError* error) { if (mount_point_provider.get()) mount_point_provider.get()->CollectOpenFileSystemMetrics(*error); @@ -459,6 +453,24 @@ FileSystemQuotaUtil* SandboxMountPointProvider::GetQuotaUtil() { return this; } +void SandboxMountPointProvider::DeleteFileSystem( + const GURL& origin_url, + FileSystemType type, + FileSystemContext* context, + const DeleteFileSystemCallback& callback) { + base::PostTaskAndReplyWithResult( + context->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); +} + FilePath SandboxMountPointProvider::old_base_path() const { return profile_path_.Append(kOldFileSystemDirectory); } @@ -490,7 +502,8 @@ FilePath SandboxMountPointProvider::GetBaseDirectoryForOriginAndType( return path; } -bool SandboxMountPointProvider::DeleteOriginDataOnFileThread( +base::PlatformFileError +SandboxMountPointProvider::DeleteOriginDataOnFileThread( FileSystemContext* file_system_context, QuotaManagerProxy* proxy, const GURL& origin_url, @@ -509,7 +522,10 @@ bool SandboxMountPointProvider::DeleteOriginDataOnFileThread( FileSystemTypeToQuotaStorageType(type), -usage); } - return result; + + if (result) + return base::PLATFORM_FILE_OK; + return base::PLATFORM_FILE_ERROR_FAILED; } void SandboxMountPointProvider::GetOriginsForTypeOnFileThread( diff --git a/webkit/fileapi/sandbox_mount_point_provider.h b/webkit/fileapi/sandbox_mount_point_provider.h index 5921bb5..2d97a7e 100644 --- a/webkit/fileapi/sandbox_mount_point_provider.h +++ b/webkit/fileapi/sandbox_mount_point_provider.h @@ -41,8 +41,8 @@ class FILEAPI_EXPORT SandboxMountPointProvider : public FileSystemMountPointProvider, public FileSystemQuotaUtil { public: - typedef FileSystemMountPointProvider::ValidateFileSystemCallback - ValidateFileSystemCallback; + using FileSystemMountPointProvider::ValidateFileSystemCallback; + using FileSystemMountPointProvider::DeleteFileSystemCallback; // Origin enumerator interface. // An instance of this interface is assumed to be called on the file thread. @@ -104,6 +104,11 @@ class FILEAPI_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; FilePath old_base_path() const; FilePath new_base_path() const; @@ -126,7 +131,7 @@ class FILEAPI_EXPORT SandboxMountPointProvider // Deletes the data on the origin and reports the amount of deleted data // to the quota manager via |proxy|. - bool DeleteOriginDataOnFileThread( + base::PlatformFileError DeleteOriginDataOnFileThread( FileSystemContext* context, quota::QuotaManagerProxy* proxy, const GURL& origin_url, diff --git a/webkit/fileapi/test_mount_point_provider.cc b/webkit/fileapi/test_mount_point_provider.cc index c1e76d3..fd0023e 100644 --- a/webkit/fileapi/test_mount_point_provider.cc +++ b/webkit/fileapi/test_mount_point_provider.cc @@ -160,4 +160,15 @@ 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); +} + } // namespace fileapi diff --git a/webkit/fileapi/test_mount_point_provider.h b/webkit/fileapi/test_mount_point_provider.h index 8181333..5716368 100644 --- a/webkit/fileapi/test_mount_point_provider.h +++ b/webkit/fileapi/test_mount_point_provider.h @@ -26,8 +26,8 @@ class FileSystemQuotaUtil; class FILEAPI_EXPORT_PRIVATE TestMountPointProvider : public FileSystemMountPointProvider { public: - typedef FileSystemMountPointProvider::ValidateFileSystemCallback - ValidateFileSystemCallback; + using FileSystemMountPointProvider::ValidateFileSystemCallback; + using FileSystemMountPointProvider::DeleteFileSystemCallback; TestMountPointProvider( base::SequencedTaskRunner* task_runner, @@ -56,14 +56,19 @@ class FILEAPI_EXPORT_PRIVATE TestMountPointProvider const FileSystemURL& url, FileSystemContext* context) const OVERRIDE; virtual webkit_blob::FileStreamReader* CreateFileStreamReader( - const FileSystemURL& url, - int64 offset, - FileSystemContext* context) const OVERRIDE; + const FileSystemURL& url, + int64 offset, + FileSystemContext* context) const OVERRIDE; virtual FileStreamWriter* CreateFileStreamWriter( - const FileSystemURL& url, - int64 offset, - FileSystemContext* context) const OVERRIDE; + const FileSystemURL& url, + 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: FilePath base_path_; |