Bug 1943650 - Command-line --help output misformatted after --dbus-service. r=emilio
[gecko.git] / toolkit / components / antitracking / bouncetrackingprotection / BounceTrackingMapEntry.h
blobb07ed8c595dff86b6e497c585094b1812e1b0a41
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 mozilla_BounceTrackingMapEntry_h
8 #define mozilla_BounceTrackingMapEntry_h
10 #include "mozilla/OriginAttributes.h"
11 #include "nsIBounceTrackingMapEntry.h"
12 #include "nsString.h"
14 namespace mozilla {
16 /**
17 * Represents an entry in the global bounce tracker or user activation map.
19 class BTPMapEntry {
20 public:
21 OriginAttributes& OriginAttributesRef() { return mOriginAttributes; }
23 nsACString& SiteHostRef() { return mSiteHost; }
25 PRTime& TimeStampRef() { return mTimeStamp; }
27 protected:
28 BTPMapEntry(const OriginAttributes& aOriginAttributes,
29 const nsACString& aSiteHost, PRTime aTimeStamp)
30 : mOriginAttributes(aOriginAttributes),
31 mSiteHost(aSiteHost),
32 mTimeStamp(aTimeStamp) {}
34 OriginAttributes mOriginAttributes;
35 nsAutoCString mSiteHost;
36 PRTime mTimeStamp;
39 class BounceTrackingMapEntry final : public BTPMapEntry,
40 public nsIBounceTrackingMapEntry {
41 public:
42 NS_DECL_ISUPPORTS
43 NS_DECL_NSIBOUNCETRACKINGMAPENTRY
45 BounceTrackingMapEntry(const OriginAttributes& aOriginAttributes,
46 const nsACString& aSiteHost, PRTime aTimeStamp)
47 : BTPMapEntry(aOriginAttributes, aSiteHost, aTimeStamp) {}
49 private:
50 ~BounceTrackingMapEntry() = default;
53 /**
54 * Represents a log entry for a purged bounce tracker. Extends
55 * BounceTrackingMapEntry with the time of purge.
57 class BounceTrackingPurgeEntry final : public BTPMapEntry,
58 public nsIBounceTrackingPurgeEntry {
59 public:
60 NS_DECL_ISUPPORTS
61 NS_DECL_NSIBOUNCETRACKINGMAPENTRY
62 NS_DECL_NSIBOUNCETRACKINGPURGEENTRY
63 BounceTrackingPurgeEntry(const OriginAttributes& aOriginAttributes,
64 const nsACString& aSiteHost, PRTime aBounceTime,
65 PRTime aPurgeTime)
66 : BTPMapEntry(aOriginAttributes, aSiteHost, aBounceTime),
67 mPurgeTime(aPurgeTime) {}
69 PRTime& BounceTimeRef() { return mTimeStamp; }
71 PRTime& PurgeTimeRef() { return mPurgeTime; }
73 const PRTime& PurgeTimeRefConst() const { return mPurgeTime; }
75 private:
76 ~BounceTrackingPurgeEntry() = default;
77 // Timestamp of when the purge completed. mTimeStamp is the time of when the
78 // bounce ocurred.
79 PRTime mPurgeTime;
82 } // namespace mozilla
84 #endif