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_dom_ReportDeliver_h
8 #define mozilla_dom_ReportDeliver_h
10 #include "nsIObserver.h"
15 // XXX Avoid including this here by moving function bodies to the cpp file
16 #include "nsIPrincipal.h"
19 class nsPIDOMWindowInner
;
21 namespace mozilla::dom
{
25 class ReportDeliver final
: public nsIObserver
,
26 public nsITimerCallback
,
31 NS_DECL_NSITIMERCALLBACK
38 nsCString mEndpointURL
;
40 TimeStamp mCreationTime
;
41 nsCString mReportBodyJSON
;
42 nsCOMPtr
<nsIPrincipal
> mPrincipal
;
46 static void Record(nsPIDOMWindowInner
* aWindow
, const nsAString
& aType
,
47 const nsAString
& aGroupName
, const nsAString
& aURL
,
50 static void Fetch(const ReportData
& aReportData
);
52 void AppendReportData(const ReportData
& aReportData
);
58 nsTArray
<ReportData
> mReportQueue
;
60 nsCOMPtr
<nsITimer
> mTimer
;
63 } // namespace mozilla::dom
65 #endif // mozilla_dom_ReportDeliver_h