| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/net/chrome_fraudulent_certificate_reporter.h" | 5 #include "chrome/browser/net/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/cert_logger.pb.h" |
| 8 #include "chrome/browser/net/certificate_error_reporter.h" | 9 #include "chrome/browser/net/certificate_error_reporter.h" |
| 9 #include "net/ssl/ssl_info.h" | 10 #include "net/ssl/ssl_info.h" |
| 10 #include "net/url_request/url_request_context.h" | 11 #include "net/url_request/url_request_context.h" |
| 11 #include "url/gurl.h" | 12 #include "url/gurl.h" |
| 12 | 13 |
| 13 namespace { | 14 namespace { |
| 14 | 15 |
| 15 // TODO(palmer): Switch to HTTPS when the error handling delegate is more | 16 // TODO(palmer): Switch to HTTPS when the error handling delegate is more |
| 16 // sophisticated. Ultimately we plan to attempt the report on many transports. | 17 // sophisticated. Ultimately we plan to attempt the report on many transports. |
| 17 const char kFraudulentCertificateUploadEndpoint[] = | 18 const char kFraudulentCertificateUploadEndpoint[] = |
| (...skipping 20 matching lines...) Expand all Loading... |
| 38 } | 39 } |
| 39 | 40 |
| 40 void ChromeFraudulentCertificateReporter::SendReport( | 41 void ChromeFraudulentCertificateReporter::SendReport( |
| 41 const std::string& hostname, | 42 const std::string& hostname, |
| 42 const net::SSLInfo& ssl_info) { | 43 const net::SSLInfo& ssl_info) { |
| 43 // Do silent/automatic reporting ONLY for Google properties. For other | 44 // Do silent/automatic reporting ONLY for Google properties. For other |
| 44 // domains (when that is supported), Chrome will ask for user permission. | 45 // domains (when that is supported), Chrome will ask for user permission. |
| 45 if (!net::TransportSecurityState::IsGooglePinnedProperty(hostname)) | 46 if (!net::TransportSecurityState::IsGooglePinnedProperty(hostname)) |
| 46 return; | 47 return; |
| 47 | 48 |
| 49 CertLoggerRequest report; |
| 50 certificate_reporter_->BuildReport(hostname, ssl_info, &report); |
| 48 certificate_reporter_->SendReport( | 51 certificate_reporter_->SendReport( |
| 49 CertificateErrorReporter::REPORT_TYPE_PINNING_VIOLATION, hostname, | 52 CertificateErrorReporter::REPORT_TYPE_PINNING_VIOLATION, report); |
| 50 ssl_info); | |
| 51 } | 53 } |
| 52 | 54 |
| 53 } // namespace chrome_browser_net | 55 } // namespace chrome_browser_net |
| OLD | NEW |