forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreporting_report.h
95 lines (72 loc) · 2.6 KB
/
reporting_report.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef NET_REPORTING_REPORTING_REPORT_H_
#define NET_REPORTING_REPORTING_REPORT_H_
#include <memory>
#include <string>
#include "base/time/time.h"
#include "net/base/net_export.h"
#include "url/gurl.h"
namespace base {
class Value;
} // namespace base
namespace net {
// An undelivered report.
struct NET_EXPORT ReportingReport {
public:
// Used in histograms; please add new items at end and do not reorder.
enum class Outcome {
UNKNOWN = 0,
DISCARDED_NO_URL_REQUEST_CONTEXT = 1,
DISCARDED_NO_REPORTING_SERVICE = 2,
ERASED_FAILED = 3,
ERASED_EXPIRED = 4,
ERASED_EVICTED = 5,
ERASED_NETWORK_CHANGED = 6,
ERASED_BROWSING_DATA_REMOVED = 7,
ERASED_REPORTING_SHUT_DOWN = 8,
DELIVERED = 9,
MAX
};
ReportingReport(const GURL& url,
const std::string& user_agent,
const std::string& group,
const std::string& type,
std::unique_ptr<const base::Value> body,
int depth,
base::TimeTicks queued,
int attempts);
~ReportingReport();
static void RecordReportDiscardedForNoURLRequestContext();
static void RecordReportDiscardedForNoReportingService();
void RecordOutcome(base::TimeTicks now);
// The URL of the document that triggered the report. (Included in the
// delivered report.)
GURL url;
// The User-Agent header that was used for the request.
std::string user_agent;
// The endpoint group that should be used to deliver the report. (Not included
// in the delivered report.)
std::string group;
// The type of the report. (Included in the delivered report.)
std::string type;
// The body of the report. (Included in the delivered report.)
std::unique_ptr<const base::Value> body;
// How many uploads deep the related request was: 0 if the related request was
// not an upload (or there was no related request), or n+1 if it was an upload
// reporting on requests of at most depth n.
int depth;
// When the report was queued. (Included in the delivered report as an age
// relative to the time of the delivery attempt.)
base::TimeTicks queued;
// The number of delivery attempts made so far, not including an active
// attempt. (Not included in the delivered report.)
int attempts = 0;
Outcome outcome;
private:
bool recorded_outcome;
DISALLOW_COPY_AND_ASSIGN(ReportingReport);
};
} // namespace net
#endif // NET_REPORTING_REPORTING_REPORT_H_