Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / content / browser / cache_storage / cache_storage_quota_client.h
blob94df1d9f1a47cd43837d6614d45b3b77299a9a8f
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_CACHE_STORAGE_CACHE_STORAGE_QUOTA_CLIENT_H_
6 #define CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_QUOTA_CLIENT_H_
8 #include "base/memory/weak_ptr.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 storage {
14 class QuotaManagerProxy;
17 namespace content {
18 class CacheStorageManager;
20 // CacheStorageQuotaClient is owned by the QuotaManager. There is one per
21 // CacheStorageManager, and therefore one per
22 // ServiceWorkerContextCore.
23 class CONTENT_EXPORT CacheStorageQuotaClient : public storage::QuotaClient {
24 public:
25 explicit CacheStorageQuotaClient(
26 base::WeakPtr<CacheStorageManager> cache_manager);
27 ~CacheStorageQuotaClient() override;
29 // QuotaClient overrides
30 ID id() const override;
31 void OnQuotaManagerDestroyed() override;
32 void GetOriginUsage(const GURL& origin_url,
33 storage::StorageType type,
34 const GetUsageCallback& callback) override;
35 void GetOriginsForType(storage::StorageType type,
36 const GetOriginsCallback& callback) override;
37 void GetOriginsForHost(storage::StorageType type,
38 const std::string& host,
39 const GetOriginsCallback& callback) override;
40 void DeleteOriginData(const GURL& origin,
41 storage::StorageType type,
42 const DeletionCallback& callback) override;
43 bool DoesSupport(storage::StorageType type) const override;
45 private:
46 base::WeakPtr<CacheStorageManager> cache_manager_;
48 DISALLOW_COPY_AND_ASSIGN(CacheStorageQuotaClient);
51 } // namespace content
53 #endif // CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_QUOTA_CLIENT_H_