Line data Source code
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/. */
6 :
7 : #ifndef DomainPolicy_h__
8 : #define DomainPolicy_h__
9 :
10 : #include "nsIDomainPolicy.h"
11 : #include "nsTHashtable.h"
12 : #include "nsURIHashKey.h"
13 :
14 : namespace mozilla {
15 :
16 : namespace ipc {
17 : class URIParams;
18 : } // namespace ipc
19 :
20 : enum DomainSetChangeType{
21 : ACTIVATE_POLICY,
22 : DEACTIVATE_POLICY,
23 : ADD_DOMAIN,
24 : REMOVE_DOMAIN,
25 : CLEAR_DOMAINS
26 : };
27 :
28 : enum DomainSetType{
29 : NO_TYPE,
30 : BLACKLIST,
31 : SUPER_BLACKLIST,
32 : WHITELIST,
33 : SUPER_WHITELIST
34 : };
35 :
36 : class DomainSet final : public nsIDomainSet
37 : {
38 : public:
39 : NS_DECL_ISUPPORTS
40 : NS_DECL_NSIDOMAINSET
41 :
42 0 : explicit DomainSet(DomainSetType aType)
43 0 : : mType(aType)
44 0 : {}
45 :
46 : void CloneSet(InfallibleTArray<mozilla::ipc::URIParams>* aDomains);
47 :
48 : protected:
49 0 : virtual ~DomainSet() {}
50 : nsTHashtable<nsURIHashKey> mHashTable;
51 : DomainSetType mType;
52 : };
53 :
54 : class DomainPolicy final : public nsIDomainPolicy
55 : {
56 : public:
57 : NS_DECL_ISUPPORTS
58 : NS_DECL_NSIDOMAINPOLICY
59 : DomainPolicy();
60 :
61 : private:
62 : virtual ~DomainPolicy();
63 :
64 : RefPtr<DomainSet> mBlacklist;
65 : RefPtr<DomainSet> mSuperBlacklist;
66 : RefPtr<DomainSet> mWhitelist;
67 : RefPtr<DomainSet> mSuperWhitelist;
68 : };
69 :
70 : } /* namespace mozilla */
71 :
72 : #endif /* DomainPolicy_h__ */
|