no bug - Bumping Firefox l10n changesets r=release a=l10n-bump DONTBUILD CLOSED TREE
[gecko.git] / dom / reporting / ReportDeliver.h
blobf5d3f0ab6ee5fdc66b9bb955f585981fa22708cb
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"
11 #include "nsITimer.h"
12 #include "nsString.h"
13 #include "nsTArray.h"
15 // XXX Avoid including this here by moving function bodies to the cpp file
16 #include "nsIPrincipal.h"
18 class nsIPrincipal;
19 class nsPIDOMWindowInner;
21 namespace mozilla::dom {
23 class ReportBody;
25 class ReportDeliver final : public nsIObserver,
26 public nsITimerCallback,
27 public nsINamed {
28 public:
29 NS_DECL_ISUPPORTS
30 NS_DECL_NSIOBSERVER
31 NS_DECL_NSITIMERCALLBACK
32 NS_DECL_NSINAMED
34 struct ReportData {
35 nsString mType;
36 nsString mGroupName;
37 nsString mURL;
38 nsCString mEndpointURL;
39 nsString mUserAgent;
40 TimeStamp mCreationTime;
41 nsCString mReportBodyJSON;
42 nsCOMPtr<nsIPrincipal> mPrincipal;
43 uint32_t mFailures;
46 static void Record(nsPIDOMWindowInner* aWindow, const nsAString& aType,
47 const nsAString& aGroupName, const nsAString& aURL,
48 ReportBody* aBody);
50 static void Fetch(const ReportData& aReportData);
52 void AppendReportData(const ReportData& aReportData);
54 private:
55 ReportDeliver();
56 ~ReportDeliver();
58 nsTArray<ReportData> mReportQueue;
60 nsCOMPtr<nsITimer> mTimer;
63 } // namespace mozilla::dom
65 #endif // mozilla_dom_ReportDeliver_h