Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Unified Diff: webkit/fileapi/sandbox_quota_client.cc

Issue 7003021: Added DeleteOriginData to QuotaClient (Closed)
Patch Set: Added error report Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/fileapi/sandbox_quota_client.h ('k') | webkit/quota/quota_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..d6d425dfb33882d28406cf44d922330c63927d46 100644
--- a/webkit/fileapi/sandbox_quota_client.cc
+++ b/webkit/fileapi/sandbox_quota_client.cc
@@ -289,4 +289,59 @@ 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),
kinuko 2011/05/11 12:18:49 nit: type_() in the next line
tzik (google) 2011/05/12 10:47:06 Done.
+ status_(quota::kQuotaStatusUnknown),
+ callback_(callback) {
+ }
+
+ virtual ~DeleteOriginTask() {}
+
+ virtual void RunOnTargetThread() OVERRIDE {
+ if (file_system_context_
+ ->DeleteDataForOriginAndTypeOnFileThread(origin_, type_))
kinuko 2011/05/11 12:18:49 style nit: weird indentation not sure what would
tzik (google) 2011/05/12 10:47:06 Done.
+ status_ = quota::kQuotaStatusOk;
+ else
+ status_ = quota::kQuotaErrorInvalidModification;
+ }
+
+ virtual void Aborted() OVERRIDE {
+ status_ = quota::kQuotaErrorAbort;
+ callback_->Run(status_);
+ delete callback_;
+ }
+
+ virtual void Completed() OVERRIDE {
+ callback_->Run(status_);
+ delete callback_;
+ }
+ private:
+ FileSystemContext* file_system_context_;
+ GURL origin_;
+ FileSystemType type_;
+ quota::QuotaStatusCode status_;
+ DeletionCallback* callback_;
+};
+
+void SandboxQuotaClient::DeleteOriginData(const GURL& origin,
+ StorageType type,
+ DeletionCallback* callback) {
+ FileSystemType fs_type = QuotaStorageTypeToFileSystemType(type);
+ DCHECK(fs_type != kFileSystemTypeUnknown);
+ scoped_ptr<DeleteOriginTask> task(
+ new DeleteOriginTask(this, file_message_loop_,
kinuko 2011/05/12 05:54:15 Sorry, please forget what I said about ScopedRunna
+ origin, fs_type, callback));
+ task->Start();
+}
+
} // namespace fileapi
« no previous file with comments | « webkit/fileapi/sandbox_quota_client.h ('k') | webkit/quota/quota_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698