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"
14 class QuotaManagerProxy
;
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
{
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
;
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_