Chromium Code Reviews| Index: content/browser/service_worker/service_worker_quota_client.cc |
| diff --git a/content/browser/service_worker/service_worker_quota_client.cc b/content/browser/service_worker/service_worker_quota_client.cc |
| index e2697e2303a62054a46c8736bac95798123ba30d..dc4dd8385db829e9acd1dad7eb3f6eb931a084fa 100644 |
| --- a/content/browser/service_worker/service_worker_quota_client.cc |
| +++ b/content/browser/service_worker/service_worker_quota_client.cc |
| @@ -30,6 +30,15 @@ void ReportToQuotaStatus(const QuotaClient::DeletionCallback& callback, |
| callback.Run(status ? storage::QuotaStatusCode::kQuotaStatusOk |
| : storage::QuotaStatusCode::kQuotaStatusUnknown); |
| } |
| + |
| +void AccumulateUsage(const QuotaClient::GetUsageCallback& callback, |
| + const std::vector<ServiceWorkerUsageInfo>& usage_info) { |
| + int64 usage_total = 0; |
| + for (const auto& info : usage_info) { |
| + usage_total += info.total_size_bytes; |
| + } |
| + callback.Run(usage_total); |
| +} |
| } // namespace |
| ServiceWorkerQuotaClient::ServiceWorkerQuotaClient( |
| @@ -52,8 +61,11 @@ void ServiceWorkerQuotaClient::GetOriginUsage( |
| const GURL& origin, |
| storage::StorageType type, |
| const GetUsageCallback& callback) { |
| - // TODO(dmurph): Add usage fetching when information is available. |
| - callback.Run(0); |
| + if (type != storage::StorageType::kStorageTypeTemporary) { |
| + callback.Run(0); |
| + return; |
| + } |
| + context_->GetAllOriginsInfo(base::Bind(&AccumulateUsage, callback)); |
|
michaeln
2014/10/24 23:15:47
The method is supposed to return the amount of dat
dmurph
2014/10/27 21:37:06
Done.
|
| } |
| void ServiceWorkerQuotaClient::GetOriginsForType( |