From 4ac23ad25a6467cc360cc10bd05946a0936cac5c Mon Sep 17 00:00:00 2001 From: "mkwst@chromium.org" Date: Fri, 5 Aug 2011 08:39:54 +0000 Subject: Quota: Add quota::StorageType to the GetOriginsCallback definition. BUG=90996 TEST=test_shell_tests Review URL: http://codereview.chromium.org/7533013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@95591 0039d316-1c4b-4281-b951-d872f2087c98 --- webkit/database/database_quota_client.cc | 38 ++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 14 deletions(-) (limited to 'webkit/database/database_quota_client.cc') diff --git a/webkit/database/database_quota_client.cc b/webkit/database/database_quota_client.cc index 4ebfaf8..52f1fd5 100644 --- a/webkit/database/database_quota_client.cc +++ b/webkit/database/database_quota_client.cc @@ -89,8 +89,10 @@ class DatabaseQuotaClient::GetAllOriginsTask : public GetOriginsTaskBase { public: GetAllOriginsTask( DatabaseQuotaClient* client, - base::MessageLoopProxy* db_tracker_thread) - : GetOriginsTaskBase(client, db_tracker_thread) { + base::MessageLoopProxy* db_tracker_thread, + quota::StorageType type) + : GetOriginsTaskBase(client, db_tracker_thread), + type_(type) { } protected: @@ -98,8 +100,11 @@ class DatabaseQuotaClient::GetAllOriginsTask : public GetOriginsTaskBase { return true; } virtual void Completed() OVERRIDE { - client_->DidGetAllOrigins(origins_); + client_->DidGetAllOrigins(origins_, type_); } + + private: + quota::StorageType type_; }; class DatabaseQuotaClient::GetOriginsForHostTask : public GetOriginsTaskBase { @@ -107,9 +112,11 @@ class DatabaseQuotaClient::GetOriginsForHostTask : public GetOriginsTaskBase { GetOriginsForHostTask( DatabaseQuotaClient* client, base::MessageLoopProxy* db_tracker_thread, - const std::string& host) + const std::string& host, + quota::StorageType type) : GetOriginsTaskBase(client, db_tracker_thread), - host_(host) { + host_(host), + type_(type) { } private: @@ -117,9 +124,10 @@ class DatabaseQuotaClient::GetOriginsForHostTask : public GetOriginsTaskBase { return host_ == net::GetHostOrSpecFromURL(origin); } virtual void Completed() OVERRIDE { - client_->DidGetOriginsForHost(host_, origins_); + client_->DidGetOriginsForHost(host_, origins_, type_); } std::string host_; + quota::StorageType type_; }; class DatabaseQuotaClient::DeleteOriginTask : public HelperTask { @@ -222,13 +230,13 @@ void DatabaseQuotaClient::GetOriginsForType( // All databases are in the temp namespace for now. if (type != quota::kStorageTypeTemporary) { - callback->Run(std::set()); + callback->Run(std::set(), type); return; } if (origins_for_type_callbacks_.Add(callback.release())) { scoped_refptr task( - new GetAllOriginsTask(this, db_tracker_thread_)); + new GetAllOriginsTask(this, db_tracker_thread_, type)); task->Start(); } } @@ -243,13 +251,13 @@ void DatabaseQuotaClient::GetOriginsForHost( // All databases are in the temp namespace for now. if (type != quota::kStorageTypeTemporary) { - callback->Run(std::set()); + callback->Run(std::set(), type); return; } if (origins_for_host_callbacks_.Add(host, callback.release())) { scoped_refptr task( - new GetOriginsForHostTask(this, db_tracker_thread_, host)); + new GetOriginsForHostTask(this, db_tracker_thread_, host, type)); task->Start(); } } @@ -279,15 +287,17 @@ void DatabaseQuotaClient::DidGetOriginUsage( usage_for_origin_callbacks_.Run(origin_url, usage); } -void DatabaseQuotaClient::DidGetAllOrigins(const std::set& origins) { +void DatabaseQuotaClient::DidGetAllOrigins(const std::set& origins, + quota::StorageType type) { DCHECK(origins_for_type_callbacks_.HasCallbacks()); - origins_for_type_callbacks_.Run(origins); + origins_for_type_callbacks_.Run(origins, type); } void DatabaseQuotaClient::DidGetOriginsForHost( - const std::string& host, const std::set& origins) { + const std::string& host, const std::set& origins, + quota::StorageType type) { DCHECK(origins_for_host_callbacks_.HasCallbacks(host)); - origins_for_host_callbacks_.Run(host, origins); + origins_for_host_callbacks_.Run(host, origins, type); } } // namespace webkit_database -- cgit v1.1