Give names to all utility processes.
[chromium-blink-merge.git] / chrome / browser / net / chrome_fraudulent_certificate_reporter.cc
blob1c6dd486a5bccec9f0b10507beba7e8eb93d1f24
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
3 // found in the LICENSE file.
5 #include "chrome/browser/net/chrome_fraudulent_certificate_reporter.h"
7 #include "base/profiler/scoped_tracker.h"
8 #include "chrome/browser/net/certificate_error_reporter.h"
9 #include "net/ssl/ssl_info.h"
10 #include "net/url_request/url_request_context.h"
11 #include "url/gurl.h"
13 namespace {
15 // 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 const char kFraudulentCertificateUploadEndpoint[] =
18 "http://clients3.google.com/log_cert_error";
20 } // namespace
22 namespace chrome_browser_net {
24 ChromeFraudulentCertificateReporter::ChromeFraudulentCertificateReporter(
25 net::URLRequestContext* request_context)
26 : certificate_reporter_(new CertificateErrorReporter(
27 request_context,
28 GURL(kFraudulentCertificateUploadEndpoint),
29 CertificateErrorReporter::DO_NOT_SEND_COOKIES)) {
32 ChromeFraudulentCertificateReporter::ChromeFraudulentCertificateReporter(
33 scoped_ptr<CertificateErrorReporter> certificate_reporter)
34 : certificate_reporter_(certificate_reporter.Pass()) {
37 ChromeFraudulentCertificateReporter::~ChromeFraudulentCertificateReporter() {
40 void ChromeFraudulentCertificateReporter::SendReport(
41 const std::string& hostname,
42 const net::SSLInfo& ssl_info) {
43 // Do silent/automatic reporting ONLY for Google properties. For other
44 // domains (when that is supported), Chrome will ask for user permission.
45 if (!net::TransportSecurityState::IsGooglePinnedProperty(hostname))
46 return;
48 certificate_reporter_->SendReport(
49 CertificateErrorReporter::REPORT_TYPE_PINNING_VIOLATION, hostname,
50 ssl_info);
53 } // namespace chrome_browser_net