Chromium Code Reviews| Index: chrome/browser/net/certificate_error_reporter.h |
| diff --git a/chrome/browser/net/certificate_error_reporter.h b/chrome/browser/net/certificate_error_reporter.h |
| index 5463d5a74bd69d6286bbb8cbe1115fc78e8bcd41..4c46556e7a0fad1bffe6762dd17ad33806dd74ce 100644 |
| --- a/chrome/browser/net/certificate_error_reporter.h |
| +++ b/chrome/browser/net/certificate_error_reporter.h |
| @@ -9,6 +9,7 @@ |
| #include <string> |
| #include "base/macros.h" |
| +#include "base/memory/ref_counted.h" |
| #include "base/memory/scoped_ptr.h" |
| #include "net/url_request/url_request.h" |
| #include "url/gurl.h" |
| @@ -22,9 +23,13 @@ namespace chrome_browser_net { |
| class CertLoggerRequest; |
| +extern const char kExtendedReportingUploadUrl[]; |
| + |
| // Provides functionality for sending reports about invalid SSL |
| // certificate chains to a report collection server. |
| -class CertificateErrorReporter : public net::URLRequest::Delegate { |
| +class CertificateErrorReporter |
| + : public net::URLRequest::Delegate, |
| + public base::RefCountedThreadSafe<CertificateErrorReporter> { |
|
Ryan Sleevi
2015/03/14 03:09:42
Definitely don't want to do this
estark
2015/03/16 23:40:52
Done.
|
| public: |
| // These represent the types of reports that can be sent. |
| enum ReportType { |
| @@ -42,7 +47,11 @@ class CertificateErrorReporter : public net::URLRequest::Delegate { |
| CertificateErrorReporter(net::URLRequestContext* request_context, |
| const GURL& upload_url); |
| - ~CertificateErrorReporter() override; |
| + // Create a certificate error reporter that will send certificate |
| + // error reports to |upload_url|. A request context will have to be |
| + // specified when calling |SendReport|. Useful for constructing |
| + // reporters when not on the IO thread. |
| + explicit CertificateErrorReporter(const GURL& upload_url); |
| // Construct, serialize, and send a certificate reporter to the report |
| // collection server containing the |ssl_info| associated with a |
| @@ -50,12 +59,25 @@ class CertificateErrorReporter : public net::URLRequest::Delegate { |
| virtual void SendReport(ReportType type, |
| const std::string& hostname, |
| const net::SSLInfo& ssl_info); |
| + // Construct, serialize, and send a certificate reporter to the report |
|
felt
2015/03/13 19:18:11
Is this sending a cert "report", or a cert "report
estark
2015/03/16 23:40:52
Done.
|
| + // collection server containing the |ssl_info| associated with a |
| + // connection to |hostname|. Uses |request_context| as the context for |
| + // the request sent to the server. |
| + virtual void SendReport(ReportType type, |
| + net::URLRequestContext* request_context, |
| + 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: |
| + ~CertificateErrorReporter() override; |
| + |
| private: |
| + friend class base::RefCountedThreadSafe<CertificateErrorReporter>; |
| + |
| // Create a URLRequest with which to send a certificate report to the |
| // server. |
| virtual scoped_ptr<net::URLRequest> CreateURLRequest( |