| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ssl/chrome_fraudulent_certificate_reporter.h" | 5 #include "chrome/browser/ssl/chrome_fraudulent_certificate_reporter.h" |
| 6 | 6 |
| 7 #include "base/profiler/scoped_tracker.h" | 7 #include "base/profiler/scoped_tracker.h" |
| 8 #include "chrome/browser/net/certificate_error_reporter.h" | 8 #include "chrome/browser/net/certificate_error_reporter.h" |
| 9 #include "chrome/browser/ssl/certificate_error_report.h" | 9 #include "chrome/browser/ssl/certificate_error_report.h" |
| 10 #include "net/http/certificate_report_sender.h" |
| 10 #include "net/ssl/ssl_info.h" | 11 #include "net/ssl/ssl_info.h" |
| 11 #include "net/url_request/url_request_context.h" | 12 #include "net/url_request/url_request_context.h" |
| 12 #include "url/gurl.h" | 13 #include "url/gurl.h" |
| 13 | 14 |
| 14 namespace { | 15 namespace { |
| 15 | 16 |
| 16 // TODO(palmer): Switch to HTTPS when the error handling delegate is more | 17 // TODO(palmer): Switch to HTTPS when the error handling delegate is more |
| 17 // sophisticated. Ultimately we plan to attempt the report on many transports. | 18 // sophisticated. Ultimately we plan to attempt the report on many transports. |
| 18 const char kFraudulentCertificateUploadEndpoint[] = | 19 const char kFraudulentCertificateUploadEndpoint[] = |
| 19 "http://clients3.google.com/log_cert_error"; | 20 "http://clients3.google.com/log_cert_error"; |
| 20 | 21 |
| 21 } // namespace | 22 } // namespace |
| 22 | 23 |
| 23 ChromeFraudulentCertificateReporter::ChromeFraudulentCertificateReporter( | 24 ChromeFraudulentCertificateReporter::ChromeFraudulentCertificateReporter( |
| 24 net::URLRequestContext* request_context) | 25 net::URLRequestContext* request_context) |
| 25 : certificate_reporter_(new chrome_browser_net::CertificateErrorReporter( | 26 : certificate_reporter_(new chrome_browser_net::CertificateErrorReporter( |
| 26 request_context, | 27 request_context, |
| 27 GURL(kFraudulentCertificateUploadEndpoint), | 28 GURL(kFraudulentCertificateUploadEndpoint), |
| 28 chrome_browser_net::CertificateErrorReporter::DO_NOT_SEND_COOKIES)) { | 29 net::CertificateReportSender::DO_NOT_SEND_COOKIES)) { |
| 29 } | 30 } |
| 30 | 31 |
| 31 ChromeFraudulentCertificateReporter::ChromeFraudulentCertificateReporter( | 32 ChromeFraudulentCertificateReporter::ChromeFraudulentCertificateReporter( |
| 32 scoped_ptr<chrome_browser_net::CertificateErrorReporter> | 33 scoped_ptr<chrome_browser_net::CertificateErrorReporter> |
| 33 certificate_reporter) | 34 certificate_reporter) |
| 34 : certificate_reporter_(certificate_reporter.Pass()) { | 35 : certificate_reporter_(certificate_reporter.Pass()) { |
| 35 } | 36 } |
| 36 | 37 |
| 37 ChromeFraudulentCertificateReporter::~ChromeFraudulentCertificateReporter() { | 38 ChromeFraudulentCertificateReporter::~ChromeFraudulentCertificateReporter() { |
| 38 } | 39 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 50 if (!report.Serialize(&serialized_report)) { | 51 if (!report.Serialize(&serialized_report)) { |
| 51 LOG(ERROR) << "Failed to serialize pinning violation report."; | 52 LOG(ERROR) << "Failed to serialize pinning violation report."; |
| 52 return; | 53 return; |
| 53 } | 54 } |
| 54 | 55 |
| 55 certificate_reporter_->SendReport( | 56 certificate_reporter_->SendReport( |
| 56 chrome_browser_net::CertificateErrorReporter:: | 57 chrome_browser_net::CertificateErrorReporter:: |
| 57 REPORT_TYPE_PINNING_VIOLATION, | 58 REPORT_TYPE_PINNING_VIOLATION, |
| 58 serialized_report); | 59 serialized_report); |
| 59 } | 60 } |
| OLD | NEW |