OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef NET_REPORTING_REPORTING_DELEGATE_H_ | |
6 #define NET_REPORTING_REPORTING_DELEGATE_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "base/values.h" | |
11 #include "url/gurl.h" | |
12 | |
13 namespace net { | |
14 | |
15 // Interface by which other parts of the network stack (and perhaps the embedder | |
16 // thereof) can queue reports, and by which the network stack can notify the | |
17 // Reporting implementation of received "Report-To" headers. | |
18 class NET_EXPORT ReportingDelegate { | |
19 public: | |
20 virtual ~ReportingDelegate() = default; | |
21 | |
22 // Notifies the Reporting implementation that a report has been generated | |
23 // elsewhere in the network stack or embedder (and should, ideally, be queued | |
24 // for delivery). | |
25 // | |
26 // |url| is the URL of the document that caused the report. | |
27 // | |
28 // |group| is the group of endpoints to which the report should be delivered. | |
29 // | |
30 // |type| is the type of report; the Reporting API itself does not specify any | |
31 // pre-defined types. | |
32 // | |
33 // |body| is any additional data to include in the report, as a Value that the | |
34 // Reporting implementation will take ownership of, and that will be | |
shivanisha
2017/03/15 23:38:01
reporting does not need to start with capital lett
| |
35 // serialized to JSON when the report is delivered. | |
36 virtual void OnReportGenerated(const GURL& url, | |
37 const std::string& group, | |
38 const std::string& type, | |
39 std::unique_ptr<const base::Value> body) = 0; | |
40 | |
41 // Notifies the Reporting implementation that at least one Report-To header | |
42 // has been observed in the response headers of an HTTP request. | |
43 // | |
44 // |url| is the URL of the request whose response contained the header(s). | |
45 // | |
46 // |value| is the normalized (multiple instances joined with commas) value of | |
47 // the header (e.g. as returned by HttpResponseHeaders::GetNormalizedHeader). | |
48 virtual void OnHeaderReceived(const GURL& url, const std::string& value) = 0; | |
49 | |
50 protected: | |
51 ReportingDelegate() = default; | |
52 | |
53 private: | |
54 DISALLOW_COPY_AND_ASSIGN(ReportingDelegate); | |
55 }; | |
56 | |
57 } // namespace net | |
58 | |
59 #endif // NET_REPORTING_REPORTING_DELEGATE_H_ | |
OLD | NEW |