OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_NET_CERTIFICATE_ERROR_REPORTER_H_ | |
6 #define CHROME_BROWSER_NET_CERTIFICATE_ERROR_REPORTER_H_ | |
7 | |
8 #include <set> | |
9 #include <string> | |
10 | |
11 #include "net/url_request/url_request.h" | |
12 | |
13 namespace net { | |
14 class URLRequestContext; | |
15 } | |
16 | |
17 namespace chrome_browser_net { | |
18 | |
19 class CertLoggerRequest; | |
20 | |
21 // Provides functionality for sending reports about invalid SSL | |
22 // certificate chains to a report collection server. | |
23 class CertificateErrorReporter : public net::URLRequest::Delegate { | |
24 public: | |
25 explicit CertificateErrorReporter(net::URLRequestContext* request_context, | |
26 const GURL& upload_url); | |
27 | |
28 ~CertificateErrorReporter() override; | |
29 | |
30 enum ReportType { | |
Ryan Sleevi
2015/03/06 00:21:32
STYLE: These go first ( http://google-styleguide.g
estark
2015/03/06 02:17:42
Done.
| |
31 REPORT_TYPE_PINNING_VIOLATION, | |
32 REPORT_TYPE_EXTENDED_REPORTING | |
33 }; | |
34 | |
35 // Allows users of this class to override this and set their own URLRequest | |
36 // type. Used by SendReport. | |
Ryan Sleevi
2015/03/06 00:21:32
Documentation: From reading the header, I'm not re
estark
2015/03/06 02:17:42
Ok, this was actually a bit broken. CertificateErr
| |
37 virtual scoped_ptr<net::URLRequest> CreateURLRequest( | |
38 net::URLRequestContext* context); | |
39 | |
40 // Construct, serialize, and send a certificate reporter to the report | |
41 // collection server containing the |ssl_info| associated with a | |
42 // connection to |hostname|. | |
43 virtual void SendReport(ReportType type, | |
44 const std::string& hostname, | |
45 const net::SSLInfo& ssl_info); | |
46 | |
47 // net::URLRequest::Delegate | |
48 void OnResponseStarted(net::URLRequest* request) override; | |
49 void OnReadCompleted(net::URLRequest* request, int bytes_read) override; | |
50 | |
51 protected: | |
52 // Populate the CertLoggerRequest for a report. | |
53 static void BuildReport(const std::string& hostname, | |
Ryan Sleevi
2015/03/06 00:21:32
Why is this static protected?
It seems like these
estark
2015/03/06 02:17:41
Done.
(Were you also asking why is it static, not
| |
54 const net::SSLInfo& ssl_info, | |
55 CertLoggerRequest& out_request); | |
56 | |
57 // Serialize and send a CertLoggerRequest protobuf to the report | |
58 // collection server. | |
59 void SendCertLoggerRequest(CertLoggerRequest& request); | |
60 | |
61 net::URLRequestContext* const request_context_; | |
Ryan Sleevi
2015/03/06 00:21:32
STYLE: Data members should be private ( http://goo
estark
2015/03/06 02:17:42
Done.
estark
2015/03/06 02:17:42
Done.
| |
62 | |
63 private: | |
64 // Performs post-report cleanup. | |
65 void RequestComplete(net::URLRequest* request); | |
66 | |
67 const GURL upload_url_; | |
68 | |
69 // Owns the contained requests. | |
70 std::set<net::URLRequest*> inflight_requests_; | |
71 | |
72 DISALLOW_COPY_AND_ASSIGN(CertificateErrorReporter); | |
73 }; | |
74 | |
75 } // namespace chrome_browser_net | |
76 | |
77 #endif // CHROME_BROWSER_NET_CERTIFICATE_ERROR_REPORTER_H_ | |
OLD | NEW |