Bug 1472338: part 2) Change `clipboard.readText()` to read from the clipboard asynchr...
[gecko.git] / dom / reporting / ReportDeliver.h
blob0f82d7e1921e969afad7029e50ab15db6105d3c4
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 {
22 namespace dom {
24 class ReportBody;
26 class ReportDeliver final : public nsIObserver,
27 public nsITimerCallback,
28 public nsINamed {
29 public:
30 NS_DECL_ISUPPORTS
31 NS_DECL_NSIOBSERVER
32 NS_DECL_NSITIMERCALLBACK
33 NS_DECL_NSINAMED
35 struct ReportData {
36 nsString mType;
37 nsString mGroupName;
38 nsString mURL;
39 nsCString mEndpointURL;
40 nsString mUserAgent;
41 TimeStamp mCreationTime;
42 nsCString mReportBodyJSON;
43 nsCOMPtr<nsIPrincipal> mPrincipal;
44 uint32_t mFailures;
47 static void Record(nsPIDOMWindowInner* aWindow, const nsAString& aType,
48 const nsAString& aGroupName, const nsAString& aURL,
49 ReportBody* aBody);
51 static void Fetch(const ReportData& aReportData);
53 void AppendReportData(const ReportData& aReportData);
55 private:
56 ReportDeliver();
57 ~ReportDeliver();
59 nsTArray<ReportData> mReportQueue;
61 nsCOMPtr<nsITimer> mTimer;
64 } // namespace dom
65 } // namespace mozilla
67 #endif // mozilla_dom_ReportDeliver_h