OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef NET_URL_REQUEST_REPORT_SENDER_H_ | 5 #ifndef NET_URL_REQUEST_REPORT_SENDER_H_ |
6 #define NET_URL_REQUEST_REPORT_SENDER_H_ | 6 #define NET_URL_REQUEST_REPORT_SENDER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
(...skipping 13 matching lines...) Expand all Loading... |
24 // ReportSender asynchronously sends serialized reports to a URI. | 24 // ReportSender asynchronously sends serialized reports to a URI. |
25 // It takes serialized reports as a sequence of bytes so as to be agnostic to | 25 // It takes serialized reports as a sequence of bytes so as to be agnostic to |
26 // the format of the report being sent (JSON, protobuf, etc.) and the particular | 26 // the format of the report being sent (JSON, protobuf, etc.) and the particular |
27 // data that it contains. Multiple reports can be in-flight at once. This class | 27 // data that it contains. Multiple reports can be in-flight at once. This class |
28 // owns inflight requests and cleans them up when necessary. | 28 // owns inflight requests and cleans them up when necessary. |
29 class NET_EXPORT ReportSender | 29 class NET_EXPORT ReportSender |
30 : public URLRequest::Delegate, | 30 : public URLRequest::Delegate, |
31 public TransportSecurityState::ReportSenderInterface { | 31 public TransportSecurityState::ReportSenderInterface { |
32 public: | 32 public: |
33 using SuccessCallback = base::Callback<void()>; | 33 using SuccessCallback = base::Callback<void()>; |
34 using ErrorCallback = base::Callback<void(const GURL&, int)>; | 34 using ErrorCallback = base::Callback< |
| 35 void(const GURL&, int /* net_error */, int /* http_response_code */)>; |
35 | 36 |
36 // Represents whether or not to send cookies along with reports. | 37 // Represents whether or not to send cookies along with reports. |
37 enum CookiesPreference { SEND_COOKIES, DO_NOT_SEND_COOKIES }; | 38 enum CookiesPreference { SEND_COOKIES, DO_NOT_SEND_COOKIES }; |
38 | 39 |
39 // Constructs a ReportSender that sends reports with the | 40 // Constructs a ReportSender that sends reports with the |
40 // given |request_context| and includes or excludes cookies based on | 41 // given |request_context| and includes or excludes cookies based on |
41 // |cookies_preference|. |request_context| must outlive the | 42 // |cookies_preference|. |request_context| must outlive the |
42 // ReportSender. | 43 // ReportSender. |
43 ReportSender(URLRequestContext* request_context, | 44 ReportSender(URLRequestContext* request_context, |
44 CookiesPreference cookies_preference); | 45 CookiesPreference cookies_preference); |
(...skipping 17 matching lines...) Expand all Loading... |
62 CookiesPreference cookies_preference_; | 63 CookiesPreference cookies_preference_; |
63 | 64 |
64 std::map<URLRequest*, std::unique_ptr<URLRequest>> inflight_requests_; | 65 std::map<URLRequest*, std::unique_ptr<URLRequest>> inflight_requests_; |
65 | 66 |
66 DISALLOW_COPY_AND_ASSIGN(ReportSender); | 67 DISALLOW_COPY_AND_ASSIGN(ReportSender); |
67 }; | 68 }; |
68 | 69 |
69 } // namespace net | 70 } // namespace net |
70 | 71 |
71 #endif // NET_URL_REQUEST_REPORT_SENDER_H_ | 72 #endif // NET_URL_REQUEST_REPORT_SENDER_H_ |
OLD | NEW |