Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2873)

Unified Diff: chrome/browser/net/certificate_error_reporter.h

Issue 935663004: Add checkbox for reporting invalid TLS/SSL cert chains (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: set callback to DoNothing close to where it's used Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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(

Powered by Google App Engine
This is Rietveld 408576698