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 CHROME_BROWSER_NET_CERTIFICATE_ERROR_REPORTER_H_ | 5 #ifndef CHROME_BROWSER_NET_CERTIFICATE_ERROR_REPORTER_H_ |
6 #define CHROME_BROWSER_NET_CERTIFICATE_ERROR_REPORTER_H_ | 6 #define CHROME_BROWSER_NET_CERTIFICATE_ERROR_REPORTER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 // These represent the types of reports that can be sent. | 29 // These represent the types of reports that can be sent. |
30 enum ReportType { | 30 enum ReportType { |
31 // A report of a certificate chain that failed a certificate pinning | 31 // A report of a certificate chain that failed a certificate pinning |
32 // check. | 32 // check. |
33 REPORT_TYPE_PINNING_VIOLATION, | 33 REPORT_TYPE_PINNING_VIOLATION, |
34 // A report for an invalid certificate chain that is being sent for | 34 // A report for an invalid certificate chain that is being sent for |
35 // a user who has opted-in to the extended reporting program. | 35 // a user who has opted-in to the extended reporting program. |
36 REPORT_TYPE_EXTENDED_REPORTING | 36 REPORT_TYPE_EXTENDED_REPORTING |
37 }; | 37 }; |
38 | 38 |
| 39 // Represents whether or not to send cookies along with reports sent |
| 40 // to the server. |
| 41 enum CookiesPreference { SEND_COOKIES, DO_NOT_SEND_COOKIES }; |
| 42 |
39 // Create a certificate error reporter that will send certificate | 43 // Create a certificate error reporter that will send certificate |
40 // error reports to |upload_url|, using |request_context| as the | 44 // error reports to |upload_url|, using |request_context| as the |
41 // context for the reports. | 45 // context for the reports. |cookies_preference| controls whether |
| 46 // cookies will be sent along with the reports. |
42 CertificateErrorReporter(net::URLRequestContext* request_context, | 47 CertificateErrorReporter(net::URLRequestContext* request_context, |
43 const GURL& upload_url); | 48 const GURL& upload_url, |
| 49 CookiesPreference cookies_preference); |
44 | 50 |
45 ~CertificateErrorReporter() override; | 51 ~CertificateErrorReporter() override; |
46 | 52 |
47 // Construct, serialize, and send a certificate reporter to the report | 53 // Construct, serialize, and send a certificate report to the report |
48 // collection server containing the |ssl_info| associated with a | 54 // collection server containing the |ssl_info| associated with a |
49 // connection to |hostname|. | 55 // connection to |hostname|. |
50 virtual void SendReport(ReportType type, | 56 virtual void SendReport(ReportType type, |
51 const std::string& hostname, | 57 const std::string& hostname, |
52 const net::SSLInfo& ssl_info); | 58 const net::SSLInfo& ssl_info); |
53 | 59 |
54 // net::URLRequest::Delegate | 60 // net::URLRequest::Delegate |
55 void OnResponseStarted(net::URLRequest* request) override; | 61 void OnResponseStarted(net::URLRequest* request) override; |
56 void OnReadCompleted(net::URLRequest* request, int bytes_read) override; | 62 void OnReadCompleted(net::URLRequest* request, int bytes_read) override; |
57 | 63 |
(...skipping 14 matching lines...) Expand all Loading... |
72 | 78 |
73 // Performs post-report cleanup. | 79 // Performs post-report cleanup. |
74 void RequestComplete(net::URLRequest* request); | 80 void RequestComplete(net::URLRequest* request); |
75 | 81 |
76 net::URLRequestContext* const request_context_; | 82 net::URLRequestContext* const request_context_; |
77 const GURL upload_url_; | 83 const GURL upload_url_; |
78 | 84 |
79 // Owns the contained requests. | 85 // Owns the contained requests. |
80 std::set<net::URLRequest*> inflight_requests_; | 86 std::set<net::URLRequest*> inflight_requests_; |
81 | 87 |
| 88 CookiesPreference cookies_preference_; |
| 89 |
82 DISALLOW_COPY_AND_ASSIGN(CertificateErrorReporter); | 90 DISALLOW_COPY_AND_ASSIGN(CertificateErrorReporter); |
83 }; | 91 }; |
84 | 92 |
85 } // namespace chrome_browser_net | 93 } // namespace chrome_browser_net |
86 | 94 |
87 #endif // CHROME_BROWSER_NET_CERTIFICATE_ERROR_REPORTER_H_ | 95 #endif // CHROME_BROWSER_NET_CERTIFICATE_ERROR_REPORTER_H_ |
OLD | NEW |