Chromium Code Reviews| Index: chrome/browser/ssl/chrome_fraudulent_certificate_reporter.cc |
| diff --git a/chrome/browser/net/chrome_fraudulent_certificate_reporter.cc b/chrome/browser/ssl/chrome_fraudulent_certificate_reporter.cc |
| similarity index 61% |
| rename from chrome/browser/net/chrome_fraudulent_certificate_reporter.cc |
| rename to chrome/browser/ssl/chrome_fraudulent_certificate_reporter.cc |
| index 1c6dd486a5bccec9f0b10507beba7e8eb93d1f24..a4c7b9a062ed08057430ff43fd64b8534453c760 100644 |
| --- a/chrome/browser/net/chrome_fraudulent_certificate_reporter.cc |
| +++ b/chrome/browser/ssl/chrome_fraudulent_certificate_reporter.cc |
| @@ -1,11 +1,12 @@ |
| -// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#include "chrome/browser/net/chrome_fraudulent_certificate_reporter.h" |
| +#include "chrome/browser/ssl/chrome_fraudulent_certificate_reporter.h" |
| #include "base/profiler/scoped_tracker.h" |
| #include "chrome/browser/net/certificate_error_reporter.h" |
| +#include "chrome/browser/ssl/certificate_error_report.h" |
| #include "net/ssl/ssl_info.h" |
| #include "net/url_request/url_request_context.h" |
| #include "url/gurl.h" |
| @@ -19,18 +20,19 @@ const char kFraudulentCertificateUploadEndpoint[] = |
| } // namespace |
| -namespace chrome_browser_net { |
| +namespace chrome_browser_ssl { |
| ChromeFraudulentCertificateReporter::ChromeFraudulentCertificateReporter( |
| net::URLRequestContext* request_context) |
| - : certificate_reporter_(new CertificateErrorReporter( |
| + : certificate_reporter_(new chrome_browser_net::CertificateErrorReporter( |
| request_context, |
| GURL(kFraudulentCertificateUploadEndpoint), |
| - CertificateErrorReporter::DO_NOT_SEND_COOKIES)) { |
| + chrome_browser_net::CertificateErrorReporter::DO_NOT_SEND_COOKIES)) { |
| } |
| ChromeFraudulentCertificateReporter::ChromeFraudulentCertificateReporter( |
| - scoped_ptr<CertificateErrorReporter> certificate_reporter) |
| + scoped_ptr<chrome_browser_net::CertificateErrorReporter> |
| + certificate_reporter) |
| : certificate_reporter_(certificate_reporter.Pass()) { |
| } |
| @@ -45,9 +47,16 @@ void ChromeFraudulentCertificateReporter::SendReport( |
| if (!net::TransportSecurityState::IsGooglePinnedProperty(hostname)) |
| return; |
| - certificate_reporter_->SendReport( |
| - CertificateErrorReporter::REPORT_TYPE_PINNING_VIOLATION, hostname, |
| - ssl_info); |
| + CertificateErrorReport report(hostname, ssl_info); |
| + std::string serialized_report; |
| + if (report.Serialize(&serialized_report)) { |
| + certificate_reporter_->SendReport( |
| + chrome_browser_net::CertificateErrorReporter:: |
| + REPORT_TYPE_PINNING_VIOLATION, |
| + serialized_report); |
| + } else { |
| + LOG(ERROR) << "Failed to serialize pinning violation report."; |
| + } |
|
Ryan Sleevi
2015/05/13 01:02:12
In general, we prefer error handling first
if (!r
estark
2015/05/13 01:44:49
Done.
|
| } |
| -} // namespace chrome_browser_net |
| +} // namespace chrome_browser_ssl |