Backed out changeset f594e6f00208 (bug 1940883) for causing crashes in bug 1941164.
[gecko.git] / dom / quota / PrincipalUtils.h
blob06b6ef2c9ab9e40f7d4c5c450ace22bb650c8327
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
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef DOM_QUOTA_PRINCIPALUTILS_H_
8 #define DOM_QUOTA_PRINCIPALUTILS_H_
10 #include <cstdint>
12 #include "nsStringFwd.h"
14 class nsIPrincipal;
15 class nsPIDOMWindowOuter;
16 enum class nsresult : uint32_t;
18 namespace mozilla {
20 template <typename V, typename E>
21 class Result;
25 namespace mozilla::ipc {
27 class PrincipalInfo;
31 namespace mozilla::dom::quota {
33 struct PrincipalMetadata;
34 class QuotaManager;
36 bool IsPrincipalInfoValid(const mozilla::ipc::PrincipalInfo& aPrincipalInfo);
38 Result<PrincipalMetadata, nsresult> GetInfoFromValidatedPrincipalInfo(
39 QuotaManager& aQuotaManager,
40 const mozilla::ipc::PrincipalInfo& aPrincipalInfo);
42 nsAutoCString GetGroupFromValidatedPrincipalInfo(
43 const mozilla::ipc::PrincipalInfo& aPrincipalInfo);
45 nsAutoCString GetOriginFromValidatedPrincipalInfo(
46 const mozilla::ipc::PrincipalInfo& aPrincipalInfo);
48 Result<PrincipalMetadata, nsresult> GetInfoFromPrincipal(
49 nsIPrincipal* aPrincipal);
51 Result<PrincipalMetadata, nsresult> GetInfoFromWindow(
52 nsPIDOMWindowOuter* aWindow);
54 Result<nsAutoCString, nsresult> GetOriginFromPrincipal(
55 nsIPrincipal* aPrincipal);
57 Result<nsAutoCString, nsresult> GetOriginFromWindow(
58 nsPIDOMWindowOuter* aWindow);
60 nsLiteralCString GetGroupForChrome();
62 nsLiteralCString GetOriginForChrome();
64 PrincipalMetadata GetInfoForChrome();
66 } // namespace mozilla::dom::quota
68 #endif // DOM_QUOTA_PRINCIPALUTILS_H_