Chromium Code Reviews| 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 "base/gtest_prod_util.h" | |
| 12 #include "net/url_request/url_request.h" | |
| 13 | |
| 14 namespace net { | |
| 15 class URLRequestContext; | |
| 16 } | |
| 17 | |
| 18 namespace chrome_browser_net { | |
| 19 | |
| 20 class CertLoggerRequest; | |
| 21 | |
| 22 // Provides functionality for sending reports about invalid SSL | |
| 23 // certificate chains to a report collection server. | |
| 24 class CertificateErrorReporter : public net::URLRequest::Delegate { | |
| 25 public: | |
| 26 enum ReportType { | |
| 27 REPORT_TYPE_PINNING_VIOLATION, | |
| 28 REPORT_TYPE_EXTENDED_REPORTING | |
| 29 }; | |
| 30 | |
| 31 CertificateErrorReporter(net::URLRequestContext* request_context, | |
| 32 const GURL& upload_url); | |
|
Ryan Sleevi
2015/03/09 22:14:06
Missing include for "url/gurl.h" ( needed because
estark
2015/03/09 23:21:17
Done. Is there a tool that you use to catch these
Ryan Sleevi
2015/03/09 23:44:56
Just by looking. There used to be Include What You
| |
| 33 | |
| 34 ~CertificateErrorReporter() override; | |
| 35 | |
| 36 // Construct, serialize, and send a certificate reporter to the report | |
| 37 // collection server containing the |ssl_info| associated with a | |
| 38 // connection to |hostname|. | |
| 39 virtual void SendReport(ReportType type, | |
| 40 const std::string& hostname, | |
| 41 const net::SSLInfo& ssl_info); | |
|
Ryan Sleevi
2015/03/09 22:14:06
Missing forward declaration of SSLInfo
estark
2015/03/09 23:21:17
Done.
| |
| 42 | |
| 43 // net::URLRequest::Delegate | |
| 44 void OnResponseStarted(net::URLRequest* request) override; | |
| 45 void OnReadCompleted(net::URLRequest* request, int bytes_read) override; | |
| 46 | |
| 47 private: | |
| 48 // Allow tests to access private data members. | |
| 49 FRIEND_TEST_ALL_PREFIXES(CertificateErrorReporterTest, | |
| 50 ReportIsBuiltCorrectly); | |
| 51 | |
| 52 // Create a URLRequest with which to send a certificate report to the | |
| 53 // server. | |
| 54 virtual scoped_ptr<net::URLRequest> CreateURLRequest( | |
|
Ryan Sleevi
2015/03/09 22:14:06
Missing include of scoped_ptr
(As you fix all the
estark
2015/03/09 23:21:17
Done.
| |
| 55 net::URLRequestContext* context); | |
| 56 | |
| 57 // Serialize and send a CertLoggerRequest protobuf to the report | |
| 58 // collection server. | |
| 59 void SendCertLoggerRequest(CertLoggerRequest& request); | |
|
Ryan Sleevi
2015/03/09 22:14:06
STYLE: Not allowed to pass non-const references -
estark
2015/03/09 23:21:16
Done.
| |
| 60 | |
| 61 // Populate the CertLoggerRequest for a report. | |
| 62 static void BuildReport(const std::string& hostname, | |
| 63 const net::SSLInfo& ssl_info, | |
| 64 CertLoggerRequest& out_request); | |
|
Ryan Sleevi
2015/03/09 22:14:06
STYLE: Not allowed to pass non-const references
ht
estark
2015/03/09 23:21:17
Done.
| |
| 65 | |
| 66 // Performs post-report cleanup. | |
| 67 void RequestComplete(net::URLRequest* request); | |
| 68 | |
| 69 net::URLRequestContext* const request_context_; | |
| 70 const GURL upload_url_; | |
| 71 | |
| 72 // Owns the contained requests. | |
| 73 std::set<net::URLRequest*> inflight_requests_; | |
| 74 | |
| 75 DISALLOW_COPY_AND_ASSIGN(CertificateErrorReporter); | |
| 76 }; | |
| 77 | |
| 78 } // namespace chrome_browser_net | |
| 79 | |
| 80 #endif // CHROME_BROWSER_NET_CERTIFICATE_ERROR_REPORTER_H_ | |
| OLD | NEW |