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

Unified Diff: webkit/fileapi/sandbox_quota_client.cc

Issue 7003021: Added DeleteOriginData to QuotaClient (Closed)
Patch Set: '' 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/fileapi/sandbox_quota_client_unittest.cc » ('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 3b6ceda1f545d5ec7d4bee07d860d1871d007825..541ecf15b35d5a5f4ef77d163e2659b0ef40d63d 100644
--- a/webkit/fileapi/sandbox_quota_client.cc
+++ b/webkit/fileapi/sandbox_quota_client.cc
@@ -184,6 +184,44 @@ class SandboxQuotaClient::GetOriginsForHostTask
std::string host_;
};
+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),
+ status_(quota::kQuotaStatusUnknown),
+ callback_(callback) {
+ }
+
+ virtual ~DeleteOriginTask() {}
+
+ virtual void RunOnTargetThread() OVERRIDE {
+ if (file_system_context_->
+ DeleteDataForOriginAndTypeOnFileThread(origin_, type_))
+ status_ = quota::kQuotaStatusOk;
+ else
+ status_ = quota::kQuotaErrorInvalidModification;
+ }
+
+ virtual void Completed() OVERRIDE {
+ callback_->Run(status_);
+ }
+ private:
+ FileSystemContext* file_system_context_;
+ GURL origin_;
+ FileSystemType type_;
+ quota::QuotaStatusCode status_;
+ scoped_ptr<DeletionCallback> callback_;
+};
+
SandboxQuotaClient::SandboxQuotaClient(
scoped_refptr<base::MessageLoopProxy> file_message_loop,
FileSystemContext* file_system_context,
@@ -266,6 +304,17 @@ void SandboxQuotaClient::GetOriginsForHost(
}
}
+void SandboxQuotaClient::DeleteOriginData(const GURL& origin,
+ StorageType type,
+ DeletionCallback* callback) {
+ FileSystemType fs_type = QuotaStorageTypeToFileSystemType(type);
+ DCHECK(fs_type != kFileSystemTypeUnknown);
+ scoped_refptr<DeleteOriginTask> task(
+ new DeleteOriginTask(this, file_message_loop_,
+ origin, fs_type, callback));
+ task->Start();
+}
+
void SandboxQuotaClient::DidGetOriginUsage(
FileSystemType type, const GURL& origin_url, int64 usage) {
visited_origins_.insert(origin_url);
« no previous file with comments | « webkit/fileapi/sandbox_quota_client.h ('k') | webkit/fileapi/sandbox_quota_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698