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 mozilla_PartitioningExceptionList_h
8 #define mozilla_PartitioningExceptionList_h
11 #include "nsIPartitioningExceptionListService.h"
20 class PartitioningExceptionList
: public nsIPartitioningExceptionListObserver
{
23 NS_DECL_NSIPARTITIONINGEXCEPTIONLISTOBSERVER
25 static bool Check(const nsACString
& aFirstPartyOrigin
,
26 const nsACString
& aThirdPartyOrigin
);
29 static PartitioningExceptionList
* GetOrCreate();
31 PartitioningExceptionList() = default;
32 virtual ~PartitioningExceptionList() = default;
37 struct PartitionExceptionListPattern
{
40 bool mIsWildCard
= false;
43 struct PartitionExceptionListEntry
{
44 PartitionExceptionListPattern mFirstParty
;
45 PartitionExceptionListPattern mThirdParty
;
48 static nsresult
GetSchemeFromOrigin(const nsACString
& aOrigin
,
50 nsACString
& aOriginNoScheme
);
52 static bool OriginMatchesPattern(
53 const nsACString
& aOrigin
, const PartitionExceptionListPattern
& aPattern
);
55 static nsresult
GetExceptionListPattern(
56 const nsACString
& aOriginPattern
,
57 PartitionExceptionListPattern
& aPattern
);
59 nsCOMPtr
<nsIPartitioningExceptionListService
> mService
;
60 nsTArray
<PartitionExceptionListEntry
> mExceptionList
;
63 } // namespace mozilla
65 #endif // mozilla_PartitioningExceptionList_h