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

Unified Diff: content/browser/service_worker/service_worker_quota_client.cc

Issue 654323003: Revert of Added quota client for serviceworker. Enables 'clear past <time> data'. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
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
deleted file mode 100644
index e2697e2303a62054a46c8736bac95798123ba30d..0000000000000000000000000000000000000000
--- a/content/browser/service_worker/service_worker_quota_client.cc
+++ /dev/null
@@ -1,95 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-#include "content/browser/service_worker/service_worker_quota_client.h"
-
-#include "base/bind.h"
-#include "content/browser/service_worker/service_worker_context_wrapper.h"
-#include "content/public/browser/browser_thread.h"
-
-using storage::QuotaClient;
-
-namespace content {
-namespace {
-void ReportOrigins(const QuotaClient::GetOriginsCallback& callback,
- bool restrict_on_host,
- const std::string host,
- const std::vector<ServiceWorkerUsageInfo>& usage_info) {
- std::set<GURL> origins;
- for (const ServiceWorkerUsageInfo& info : usage_info) {
- if (restrict_on_host && info.origin.host() != host) {
- continue;
- }
- origins.insert(info.origin);
- }
- callback.Run(origins);
-}
-
-void ReportToQuotaStatus(const QuotaClient::DeletionCallback& callback,
- bool status) {
- callback.Run(status ? storage::QuotaStatusCode::kQuotaStatusOk
- : storage::QuotaStatusCode::kQuotaStatusUnknown);
-}
-} // namespace
-
-ServiceWorkerQuotaClient::ServiceWorkerQuotaClient(
- ServiceWorkerContextWrapper* context)
- : context_(context) {
-}
-
-ServiceWorkerQuotaClient::~ServiceWorkerQuotaClient() {
-}
-
-QuotaClient::ID ServiceWorkerQuotaClient::id() const {
- return QuotaClient::kServiceWorker;
-}
-
-void ServiceWorkerQuotaClient::OnQuotaManagerDestroyed() {
- delete this;
-}
-
-void ServiceWorkerQuotaClient::GetOriginUsage(
- const GURL& origin,
- storage::StorageType type,
- const GetUsageCallback& callback) {
- // TODO(dmurph): Add usage fetching when information is available.
- callback.Run(0);
-}
-
-void ServiceWorkerQuotaClient::GetOriginsForType(
- storage::StorageType type,
- const GetOriginsCallback& callback) {
- if (type != storage::StorageType::kStorageTypeTemporary) {
- callback.Run(std::set<GURL>());
- return;
- }
- context_->GetAllOriginsInfo(base::Bind(&ReportOrigins, callback, false, ""));
-}
-
-void ServiceWorkerQuotaClient::GetOriginsForHost(
- storage::StorageType type,
- const std::string& host,
- const GetOriginsCallback& callback) {
- if (type != storage::StorageType::kStorageTypeTemporary) {
- callback.Run(std::set<GURL>());
- return;
- }
- context_->GetAllOriginsInfo(base::Bind(&ReportOrigins, callback, true, host));
-}
-
-void ServiceWorkerQuotaClient::DeleteOriginData(
- const GURL& origin,
- storage::StorageType type,
- const DeletionCallback& callback) {
- if (type != storage::StorageType::kStorageTypeTemporary) {
- callback.Run(storage::QuotaStatusCode::kQuotaStatusOk);
- return;
- }
- context_->DeleteForOrigin(origin, base::Bind(&ReportToQuotaStatus, callback));
-}
-
-bool ServiceWorkerQuotaClient::DoesSupport(storage::StorageType type) const {
- return type == storage::StorageType::kStorageTypeTemporary;
-}
-
-} // namespace content
« no previous file with comments | « content/browser/service_worker/service_worker_quota_client.h ('k') | content/browser/service_worker/service_worker_storage.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698