Index: chrome/browser/net/chrome_certificate_reporter.h |
diff --git a/chrome/browser/net/chrome_certificate_reporter.h b/chrome/browser/net/chrome_certificate_reporter.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..35c7680acd85b203ce727782d0602978df0ed3a4 |
--- /dev/null |
+++ b/chrome/browser/net/chrome_certificate_reporter.h |
@@ -0,0 +1,71 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_NET_CHROME_CERTIFICATE_REPORTER_H_ |
+#define CHROME_BROWSER_NET_CHROME_CERTIFICATE_REPORTER_H_ |
+ |
+#include <set> |
+#include <string> |
+ |
+#include "net/url_request/url_request.h" |
+ |
+namespace net { |
+class URLRequestContext; |
+} |
+ |
+namespace chrome_browser_net { |
+ |
+class CertLoggerRequest; |
+ |
+// Provides functionality for sending reports about invalid SSL |
+// certificate chains to a report collection server. |
+class ChromeCertificateReporter : public net::URLRequest::Delegate { |
estark
2015/03/04 17:33:49
Is this name confusingly similar to ChromeFraudule
felt
2015/03/04 19:15:47
It might make sense to name them something like:
Ryan Sleevi
2015/03/04 19:31:01
CertificateErrorReporter ?
Ryan Sleevi
2015/03/04 19:31:01
Eh, Chris named it for a reason, but I suppose tha
estark
2015/03/04 22:11:57
Now it's ChromeFraudulentCertificateReporter and C
|
+ public: |
+ explicit ChromeCertificateReporter(net::URLRequestContext* request_context, |
+ const std::string& upload_url); |
+ |
+ ~ChromeCertificateReporter() override; |
+ |
+ // Allows users of this class to override this and set their own URLRequest |
+ // type. Used by SendReport. |
+ virtual scoped_ptr<net::URLRequest> CreateURLRequest( |
+ net::URLRequestContext* context); |
+ |
+ // Construct, serialize, and send a certificate reporter to the report |
+ // collection server containing the |ssl_info| associated with a |
+ // connection to |hostname|. |
+ virtual void SendReport(const std::string& hostname, |
+ const net::SSLInfo& ssl_info); |
+ |
+ // net::URLRequest::Delegate |
+ void OnResponseStarted(net::URLRequest* request) override; |
+ void OnReadCompleted(net::URLRequest* request, int bytes_read) override; |
+ |
+ protected: |
+ // Populate the CertLoggerRequest for a report. |
+ static void BuildReport(const std::string& hostname, |
+ const net::SSLInfo& ssl_info, |
+ CertLoggerRequest& out_request); |
+ |
+ // Serialize and send a CertLoggerRequest protobuf to the report |
+ // collection server. |
+ void SendCertLoggerRequest(CertLoggerRequest& request); |
+ |
+ net::URLRequestContext* const request_context_; |
+ |
+ private: |
+ // Performs post-report cleanup. |
+ void RequestComplete(net::URLRequest* request); |
+ |
+ const GURL upload_url_; |
+ |
+ // Owns the contained requests. |
+ std::set<net::URLRequest*> inflight_requests_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(ChromeCertificateReporter); |
+}; |
+ |
+} // namespace chrome_browser_net |
+ |
+#endif // CHROME_BROWSER_NET_CHROME_CERTIFICATE_REPORTER_H_ |