Chromium Code Reviews| Index: webkit/fileapi/sandbox_quota_client.cc |
| diff --git a/webkit/fileapi/sandbox_quota_client.cc b/webkit/fileapi/sandbox_quota_client.cc |
| index b35e7ba23c7e3c874b268dd6bf7faf21a3dea115..776189053cca850b85ceb0a447f51bfb863e29f9 100644 |
| --- a/webkit/fileapi/sandbox_quota_client.cc |
| +++ b/webkit/fileapi/sandbox_quota_client.cc |
| @@ -289,4 +289,47 @@ void SandboxQuotaClient::DidGetOriginsForHost( |
| pending_origins_for_host_callbacks_.Run(type_and_host, origins); |
| } |
| +class SandboxQuotaClient::DeleteOriginTask |
| + : public QuotaThreadTask { |
| + public: |
| + DeleteOriginTask( |
| + SandboxQuotaClient* quota_client, |
| + scoped_refptr<MessageLoopProxy> file_message_loop, |
| + const GURL& origin, |
| + FileSystemType type, |
| + DeletionCallback* callback) |
| + : QuotaThreadTask(quota_client, file_message_loop), |
| + file_system_context_(quota_client->file_system_context_), |
| + origin_(origin), type_(type), |
| + callback_(callback) { |
| + } |
| + |
| + virtual ~DeleteOriginTask() {} |
| + |
| + virtual void RunOnTargetThread() OVERRIDE { |
| + file_system_context_ |
| + ->DeleteDataForOriginAndTypeOnFileThread(origin_, type_); |
|
kinuko
2011/05/11 09:38:15
what if we fail to do this?
|
| + } |
| + |
| + virtual void Completed() OVERRIDE { |
| + callback_->Run(); |
| + delete callback_; |
| + } |
| + private: |
| + FileSystemContext* file_system_context_; |
| + GURL origin_; |
| + FileSystemType type_; |
| + DeletionCallback* callback_; |
| +}; |
| + |
| +void SandboxQuotaClient::DeleteOriginData(const GURL& origin, |
| + StorageType type, |
| + DeletionCallback* callback) { |
| + FileSystemType fs_type = QuotaStorageTypeToFileSystemType(type); |
|
kinuko
2011/05/11 09:38:15
DCHECK(fs_type != kFileSystemTypeUnknown)
tzik (google)
2011/05/11 11:32:25
Done.
|
| + scoped_ptr<DeleteOriginTask> task( |
| + new DeleteOriginTask(this, file_message_loop_, |
| + origin, fs_type, callback)); |
| + task->Start(); |
| +} |
| + |
| } // namespace fileapi |