1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef DOM_QUOTA_QUOTAUSAGEREQUESTBASE_H_
8 #define DOM_QUOTA_QUOTAUSAGEREQUESTBASE_H_
10 #include "NormalOriginOperationBase.h"
11 #include "mozilla/dom/quota/PersistenceType.h"
12 #include "mozilla/dom/quota/PQuotaUsageRequestParent.h"
18 template <typename V
, typename E
>
21 namespace dom::quota
{
23 struct OriginMetadata
;
25 class UsageRequestResponse
;
27 class QuotaUsageRequestBase
: public NormalOriginOperationBase
,
28 public PQuotaUsageRequestParent
{
30 QuotaUsageRequestBase(MovingNotNull
<RefPtr
<QuotaManager
>> aQuotaManager
,
32 : NormalOriginOperationBase(std::move(aQuotaManager
), aName
) {}
34 mozilla::Result
<UsageInfo
, nsresult
> GetUsageForOrigin(
35 QuotaManager
& aQuotaManager
, PersistenceType aPersistenceType
,
36 const OriginMetadata
& aOriginMetadata
);
38 // Subclasses use this override to set the IPDL response value.
39 virtual void GetResponse(UsageRequestResponse
& aResponse
) = 0;
42 mozilla::Result
<UsageInfo
, nsresult
> GetUsageForOriginEntries(
43 QuotaManager
& aQuotaManager
, PersistenceType aPersistenceType
,
44 const OriginMetadata
& aOriginMetadata
, nsIFile
& aDirectory
,
47 void SendResults() override
;
50 void ActorDestroy(ActorDestroyReason aWhy
) override
;
52 mozilla::ipc::IPCResult
RecvCancel() final
;
55 } // namespace dom::quota
56 } // namespace mozilla
58 #endif // DOM_QUOTA_QUOTAUSAGEREQUESTBASE_H_