Re-subimission of https://codereview.chromium.org/1041213003/
[chromium-blink-merge.git] / content / browser / service_worker / service_worker_quota_client.h
bloba1cf91ddb80625f689032c9c9e9ad1ae586b4ea3
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_QUOTA_CLIENT_H_
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_QUOTA_CLIENT_H_
8 #include "base/memory/ref_counted.h"
9 #include "content/common/content_export.h"
10 #include "storage/browser/quota/quota_client.h"
11 #include "storage/common/quota/quota_types.h"
13 namespace content {
14 class ServiceWorkerContextWrapper;
16 class ServiceWorkerQuotaClient : public storage::QuotaClient {
17 public:
18 ~ServiceWorkerQuotaClient() override;
20 // QuotaClient method overrides
21 ID id() const override;
22 void OnQuotaManagerDestroyed() override;
23 void GetOriginUsage(const GURL& origin,
24 storage::StorageType type,
25 const GetUsageCallback& callback) override;
26 void GetOriginsForType(storage::StorageType type,
27 const GetOriginsCallback& callback) override;
28 void GetOriginsForHost(storage::StorageType type,
29 const std::string& host,
30 const GetOriginsCallback& callback) override;
31 void DeleteOriginData(const GURL& origin,
32 storage::StorageType type,
33 const DeletionCallback& callback) override;
34 bool DoesSupport(storage::StorageType type) const override;
36 private:
37 friend class ServiceWorkerContextWrapper;
38 friend class ServiceWorkerQuotaClientTest;
40 CONTENT_EXPORT explicit ServiceWorkerQuotaClient(
41 ServiceWorkerContextWrapper* context);
43 scoped_refptr<ServiceWorkerContextWrapper> context_;
45 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerQuotaClient);
48 } // namespace content
50 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_QUOTA_CLIENT_H_