summaryrefslogtreecommitdiffstats
path: root/webkit/database/database_quota_client.cc
diff options
context:
space:
mode:
authormkwst@chromium.org <mkwst@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-05 08:39:54 +0000
committermkwst@chromium.org <mkwst@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-05 08:39:54 +0000
commit4ac23ad25a6467cc360cc10bd05946a0936cac5c (patch)
tree6a9fd5641ce5143ddb891a3ca16bf558afb4736f /webkit/database/database_quota_client.cc
parent90a47480a17322e3c095b9cc7eefd5498224f1a4 (diff)
downloadchromium_src-4ac23ad25a6467cc360cc10bd05946a0936cac5c.zip
chromium_src-4ac23ad25a6467cc360cc10bd05946a0936cac5c.tar.gz
chromium_src-4ac23ad25a6467cc360cc10bd05946a0936cac5c.tar.bz2
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
Diffstat (limited to 'webkit/database/database_quota_client.cc')
-rw-r--r--webkit/database/database_quota_client.cc38
1 files changed, 24 insertions, 14 deletions
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<GURL>());
+ callback->Run(std::set<GURL>(), type);
return;
}
if (origins_for_type_callbacks_.Add(callback.release())) {
scoped_refptr<GetAllOriginsTask> 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<GURL>());
+ callback->Run(std::set<GURL>(), type);
return;
}
if (origins_for_host_callbacks_.Add(host, callback.release())) {
scoped_refptr<GetOriginsForHostTask> 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<GURL>& origins) {
+void DatabaseQuotaClient::DidGetAllOrigins(const std::set<GURL>& 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<GURL>& origins) {
+ const std::string& host, const std::set<GURL>& 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