Bug 1457047 [wpt PR 10645] - Update webidl2.js to v10.2.1, a=testonly
[gecko.git] / caps / DomainPolicy.h
blob86648fe0bc66e01ec665aa9c06c673681d564b84
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* vim: set ts=8 sts=4 et sw=4 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 DomainPolicy_h__
8 #define DomainPolicy_h__
10 #include "nsIDomainPolicy.h"
11 #include "nsTHashtable.h"
12 #include "nsURIHashKey.h"
14 namespace mozilla {
16 namespace ipc {
17 class URIParams;
18 } // namespace ipc
20 enum DomainSetChangeType{
21 ACTIVATE_POLICY,
22 DEACTIVATE_POLICY,
23 ADD_DOMAIN,
24 REMOVE_DOMAIN,
25 CLEAR_DOMAINS
28 enum DomainSetType{
29 NO_TYPE,
30 BLACKLIST,
31 SUPER_BLACKLIST,
32 WHITELIST,
33 SUPER_WHITELIST
36 class DomainSet final : public nsIDomainSet
38 public:
39 NS_DECL_ISUPPORTS
40 NS_DECL_NSIDOMAINSET
42 explicit DomainSet(DomainSetType aType)
43 : mType(aType)
46 void CloneSet(InfallibleTArray<mozilla::ipc::URIParams>* aDomains);
48 protected:
49 virtual ~DomainSet() {}
50 nsTHashtable<nsURIHashKey> mHashTable;
51 DomainSetType mType;
54 class DomainPolicy final : public nsIDomainPolicy
56 public:
57 NS_DECL_ISUPPORTS
58 NS_DECL_NSIDOMAINPOLICY
59 DomainPolicy();
61 private:
62 virtual ~DomainPolicy();
64 RefPtr<DomainSet> mBlacklist;
65 RefPtr<DomainSet> mSuperBlacklist;
66 RefPtr<DomainSet> mWhitelist;
67 RefPtr<DomainSet> mSuperWhitelist;
70 } /* namespace mozilla */
72 #endif /* DomainPolicy_h__ */