tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

PrincipalUtils.h (1734B)


      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/. */
      6 
      7 #ifndef DOM_QUOTA_PRINCIPALUTILS_H_
      8 #define DOM_QUOTA_PRINCIPALUTILS_H_
      9 
     10 #include <cstdint>
     11 
     12 #include "nsStringFwd.h"
     13 
     14 class nsIPrincipal;
     15 class nsPIDOMWindowOuter;
     16 enum class nsresult : uint32_t;
     17 
     18 namespace mozilla {
     19 
     20 template <typename V, typename E>
     21 class Result;
     22 
     23 }
     24 
     25 namespace mozilla::ipc {
     26 
     27 class PrincipalInfo;
     28 
     29 }
     30 
     31 namespace mozilla::dom::quota {
     32 
     33 struct PrincipalMetadata;
     34 class QuotaManager;
     35 
     36 bool IsPrincipalInfoValid(const mozilla::ipc::PrincipalInfo& aPrincipalInfo);
     37 
     38 Result<PrincipalMetadata, nsresult> GetInfoFromValidatedPrincipalInfo(
     39    QuotaManager& aQuotaManager,
     40    const mozilla::ipc::PrincipalInfo& aPrincipalInfo);
     41 
     42 nsAutoCString GetGroupFromValidatedPrincipalInfo(
     43    const mozilla::ipc::PrincipalInfo& aPrincipalInfo);
     44 
     45 nsAutoCString GetOriginFromValidatedPrincipalInfo(
     46    const mozilla::ipc::PrincipalInfo& aPrincipalInfo);
     47 
     48 Result<PrincipalMetadata, nsresult> GetInfoFromPrincipal(
     49    nsIPrincipal* aPrincipal);
     50 
     51 Result<PrincipalMetadata, nsresult> GetInfoFromWindow(
     52    nsPIDOMWindowOuter* aWindow);
     53 
     54 Result<nsAutoCString, nsresult> GetOriginFromPrincipal(
     55    nsIPrincipal* aPrincipal);
     56 
     57 Result<nsAutoCString, nsresult> GetOriginFromWindow(
     58    nsPIDOMWindowOuter* aWindow);
     59 
     60 nsLiteralCString GetGroupForChrome();
     61 
     62 nsLiteralCString GetOriginForChrome();
     63 
     64 PrincipalMetadata GetInfoForChrome();
     65 
     66 }  // namespace mozilla::dom::quota
     67 
     68 #endif  // DOM_QUOTA_PRINCIPALUTILS_H_