| 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 "components/certificate_reporting/error_reporter.h" | 5 #include "components/certificate_reporting/error_reporter.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 void RecordUMAOnFailure(const GURL& report_uri, int net_error) { | 105 void RecordUMAOnFailure(const GURL& report_uri, int net_error) { |
| 106 UMA_HISTOGRAM_SPARSE_SLOWLY("SSL.CertificateErrorReportFailure", -net_error); | 106 UMA_HISTOGRAM_SPARSE_SLOWLY("SSL.CertificateErrorReportFailure", -net_error); |
| 107 } | 107 } |
| 108 | 108 |
| 109 } // namespace | 109 } // namespace |
| 110 | 110 |
| 111 ErrorReporter::ErrorReporter( | 111 ErrorReporter::ErrorReporter( |
| 112 net::URLRequestContext* request_context, | 112 net::URLRequestContext* request_context, |
| 113 const GURL& upload_url, | 113 const GURL& upload_url, |
| 114 net::ReportSender::CookiesPreference cookies_preference) | 114 net::ReportSender::CookiesPreference cookies_preference) |
| 115 : ErrorReporter(upload_url, | 115 : ErrorReporter( |
| 116 kServerPublicKey, | 116 upload_url, |
| 117 kServerPublicKeyVersion, | 117 kServerPublicKey, |
| 118 base::WrapUnique(new net::ReportSender( | 118 kServerPublicKeyVersion, |
| 119 request_context, | 119 base::MakeUnique<net::ReportSender>(request_context, |
| 120 cookies_preference, | 120 cookies_preference, |
| 121 base::Bind(RecordUMAOnFailure)))) {} | 121 base::Bind(RecordUMAOnFailure))) { |
| 122 } |
| 122 | 123 |
| 123 ErrorReporter::ErrorReporter( | 124 ErrorReporter::ErrorReporter( |
| 124 const GURL& upload_url, | 125 const GURL& upload_url, |
| 125 const uint8_t server_public_key[/* 32 */], | 126 const uint8_t server_public_key[/* 32 */], |
| 126 const uint32_t server_public_key_version, | 127 const uint32_t server_public_key_version, |
| 127 std::unique_ptr<net::ReportSender> certificate_report_sender) | 128 std::unique_ptr<net::ReportSender> certificate_report_sender) |
| 128 : certificate_report_sender_(std::move(certificate_report_sender)), | 129 : certificate_report_sender_(std::move(certificate_report_sender)), |
| 129 upload_url_(upload_url), | 130 upload_url_(upload_url), |
| 130 server_public_key_(server_public_key), | 131 server_public_key_(server_public_key), |
| 131 server_public_key_version_(server_public_key_version) { | 132 server_public_key_version_(server_public_key_version) { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 aead.Init(&key); | 170 aead.Init(&key); |
| 170 | 171 |
| 171 // Use an all-zero nonce because the key is random per-message. | 172 // Use an all-zero nonce because the key is random per-message. |
| 172 std::string nonce(aead.NonceLength(), 0); | 173 std::string nonce(aead.NonceLength(), 0); |
| 173 | 174 |
| 174 return aead.Open(encrypted_report.encrypted_report(), nonce, std::string(), | 175 return aead.Open(encrypted_report.encrypted_report(), nonce, std::string(), |
| 175 decrypted_serialized_report); | 176 decrypted_serialized_report); |
| 176 } | 177 } |
| 177 | 178 |
| 178 } // namespace certificate_reporting | 179 } // namespace certificate_reporting |
| OLD | NEW |