diff options
37 files changed, 237 insertions, 319 deletions
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index fd316f3..46815ea 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn @@ -97,14 +97,15 @@ source_set("browser") { "//chrome/app:generated_resources_map", "//chrome/app/resources:platform_locale_settings", "//chrome/app/theme:theme_resources", + "//chrome/browser/net:encrypted_cert_logger_proto", "//chrome/browser/net:probe_message_proto", + "//chrome/browser/ssl:cert_logger_proto", "//chrome/browser/ui", "//chrome/common", "//components/autofill/core/browser", "//components/bookmarks/browser", "//components/bookmarks/managed", "//components/captive_portal", - "//components/certificate_reporting", "//components/cloud_devices/common", "//components/component_updater", "//components/compression", diff --git a/chrome/browser/DEPS b/chrome/browser/DEPS index 19370fb..fadf96f 100644 --- a/chrome/browser/DEPS +++ b/chrome/browser/DEPS @@ -24,7 +24,6 @@ include_rules = [ "+components/browser_watcher", "+components/browsing_data", "+components/cdm/browser", - "+components/certificate_reporting", "+components/cloud_devices/common", "+components/component_updater", "+components/compression", diff --git a/chrome/browser/chromeos/BUILD.gn b/chrome/browser/chromeos/BUILD.gn index 934207c..900f3e0 100644 --- a/chrome/browser/chromeos/BUILD.gn +++ b/chrome/browser/chromeos/BUILD.gn @@ -50,9 +50,11 @@ source_set("chromeos") { "//components/wifi_sync", "//chrome/browser/devtools", "//chrome/browser/extensions", + "//chrome/browser/net:encrypted_cert_logger_proto", "//chrome/browser/safe_browsing:chunk_proto", "//chrome/browser/safe_browsing:metadata_proto", "//chrome/browser/safe_browsing:report_proto", + "//chrome/browser/ssl:cert_logger_proto", "//chrome/common", "//chrome/common/extensions/api", "//chrome/common/extensions/api:api_registration", @@ -63,8 +65,6 @@ source_set("chromeos") { "//chromeos:cryptohome_proto", "//chromeos:cryptohome_signkey_proto", "//chromeos:power_manager_proto", - "//components/certificate_reporting:cert_logger_proto", - "//components/certificate_reporting:encrypted_cert_logger_proto", "//components/onc", "//components/ownership", "//components/pairing", diff --git a/chrome/browser/net/BUILD.gn b/chrome/browser/net/BUILD.gn index 4320c4c..51aa200 100644 --- a/chrome/browser/net/BUILD.gn +++ b/chrome/browser/net/BUILD.gn @@ -10,3 +10,10 @@ proto_library("probe_message_proto") { "probe_message.proto", ] } + +# GYP version: chrome/chrome_browser.gypi:encrypted_cert_logger_proto +proto_library("encrypted_cert_logger_proto") { + sources = [ + "encrypted_cert_logger.proto", + ] +} diff --git a/components/certificate_reporting/error_reporter.cc b/chrome/browser/net/certificate_error_reporter.cc index d811112..19f9f4a 100644 --- a/components/certificate_reporting/error_reporter.cc +++ b/chrome/browser/net/certificate_error_reporter.cc @@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "components/certificate_reporting/error_reporter.h" +#include "chrome/browser/net/certificate_error_reporter.h" #include <set> #include "base/logging.h" -#include "components/certificate_reporting/encrypted_cert_logger.pb.h" +#include "chrome/browser/net/encrypted_cert_logger.pb.h" #if defined(USE_OPENSSL) #include "crypto/aead_openssl.h" @@ -18,8 +18,6 @@ #include "crypto/random.h" #include "net/url_request/certificate_report_sender.h" -namespace certificate_reporting { - namespace { // Constants used for crypto. The corresponding private key is used by @@ -58,10 +56,11 @@ std::string GetHkdfSubkeySecret(size_t subkey_length, return hkdf.subkey_secret().as_string(); } -bool EncryptSerializedReport(const uint8* server_public_key, - uint32 server_public_key_version, - const std::string& report, - EncryptedCertLoggerRequest* encrypted_report) { +bool EncryptSerializedReport( + const uint8* server_public_key, + uint32 server_public_key_version, + const std::string& report, + chrome_browser_net::EncryptedCertLoggerRequest* encrypted_report) { // Generate an ephemeral key pair to generate a shared secret. uint8 public_key[crypto::curve25519::kBytes]; uint8 private_key[crypto::curve25519::kScalarBytes]; @@ -89,25 +88,28 @@ bool EncryptSerializedReport(const uint8* server_public_key, encrypted_report->set_client_public_key(reinterpret_cast<char*>(public_key), sizeof(public_key)); encrypted_report->set_algorithm( - EncryptedCertLoggerRequest::AEAD_ECDH_AES_128_CTR_HMAC_SHA256); + chrome_browser_net::EncryptedCertLoggerRequest:: + AEAD_ECDH_AES_128_CTR_HMAC_SHA256); return true; } #endif } // namespace -ErrorReporter::ErrorReporter( +namespace chrome_browser_net { + +CertificateErrorReporter::CertificateErrorReporter( net::URLRequestContext* request_context, const GURL& upload_url, net::CertificateReportSender::CookiesPreference cookies_preference) - : ErrorReporter(upload_url, - kServerPublicKey, - kServerPublicKeyVersion, - make_scoped_ptr(new net::CertificateReportSender( - request_context, - cookies_preference))) {} - -ErrorReporter::ErrorReporter( + : CertificateErrorReporter(upload_url, + kServerPublicKey, + kServerPublicKeyVersion, + make_scoped_ptr(new net::CertificateReportSender( + request_context, + cookies_preference))) {} + +CertificateErrorReporter::CertificateErrorReporter( const GURL& upload_url, const uint8 server_public_key[/* 32 */], const uint32 server_public_key_version, @@ -120,9 +122,10 @@ ErrorReporter::ErrorReporter( DCHECK(!upload_url.is_empty()); } -ErrorReporter::~ErrorReporter() {} +CertificateErrorReporter::~CertificateErrorReporter() { +} -void ErrorReporter::SendExtendedReportingReport( +void CertificateErrorReporter::SendExtendedReportingReport( const std::string& serialized_report) { if (upload_url_.SchemeIsCryptographic()) { certificate_report_sender_->Send(upload_url_, serialized_report); @@ -142,7 +145,7 @@ void ErrorReporter::SendExtendedReportingReport( } } -bool ErrorReporter::IsHttpUploadUrlSupported() { +bool CertificateErrorReporter::IsHttpUploadUrlSupported() { #if defined(USE_OPENSSL) return true; #else @@ -152,7 +155,7 @@ bool ErrorReporter::IsHttpUploadUrlSupported() { // Used only by tests. #if defined(USE_OPENSSL) -bool ErrorReporter::DecryptErrorReport( +bool CertificateErrorReporter::DecryptCertificateErrorReport( const uint8 server_private_key[32], const EncryptedCertLoggerRequest& encrypted_report, std::string* decrypted_serialized_report) { @@ -171,4 +174,4 @@ bool ErrorReporter::DecryptErrorReport( } #endif -} // namespace certificate_reporting +} // namespace chrome_browser_net diff --git a/components/certificate_reporting/error_reporter.h b/chrome/browser/net/certificate_error_reporter.h index 3bfc1d4..dbfbb5b 100644 --- a/components/certificate_reporting/error_reporter.h +++ b/chrome/browser/net/certificate_error_reporter.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_CERTIFICATE_REPORTING_CERTIFICATE_ERROR_REPORTER_H_ -#define COMPONENTS_CERTIFICATE_REPORTING_CERTIFICATE_ERROR_REPORTER_H_ +#ifndef CHROME_BROWSER_NET_CERTIFICATE_ERROR_REPORTER_H_ +#define CHROME_BROWSER_NET_CERTIFICATE_ERROR_REPORTER_H_ #include <set> #include <string> @@ -18,33 +18,33 @@ class URLRequestContext; class SSLInfo; } -namespace certificate_reporting { +namespace chrome_browser_net { class EncryptedCertLoggerRequest; // Provides functionality for sending reports about invalid SSL // certificate chains to a report collection server. -class ErrorReporter { +class CertificateErrorReporter { public: // Creates a certificate error reporter that will send certificate // error reports to |upload_url|, using |request_context| as the // context for the reports. |cookies_preference| controls whether // cookies will be sent along with the reports. - ErrorReporter( + CertificateErrorReporter( net::URLRequestContext* request_context, const GURL& upload_url, net::CertificateReportSender::CookiesPreference cookies_preference); // Allows tests to use a server public key with known private key and // a mock CertificateReportSender. |server_public_key| must outlive - // the ErrorReporter. - ErrorReporter( + // the CertificateErrorReporter. + CertificateErrorReporter( const GURL& upload_url, const uint8 server_public_key[/* 32 */], const uint32 server_public_key_version, scoped_ptr<net::CertificateReportSender> certificate_report_sender); - virtual ~ErrorReporter(); + virtual ~CertificateErrorReporter(); // Sends a certificate report to the report collection server. The // |serialized_report| is expected to be a serialized protobuf @@ -56,7 +56,7 @@ class ErrorReporter { // opt-in, only sending reports for certain hostnames, checking for // incognito mode, etc.). // - // On some platforms (but not all), ErrorReporter can use + // On some platforms (but not all), CertificateErrorReporter can use // an HTTP endpoint to send encrypted extended reporting reports. On // unsupported platforms, callers must send extended reporting reports // over SSL. @@ -68,7 +68,7 @@ class ErrorReporter { #if defined(USE_OPENSSL) // Used by tests. - static bool DecryptErrorReport( + static bool DecryptCertificateErrorReport( const uint8 server_private_key[32], const EncryptedCertLoggerRequest& encrypted_report, std::string* decrypted_serialized_report); @@ -82,9 +82,9 @@ class ErrorReporter { const uint8* server_public_key_; const uint32 server_public_key_version_; - DISALLOW_COPY_AND_ASSIGN(ErrorReporter); + DISALLOW_COPY_AND_ASSIGN(CertificateErrorReporter); }; -} // namespace certificate_reporting +} // namespace chrome_browser_net -#endif // COMPONENTS_CERTIFICATE_REPORTING_CERTIFICATE_ERROR_REPORTER_H_ +#endif // CHROME_BROWSER_NET_CERTIFICATE_ERROR_REPORTER_H_ diff --git a/components/certificate_reporting/error_reporter_unittest.cc b/chrome/browser/net/certificate_error_reporter_unittest.cc index 4d5b623..194d569 100644 --- a/components/certificate_reporting/error_reporter_unittest.cc +++ b/chrome/browser/net/certificate_error_reporter_unittest.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "components/certificate_reporting/error_reporter.h" +#include "chrome/browser/net/certificate_error_reporter.h" #include <set> #include <string> @@ -10,12 +10,13 @@ #include "base/bind.h" #include "base/bind_helpers.h" #include "base/macros.h" -#include "components/certificate_reporting/encrypted_cert_logger.pb.h" +#include "chrome/browser/net/encrypted_cert_logger.pb.h" +#include "chrome/common/chrome_paths.h" #include "crypto/curve25519.h" #include "net/url_request/certificate_report_sender.h" #include "testing/gtest/include/gtest/gtest.h" -namespace certificate_reporting { +using chrome_browser_net::CertificateErrorReporter; namespace { @@ -48,56 +49,57 @@ class MockCertificateReportSender : public net::CertificateReportSender { DISALLOW_COPY_AND_ASSIGN(MockCertificateReportSender); }; -class ErrorReporterTest : public ::testing::Test { +class CertificateErrorReporterTest : public ::testing::Test { public: - ErrorReporterTest() { + CertificateErrorReporterTest() { memset(server_private_key_, 1, sizeof(server_private_key_)); crypto::curve25519::ScalarBaseMult(server_private_key_, server_public_key_); } - ~ErrorReporterTest() override {} + ~CertificateErrorReporterTest() override {} protected: uint8_t server_public_key_[32]; uint8_t server_private_key_[32]; }; -// Test that ErrorReporter::SendExtendedReportingReport sends +// Test that CertificateErrorReporter::SendExtendedReportingReport sends // an encrypted or plaintext extended reporting report as appropriate. -TEST_F(ErrorReporterTest, ExtendedReportingSendReport) { +TEST_F(CertificateErrorReporterTest, ExtendedReportingSendReport) { // Data should not be encrypted when sent to an HTTPS URL. MockCertificateReportSender* mock_report_sender = new MockCertificateReportSender(); GURL https_url(kDummyHttpsReportUri); - ErrorReporter https_reporter(https_url, server_public_key_, - kServerPublicKeyTestVersion, - make_scoped_ptr(mock_report_sender)); + CertificateErrorReporter https_reporter(https_url, server_public_key_, + kServerPublicKeyTestVersion, + make_scoped_ptr(mock_report_sender)); https_reporter.SendExtendedReportingReport(kDummyReport); EXPECT_EQ(mock_report_sender->latest_report_uri(), https_url); EXPECT_EQ(mock_report_sender->latest_report(), kDummyReport); // Data should be encrypted when sent to an HTTP URL. - if (ErrorReporter::IsHttpUploadUrlSupported()) { + if (CertificateErrorReporter::IsHttpUploadUrlSupported()) { MockCertificateReportSender* http_mock_report_sender = new MockCertificateReportSender(); GURL http_url(kDummyHttpReportUri); - ErrorReporter http_reporter(http_url, server_public_key_, - kServerPublicKeyTestVersion, - make_scoped_ptr(http_mock_report_sender)); + CertificateErrorReporter http_reporter( + http_url, server_public_key_, kServerPublicKeyTestVersion, + make_scoped_ptr(http_mock_report_sender)); http_reporter.SendExtendedReportingReport(kDummyReport); EXPECT_EQ(http_mock_report_sender->latest_report_uri(), http_url); std::string uploaded_report; #if defined(USE_OPENSSL) - EncryptedCertLoggerRequest encrypted_request; + chrome_browser_net::EncryptedCertLoggerRequest encrypted_request; ASSERT_TRUE(encrypted_request.ParseFromString( http_mock_report_sender->latest_report())); EXPECT_EQ(kServerPublicKeyTestVersion, encrypted_request.server_public_key_version()); - EXPECT_EQ(EncryptedCertLoggerRequest::AEAD_ECDH_AES_128_CTR_HMAC_SHA256, + EXPECT_EQ(chrome_browser_net::EncryptedCertLoggerRequest:: + AEAD_ECDH_AES_128_CTR_HMAC_SHA256, encrypted_request.algorithm()); - ASSERT_TRUE(ErrorReporter::DecryptErrorReport( + ASSERT_TRUE(CertificateErrorReporter::DecryptCertificateErrorReport( server_private_key_, encrypted_request, &uploaded_report)); #else ADD_FAILURE() << "Only supported in OpenSSL ports"; @@ -112,7 +114,7 @@ TEST_F(ErrorReporterTest, ExtendedReportingSendReport) { // in order to catch changes in report encryption that could cause the // server to no longer be able to decrypt reports that it receives from // Chrome. -TEST_F(ErrorReporterTest, DecryptExampleReport) { +TEST_F(CertificateErrorReporterTest, DecryptExampleReport) { // This data should not be changed without also changing the // corresponding server-side test. const unsigned char kSerializedEncryptedReport[] = { @@ -259,16 +261,16 @@ TEST_F(ErrorReporterTest, DecryptExampleReport) { 0xA6, 0x2D, 0x00, 0xCC, 0xB5, 0x3B, 0x31, 0x2E, 0xB4, 0x30, 0xA5, 0x08, 0x1A, 0x7D, 0x19, 0x81, 0xF0, 0x4D, 0x20, 0x01}; - EncryptedCertLoggerRequest encrypted_request; + chrome_browser_net::EncryptedCertLoggerRequest encrypted_request; std::string decrypted_serialized_report; ASSERT_TRUE(encrypted_request.ParseFromString( std::string(reinterpret_cast<const char*>(kSerializedEncryptedReport), sizeof(kSerializedEncryptedReport)))); - ASSERT_TRUE(ErrorReporter::DecryptErrorReport( - server_private_key_, encrypted_request, &decrypted_serialized_report)); + ASSERT_TRUE( + chrome_browser_net::CertificateErrorReporter:: + DecryptCertificateErrorReport(server_private_key_, encrypted_request, + &decrypted_serialized_report)); } #endif } // namespace - -} // namespace certificate_reporting diff --git a/components/certificate_reporting/encrypted_cert_logger.proto b/chrome/browser/net/encrypted_cert_logger.proto index dc1ab38..6c6274e 100644 --- a/components/certificate_reporting/encrypted_cert_logger.proto +++ b/chrome/browser/net/encrypted_cert_logger.proto @@ -5,7 +5,7 @@ syntax = "proto2"; -package certificate_reporting; +package chrome_browser_net; // Chrome requires this. option optimize_for = LITE_RUNTIME; diff --git a/chrome/browser/safe_browsing/ping_manager.cc b/chrome/browser/safe_browsing/ping_manager.cc index c7f031f..f4b2dfe 100644 --- a/chrome/browser/safe_browsing/ping_manager.cc +++ b/chrome/browser/safe_browsing/ping_manager.cc @@ -8,8 +8,8 @@ #include "base/stl_util.h" #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" +#include "chrome/browser/net/certificate_error_reporter.h" #include "chrome/common/env_vars.h" -#include "components/certificate_reporting/error_reporter.h" #include "content/public/browser/browser_thread.h" #include "google_apis/google_api_keys.h" #include "net/base/escape.h" @@ -21,6 +21,7 @@ #include "net/url_request/url_request_status.h" #include "url/gurl.h" +using chrome_browser_net::CertificateErrorReporter; using content::BrowserThread; namespace { @@ -56,7 +57,7 @@ SafeBrowsingPingManager::SafeBrowsingPingManager( // Set the upload URL and whether or not to send cookies with // certificate reports sent to Safe Browsing servers. bool use_insecure_certificate_upload_url = - certificate_reporting::ErrorReporter::IsHttpUploadUrlSupported(); + CertificateErrorReporter::IsHttpUploadUrlSupported(); net::CertificateReportSender::CookiesPreference cookies_preference; GURL certificate_upload_url; @@ -68,7 +69,7 @@ SafeBrowsingPingManager::SafeBrowsingPingManager( certificate_upload_url = GURL(kExtendedReportingUploadUrlSecure); } - certificate_error_reporter_.reset(new certificate_reporting::ErrorReporter( + certificate_error_reporter_.reset(new CertificateErrorReporter( request_context_getter->GetURLRequestContext(), certificate_upload_url, cookies_preference)); } @@ -141,8 +142,7 @@ void SafeBrowsingPingManager::ReportInvalidCertificateChain( } void SafeBrowsingPingManager::SetCertificateErrorReporterForTesting( - scoped_ptr<certificate_reporting::ErrorReporter> - certificate_error_reporter) { + scoped_ptr<CertificateErrorReporter> certificate_error_reporter) { certificate_error_reporter_ = certificate_error_reporter.Pass(); } diff --git a/chrome/browser/safe_browsing/ping_manager.h b/chrome/browser/safe_browsing/ping_manager.h index cb51f48..6c8c527 100644 --- a/chrome/browser/safe_browsing/ping_manager.h +++ b/chrome/browser/safe_browsing/ping_manager.h @@ -18,8 +18,8 @@ #include "net/url_request/url_fetcher_delegate.h" #include "url/gurl.h" -namespace certificate_reporting { -class ErrorReporter; +namespace chrome_browser_net { +class CertificateErrorReporter; } namespace net { @@ -59,9 +59,8 @@ class SafeBrowsingPingManager : public net::URLFetcherDelegate { // certificate chains. void ReportInvalidCertificateChain(const std::string& serialized_report); - void SetCertificateErrorReporterForTesting( - scoped_ptr<certificate_reporting::ErrorReporter> - certificate_error_reporter); + void SetCertificateErrorReporterForTesting(scoped_ptr< + chrome_browser_net::CertificateErrorReporter> certificate_error_reporter); private: FRIEND_TEST_ALL_PREFIXES(SafeBrowsingPingManagerTest, @@ -105,7 +104,8 @@ class SafeBrowsingPingManager : public net::URLFetcherDelegate { Reports safebrowsing_reports_; // Sends reports of invalid SSL certificate chains. - scoped_ptr<certificate_reporting::ErrorReporter> certificate_error_reporter_; + scoped_ptr<chrome_browser_net::CertificateErrorReporter> + certificate_error_reporter_; DISALLOW_COPY_AND_ASSIGN(SafeBrowsingPingManager); }; diff --git a/chrome/browser/ssl/BUILD.gn b/chrome/browser/ssl/BUILD.gn new file mode 100644 index 0000000..88f00288 --- /dev/null +++ b/chrome/browser/ssl/BUILD.gn @@ -0,0 +1,12 @@ +# 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. + +import("//third_party/protobuf/proto_library.gni") + +# GYP version: chrome/chrome_browser.gypi:cert_logger_proto +proto_library("cert_logger_proto") { + sources = [ + "cert_logger.proto", + ] +} diff --git a/chrome/browser/ssl/captive_portal_blocking_page.cc b/chrome/browser/ssl/captive_portal_blocking_page.cc index 31562da..6c460e1 100644 --- a/chrome/browser/ssl/captive_portal_blocking_page.cc +++ b/chrome/browser/ssl/captive_portal_blocking_page.cc @@ -17,7 +17,6 @@ #include "chrome/browser/ssl/ssl_cert_reporter.h" #include "chrome/common/pref_names.h" #include "components/captive_portal/captive_portal_detector.h" -#include "components/certificate_reporting/error_reporter.h" #include "components/url_formatter/url_formatter.h" #include "components/wifi/wifi_service.h" #include "content/public/browser/web_contents.h" @@ -63,8 +62,7 @@ CaptivePortalBlockingPage::CaptivePortalBlockingPage( if (ssl_cert_reporter) { cert_report_helper_.reset(new CertReportHelper( ssl_cert_reporter.Pass(), web_contents, request_url, ssl_info, - certificate_reporting::ErrorReport::INTERSTITIAL_CAPTIVE_PORTAL, false, - nullptr)); + CertificateErrorReport::INTERSTITIAL_CAPTIVE_PORTAL, false, nullptr)); } RecordUMA(SHOW_ALL); @@ -205,7 +203,7 @@ void CaptivePortalBlockingPage::OnProceed() { // Finish collecting information about invalid certificates, if the // user opted in to. cert_report_helper_->FinishCertCollection( - certificate_reporting::ErrorReport::USER_PROCEEDED); + CertificateErrorReport::USER_PROCEEDED); } } @@ -214,7 +212,7 @@ void CaptivePortalBlockingPage::OnDontProceed() { // Finish collecting information about invalid certificates, if the // user opted in to. cert_report_helper_->FinishCertCollection( - certificate_reporting::ErrorReport::USER_DID_NOT_PROCEED); + CertificateErrorReport::USER_DID_NOT_PROCEED); } // Need to explicity deny the certificate via the callback, otherwise memory diff --git a/components/certificate_reporting/cert_logger.proto b/chrome/browser/ssl/cert_logger.proto index 846c7f9..bb11bf2 100644 --- a/components/certificate_reporting/cert_logger.proto +++ b/chrome/browser/ssl/cert_logger.proto @@ -19,8 +19,6 @@ syntax = "proto2"; // Chrome requires this. option optimize_for = LITE_RUNTIME; -package certificate_reporting; - // Protocol types message CertLoggerInterstitialInfo { diff --git a/chrome/browser/ssl/cert_report_helper.cc b/chrome/browser/ssl/cert_report_helper.cc index 2e3e120..2f85c84 100644 --- a/chrome/browser/ssl/cert_report_helper.cc +++ b/chrome/browser/ssl/cert_report_helper.cc @@ -34,7 +34,7 @@ CertReportHelper::CertReportHelper( content::WebContents* web_contents, const GURL& request_url, const net::SSLInfo& ssl_info, - certificate_reporting::ErrorReport::InterstitialReason interstitial_reason, + CertificateErrorReport::InterstitialReason interstitial_reason, bool overridable, security_interstitials::MetricsHelper* metrics_helper) : ssl_cert_reporter_(ssl_cert_reporter.Pass()), @@ -75,7 +75,7 @@ void CertReportHelper::PopulateExtendedReportingOption( } void CertReportHelper::FinishCertCollection( - certificate_reporting::ErrorReport::ProceedDecision user_proceeded) { + CertificateErrorReport::ProceedDecision user_proceeded) { if (!ShouldShowCertificateReporterCheckbox()) return; @@ -91,13 +91,12 @@ void CertReportHelper::FinishCertCollection( return; std::string serialized_report; - certificate_reporting::ErrorReport report(request_url_.host(), ssl_info_); + CertificateErrorReport report(request_url_.host(), ssl_info_); report.SetInterstitialInfo( interstitial_reason_, user_proceeded, - overridable_ - ? certificate_reporting::ErrorReport::INTERSTITIAL_OVERRIDABLE - : certificate_reporting::ErrorReport::INTERSTITIAL_NOT_OVERRIDABLE); + overridable_ ? CertificateErrorReport::INTERSTITIAL_OVERRIDABLE + : CertificateErrorReport::INTERSTITIAL_NOT_OVERRIDABLE); if (!report.Serialize(&serialized_report)) { LOG(ERROR) << "Failed to serialize certificate report."; diff --git a/chrome/browser/ssl/cert_report_helper.h b/chrome/browser/ssl/cert_report_helper.h index 3e63405..6bebaff 100644 --- a/chrome/browser/ssl/cert_report_helper.h +++ b/chrome/browser/ssl/cert_report_helper.h @@ -8,7 +8,7 @@ #include <string> #include "chrome/browser/interstitials/security_interstitial_page.h" -#include "components/certificate_reporting/error_report.h" +#include "chrome/browser/ssl/certificate_error_report.h" #include "net/ssl/ssl_info.h" #include "url/gurl.h" @@ -36,14 +36,14 @@ class CertReportHelper { static const char kFinchGroupDontShowDontSend[]; static const char kFinchParamName[]; - CertReportHelper(scoped_ptr<SSLCertReporter> ssl_cert_reporter, - content::WebContents* web_contents, - const GURL& request_url, - const net::SSLInfo& ssl_info, - certificate_reporting::ErrorReport::InterstitialReason - interstitial_reason, - bool overridable, - security_interstitials::MetricsHelper* metrics_helper); + CertReportHelper( + scoped_ptr<SSLCertReporter> ssl_cert_reporter, + content::WebContents* web_contents, + const GURL& request_url, + const net::SSLInfo& ssl_info, + CertificateErrorReport::InterstitialReason interstitial_reason, + bool overridable, + security_interstitials::MetricsHelper* metrics_helper); virtual ~CertReportHelper(); @@ -55,7 +55,7 @@ class CertReportHelper { // server. |user_proceeded| indicates whether the user clicked through // the interstitial or not, and will be included in the report. void FinishCertCollection( - certificate_reporting::ErrorReport::ProceedDecision user_proceeded); + CertificateErrorReport::ProceedDecision user_proceeded); // Allows tests to inject a mock reporter. void SetSSLCertReporterForTesting( @@ -83,7 +83,7 @@ class CertReportHelper { // The SSLInfo used in this helper's report. const net::SSLInfo ssl_info_; // The reason for the interstitial, included in this helper's report. - certificate_reporting::ErrorReport::InterstitialReason interstitial_reason_; + CertificateErrorReport::InterstitialReason interstitial_reason_; // True if the user was given the option to proceed through the // certificate chain error being reported. bool overridable_; diff --git a/components/certificate_reporting/error_report.cc b/chrome/browser/ssl/certificate_error_report.cc index c5233ee..49ca918 100644 --- a/components/certificate_reporting/error_report.cc +++ b/chrome/browser/ssl/certificate_error_report.cc @@ -2,20 +2,18 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "components/certificate_reporting/error_report.h" +#include "chrome/browser/ssl/certificate_error_report.h" #include <vector> #include "base/stl_util.h" #include "base/strings/string_util.h" #include "base/time/time.h" -#include "components/certificate_reporting/cert_logger.pb.h" +#include "chrome/browser/ssl/cert_logger.pb.h" #include "net/cert/cert_status_flags.h" #include "net/cert/x509_certificate.h" #include "net/ssl/ssl_info.h" -namespace certificate_reporting { - namespace { void AddCertStatusToReportErrors(net::CertStatus cert_status, @@ -55,10 +53,12 @@ bool CertificateChainToString(scoped_refptr<net::X509Certificate> cert, } // namespace -ErrorReport::ErrorReport() : cert_report_(new CertLoggerRequest()) {} +CertificateErrorReport::CertificateErrorReport() + : cert_report_(new CertLoggerRequest()) { +} -ErrorReport::ErrorReport(const std::string& hostname, - const net::SSLInfo& ssl_info) +CertificateErrorReport::CertificateErrorReport(const std::string& hostname, + const net::SSLInfo& ssl_info) : cert_report_(new CertLoggerRequest()) { base::Time now = base::Time::Now(); cert_report_->set_time_usec(now.ToInternalValue()); @@ -81,17 +81,19 @@ ErrorReport::ErrorReport(const std::string& hostname, AddCertStatusToReportErrors(ssl_info.cert_status, cert_report_.get()); } -ErrorReport::~ErrorReport() {} +CertificateErrorReport::~CertificateErrorReport() { +} -bool ErrorReport::InitializeFromString(const std::string& serialized_report) { +bool CertificateErrorReport::InitializeFromString( + const std::string& serialized_report) { return cert_report_->ParseFromString(serialized_report); } -bool ErrorReport::Serialize(std::string* output) const { +bool CertificateErrorReport::Serialize(std::string* output) const { return cert_report_->SerializeToString(output); } -void ErrorReport::SetInterstitialInfo( +void CertificateErrorReport::SetInterstitialInfo( const InterstitialReason& interstitial_reason, const ProceedDecision& proceed_decision, const Overridable& overridable) { @@ -117,8 +119,6 @@ void ErrorReport::SetInterstitialInfo( interstitial_info->set_overridable(overridable == INTERSTITIAL_OVERRIDABLE); } -const std::string& ErrorReport::hostname() const { +const std::string& CertificateErrorReport::hostname() const { return cert_report_->hostname(); } - -} // namespace certificate_reporting diff --git a/components/certificate_reporting/error_report.h b/chrome/browser/ssl/certificate_error_report.h index 8600cec..61830dc 100644 --- a/components/certificate_reporting/error_report.h +++ b/chrome/browser/ssl/certificate_error_report.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_CERTIFICATE_REPORTING_CERTIFICATE_ERROR_REPORT_H_ -#define COMPONENTS_CERTIFICATE_REPORTING_CERTIFICATE_ERROR_REPORT_H_ +#ifndef CHROME_BROWSER_SSL_CERTIFICATE_ERROR_REPORT_H_ +#define CHROME_BROWSER_SSL_CERTIFICATE_ERROR_REPORT_H_ #include <string> @@ -13,13 +13,12 @@ namespace net { class SSLInfo; } // namespace net -namespace certificate_reporting { - class CertLoggerRequest; // This class builds and serializes reports for invalid SSL certificate -// chains, intended to be sent with ErrorReporter. -class ErrorReport { +// chains, intended to be sent with +// chrome_browser_net::CertificateErrorReporter. +class CertificateErrorReport { public: // Describes the type of interstitial that the user was shown for the // error that this report represents. Gets mapped to @@ -38,13 +37,14 @@ class ErrorReport { enum Overridable { INTERSTITIAL_OVERRIDABLE, INTERSTITIAL_NOT_OVERRIDABLE }; // Constructs an empty report. - ErrorReport(); + CertificateErrorReport(); // Constructs a report for the given |hostname| using the SSL // properties in |ssl_info|. - ErrorReport(const std::string& hostname, const net::SSLInfo& ssl_info); + CertificateErrorReport(const std::string& hostname, + const net::SSLInfo& ssl_info); - ~ErrorReport(); + ~CertificateErrorReport(); // Initializes an empty report by parsing the given serialized // report. |serialized_report| should be a serialized @@ -68,6 +68,4 @@ class ErrorReport { scoped_ptr<CertLoggerRequest> cert_report_; }; -} // namespace certificate_reporting - -#endif // COMPONENTS_CERTIFICATE_REPORTING_CERTIFICATE_ERROR_REPORT_H_ +#endif // CHROME_BROWSER_SSL_CERTIFICATE_ERROR_REPORT_H_ diff --git a/components/certificate_reporting/error_report_unittest.cc b/chrome/browser/ssl/certificate_error_report_unittest.cc index b1345b7..5c712ee 100644 --- a/components/certificate_reporting/error_report_unittest.cc +++ b/chrome/browser/ssl/certificate_error_report_unittest.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "components/certificate_reporting/error_report.h" +#include "chrome/browser/ssl/certificate_error_report.h" #include <set> #include <string> @@ -10,7 +10,8 @@ #include "base/files/file_path.h" #include "base/files/file_util.h" #include "base/path_service.h" -#include "components/certificate_reporting/cert_logger.pb.h" +#include "chrome/browser/ssl/cert_logger.pb.h" +#include "chrome/common/chrome_paths.h" #include "net/base/test_data_directory.h" #include "net/cert/cert_status_flags.h" #include "net/ssl/ssl_info.h" @@ -21,8 +22,6 @@ using net::SSLInfo; using testing::UnorderedElementsAre; -namespace certificate_reporting { - namespace { const char kDummyHostname[] = "dummy.hostname.com"; @@ -45,19 +44,18 @@ enum UnverifiedCertChainStatus { EXCLUDE_UNVERIFIED_CERT_CHAIN }; -void GetTestSSLInfo(UnverifiedCertChainStatus unverified_cert_chain_status, - SSLInfo* info) { - info->cert = +SSLInfo GetTestSSLInfo(UnverifiedCertChainStatus unverified_cert_chain_status) { + SSLInfo info; + info.cert = net::ImportCertFromFile(net::GetTestCertsDirectory(), kTestCertFilename); - ASSERT_TRUE(info->cert); if (unverified_cert_chain_status == INCLUDE_UNVERIFIED_CERT_CHAIN) { - info->unverified_cert = net::ImportCertFromFile( - net::GetTestCertsDirectory(), kTestCertFilename); - ASSERT_TRUE(info->unverified_cert); + info.unverified_cert = net::ImportCertFromFile(net::GetTestCertsDirectory(), + kTestCertFilename); } - info->is_issued_by_known_root = true; - info->cert_status = kCertStatus; - info->pinning_failure_log = kDummyFailureLog; + info.is_issued_by_known_root = true; + info.cert_status = kCertStatus; + info.pinning_failure_log = kDummyFailureLog; + return info; } std::string GetPEMEncodedChain() { @@ -68,15 +66,13 @@ std::string GetPEMEncodedChain() { return cert_data; } -// Test that a serialized ErrorReport can be deserialized as +// Test that a serialized CertificateErrorReport can be deserialized as // a CertLoggerRequest protobuf (which is the format that the receiving // server expects it in) with the right data in it. -TEST(ErrorReportTest, SerializedReportAsProtobuf) { +TEST(CertificateErrorReportTest, SerializedReportAsProtobuf) { std::string serialized_report; - SSLInfo ssl_info; - ASSERT_NO_FATAL_FAILURE( - GetTestSSLInfo(INCLUDE_UNVERIFIED_CERT_CHAIN, &ssl_info)); - ErrorReport report(kDummyHostname, ssl_info); + CertificateErrorReport report(kDummyHostname, + GetTestSSLInfo(INCLUDE_UNVERIFIED_CERT_CHAIN)); ASSERT_TRUE(report.Serialize(&serialized_report)); CertLoggerRequest deserialized_report; @@ -92,19 +88,18 @@ TEST(ErrorReportTest, SerializedReportAsProtobuf) { UnorderedElementsAre(kFirstReportedCertError, kSecondReportedCertError)); } -TEST(ErrorReportTest, SerializedReportAsProtobufWithInterstitialInfo) { +TEST(CertificateErrorReportTest, + SerializedReportAsProtobufWithInterstitialInfo) { std::string serialized_report; - SSLInfo ssl_info; // Use EXCLUDE_UNVERIFIED_CERT_CHAIN here to exercise the code path // where SSLInfo does not contain the unverified cert chain. (The test // above exercises the path where it does.) - ASSERT_NO_FATAL_FAILURE( - GetTestSSLInfo(EXCLUDE_UNVERIFIED_CERT_CHAIN, &ssl_info)); - ErrorReport report(kDummyHostname, ssl_info); + CertificateErrorReport report(kDummyHostname, + GetTestSSLInfo(EXCLUDE_UNVERIFIED_CERT_CHAIN)); - report.SetInterstitialInfo(ErrorReport::INTERSTITIAL_CLOCK, - ErrorReport::USER_PROCEEDED, - ErrorReport::INTERSTITIAL_OVERRIDABLE); + report.SetInterstitialInfo(CertificateErrorReport::INTERSTITIAL_CLOCK, + CertificateErrorReport::USER_PROCEEDED, + CertificateErrorReport::INTERSTITIAL_OVERRIDABLE); ASSERT_TRUE(report.Serialize(&serialized_report)); @@ -127,20 +122,16 @@ TEST(ErrorReportTest, SerializedReportAsProtobufWithInterstitialInfo) { } // Test that a serialized report can be parsed. -TEST(ErrorReportTest, ParseSerializedReport) { +TEST(CertificateErrorReportTest, ParseSerializedReport) { std::string serialized_report; - SSLInfo ssl_info; - ASSERT_NO_FATAL_FAILURE( - GetTestSSLInfo(INCLUDE_UNVERIFIED_CERT_CHAIN, &ssl_info)); - ErrorReport report(kDummyHostname, ssl_info); + CertificateErrorReport report(kDummyHostname, + GetTestSSLInfo(EXCLUDE_UNVERIFIED_CERT_CHAIN)); EXPECT_EQ(kDummyHostname, report.hostname()); ASSERT_TRUE(report.Serialize(&serialized_report)); - ErrorReport parsed; + CertificateErrorReport parsed; ASSERT_TRUE(parsed.InitializeFromString(serialized_report)); EXPECT_EQ(report.hostname(), parsed.hostname()); } } // namespace - -} // namespace certificate_reporting diff --git a/chrome/browser/ssl/certificate_reporting_test_utils.cc b/chrome/browser/ssl/certificate_reporting_test_utils.cc index b99a36e..b61340e 100644 --- a/chrome/browser/ssl/certificate_reporting_test_utils.cc +++ b/chrome/browser/ssl/certificate_reporting_test_utils.cc @@ -16,22 +16,22 @@ #include "chrome/browser/safe_browsing/safe_browsing_service.h" #include "chrome/browser/safe_browsing/ui_manager.h" #include "chrome/browser/ssl/cert_report_helper.h" +#include "chrome/browser/ssl/certificate_error_report.h" #include "chrome/browser/ssl/ssl_cert_reporter.h" #include "chrome/browser/ui/browser.h" #include "chrome/common/pref_names.h" -#include "components/certificate_reporting/error_report.h" -#include "components/certificate_reporting/error_reporter.h" #include "components/variations/variations_associated_data.h" #include "net/url_request/certificate_report_sender.h" #include "net/url_request/url_request_context.h" #include "testing/gtest/include/gtest/gtest.h" #include "url/gurl.h" +using chrome_browser_net::CertificateErrorReporter; + namespace { -void SetMockReporter( - SafeBrowsingService* safe_browsing_service, - scoped_ptr<certificate_reporting::ErrorReporter> reporter) { +void SetMockReporter(SafeBrowsingService* safe_browsing_service, + scoped_ptr<CertificateErrorReporter> reporter) { safe_browsing_service->ping_manager()->SetCertificateErrorReporterForTesting( reporter.Pass()); } @@ -80,14 +80,14 @@ namespace certificate_reporting_test_utils { // most recent hostname for which an extended reporting report would // have been sent over the network. class CertificateReportingTest::MockReporter - : public certificate_reporting::ErrorReporter { + : public chrome_browser_net::CertificateErrorReporter { public: MockReporter( net::URLRequestContext* request_context, const GURL& upload_url, net::CertificateReportSender::CookiesPreference cookies_preference); - // ErrorReporter implementation. + // CertificateErrorReporter implementation. void SendExtendedReportingReport( const std::string& serialized_report) override; @@ -107,13 +107,13 @@ CertificateReportingTest::MockReporter::MockReporter( net::URLRequestContext* request_context, const GURL& upload_url, net::CertificateReportSender::CookiesPreference cookies_preference) - : certificate_reporting::ErrorReporter(request_context, - upload_url, - cookies_preference) {} + : CertificateErrorReporter(request_context, + upload_url, + cookies_preference) {} void CertificateReportingTest::MockReporter::SendExtendedReportingReport( const std::string& serialized_report) { - certificate_reporting::ErrorReport report; + CertificateErrorReport report; ASSERT_TRUE(report.InitializeFromString(serialized_report)); latest_hostname_reported_ = report.hostname(); } @@ -134,9 +134,9 @@ void CertificateReportingTest::SetUpMockReporter() { content::BrowserThread::PostTask( content::BrowserThread::IO, FROM_HERE, - base::Bind(SetMockReporter, safe_browsing_service, - base::Passed(scoped_ptr<certificate_reporting::ErrorReporter>( - reporter_)))); + base::Bind( + SetMockReporter, safe_browsing_service, + base::Passed(scoped_ptr<CertificateErrorReporter>(reporter_)))); } const std::string& CertificateReportingTest::GetLatestHostnameReported() const { diff --git a/chrome/browser/ssl/certificate_reporting_test_utils.h b/chrome/browser/ssl/certificate_reporting_test_utils.h index 29cd62b..81d3d91 100644 --- a/chrome/browser/ssl/certificate_reporting_test_utils.h +++ b/chrome/browser/ssl/certificate_reporting_test_utils.h @@ -7,6 +7,7 @@ #include <string> +#include "chrome/browser/net/certificate_error_reporter.h" #include "chrome/test/base/in_process_browser_test.h" class Browser; diff --git a/chrome/browser/ssl/ssl_blocking_page.cc b/chrome/browser/ssl/ssl_blocking_page.cc index 97148f3..61ca1ac 100644 --- a/chrome/browser/ssl/ssl_blocking_page.cc +++ b/chrome/browser/ssl/ssl_blocking_page.cc @@ -25,6 +25,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/renderer_preferences_util.h" #include "chrome/browser/ssl/cert_report_helper.h" +#include "chrome/browser/ssl/certificate_error_report.h" #include "chrome/browser/ssl/ssl_cert_reporter.h" #include "chrome/browser/ssl/ssl_error_classification.h" #include "chrome/browser/ssl/ssl_error_info.h" @@ -149,10 +150,10 @@ SSLBlockingPage::SSLBlockingPage(content::WebContents* web_contents, metrics_helper()->RecordUserInteraction( security_interstitials::MetricsHelper::TOTAL_VISITS); - cert_report_helper_.reset(new CertReportHelper( - ssl_cert_reporter.Pass(), web_contents, request_url, ssl_info, - certificate_reporting::ErrorReport::INTERSTITIAL_SSL, overridable_, - metrics_helper())); + cert_report_helper_.reset( + new CertReportHelper(ssl_cert_reporter.Pass(), web_contents, request_url, + ssl_info, CertificateErrorReport::INTERSTITIAL_SSL, + overridable_, metrics_helper())); ssl_error_classification_.reset(new SSLErrorClassification( web_contents, @@ -383,7 +384,7 @@ void SSLBlockingPage::OnProceed() { // Finish collecting information about invalid certificates, if the // user opted in to. cert_report_helper_->FinishCertCollection( - certificate_reporting::ErrorReport::USER_PROCEEDED); + CertificateErrorReport::USER_PROCEEDED); RecordSSLExpirationPageEventState( expired_but_previously_allowed_, true, overridable_); @@ -398,7 +399,7 @@ void SSLBlockingPage::OnDontProceed() { // Finish collecting information about invalid certificates, if the // user opted in to. cert_report_helper_->FinishCertCollection( - certificate_reporting::ErrorReport::USER_DID_NOT_PROCEED); + CertificateErrorReport::USER_DID_NOT_PROCEED); RecordSSLExpirationPageEventState( expired_but_previously_allowed_, false, overridable_); diff --git a/chrome/browser/ssl/ssl_blocking_page.h b/chrome/browser/ssl/ssl_blocking_page.h index 0c45e31..f096278 100644 --- a/chrome/browser/ssl/ssl_blocking_page.h +++ b/chrome/browser/ssl/ssl_blocking_page.h @@ -14,8 +14,8 @@ #include "base/time/time.h" #include "chrome/browser/interstitials/security_interstitial_page.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/ssl/certificate_error_report.h" #include "chrome/browser/ssl/ssl_cert_reporter.h" -#include "components/certificate_reporting/error_report.h" #include "net/ssl/ssl_info.h" #include "url/gurl.h" diff --git a/chrome/browser/ssl/ssl_browser_tests.cc b/chrome/browser/ssl/ssl_browser_tests.cc index be0c1bb..d817a77 100644 --- a/chrome/browser/ssl/ssl_browser_tests.cc +++ b/chrome/browser/ssl/ssl_browser_tests.cc @@ -21,10 +21,13 @@ #include "chrome/browser/browser_process.h" #include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/interstitials/security_interstitial_page_test_utils.h" +#include "chrome/browser/net/certificate_error_reporter.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ssl/bad_clock_blocking_page.h" +#include "chrome/browser/ssl/cert_logger.pb.h" #include "chrome/browser/ssl/cert_report_helper.h" #include "chrome/browser/ssl/cert_verifier_browser_test.h" +#include "chrome/browser/ssl/certificate_error_report.h" #include "chrome/browser/ssl/certificate_reporting_test_utils.h" #include "chrome/browser/ssl/chrome_ssl_host_state_delegate.h" #include "chrome/browser/ssl/common_name_mismatch_handler.h" @@ -83,6 +86,7 @@ using base::ASCIIToUTF16; using chrome_browser_interstitials::SecurityInterstitialIDNTest; +using chrome_browser_net::CertificateErrorReporter; using content::InterstitialPage; using content::NavigationController; using content::NavigationEntry; diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn index c876981..d442b31 100644 --- a/chrome/browser/ui/BUILD.gn +++ b/chrome/browser/ui/BUILD.gn @@ -43,11 +43,11 @@ source_set("ui") { "//chrome:strings", "//chrome/app/resources:platform_locale_settings", "//chrome/app/theme:theme_resources", + "//chrome/browser/net:encrypted_cert_logger_proto", + "//chrome/browser/ssl:cert_logger_proto", "//chrome/common", "//components/app_modal", "//components/auto_login_parser", - "//components/certificate_reporting:cert_logger_proto", - "//components/certificate_reporting:encrypted_cert_logger_proto", "//components/dom_distiller/webui", "//components/invalidation/impl", "//components/omnibox/common", diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index 0b1727c..6e1c6ef 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -1901,6 +1901,8 @@ 'chrome_browser_net_sources': [ 'browser/net/async_dns_field_trial.cc', 'browser/net/async_dns_field_trial.h', + 'browser/net/certificate_error_reporter.cc', + 'browser/net/certificate_error_reporter.h', 'browser/net/chrome_cookie_notification_details.h', 'browser/net/chrome_extensions_network_delegate.cc', 'browser/net/chrome_extensions_network_delegate.h', @@ -2736,6 +2738,8 @@ 'browser/ssl/bad_clock_blocking_page.h', 'browser/ssl/cert_report_helper.cc', 'browser/ssl/cert_report_helper.h', + 'browser/ssl/certificate_error_report.cc', + 'browser/ssl/certificate_error_report.h', 'browser/ssl/chrome_ssl_host_state_delegate.cc', 'browser/ssl/chrome_ssl_host_state_delegate.h', 'browser/ssl/chrome_ssl_host_state_delegate_factory.cc', @@ -3093,6 +3097,7 @@ # NOTE: New dependencies should generally be added in the OS!="ios" # dependencies block below, rather than here. 'browser_ui', + 'cert_logger_proto', 'chrome_resources.gyp:chrome_extra_resources', 'chrome_resources.gyp:chrome_resources', 'chrome_resources.gyp:chrome_strings', @@ -3100,6 +3105,7 @@ 'chrome_resources.gyp:platform_locale_settings', 'chrome_resources.gyp:theme_resources', 'common', + 'encrypted_cert_logger_proto', 'probe_message_proto', '../components/components.gyp:autofill_core_browser', '../components/components.gyp:bookmarks_browser', @@ -3229,7 +3235,6 @@ '../components/components.gyp:about_handler', '../components/components.gyp:autofill_content_browser', '../components/components.gyp:browsing_data', - '../components/components.gyp:certificate_reporting', '../components/components.gyp:data_reduction_proxy_content_browser', '../components/components.gyp:devtools_discovery', '../components/components.gyp:devtools_http_handler', @@ -3879,6 +3884,32 @@ ], }, { + # Protobuf compiler / generator for the certificate error reporting + # protocol buffer. + # GN version: //chrome/browser/ssl:cert_logger_proto + 'target_name': 'cert_logger_proto', + 'type': 'static_library', + 'sources': [ 'browser/ssl/cert_logger.proto', ], + 'variables': { + 'proto_in_dir': 'browser/ssl', + 'proto_out_dir': 'chrome/browser/ssl', + }, + 'includes': [ '../build/protoc.gypi', ], + }, + { + # Protobuf compiler / generator for the encrypted certificate + # reports protocol buffer. + # GN version: //chrome/browser/net:encrypted_cert_logger_proto + 'target_name': 'encrypted_cert_logger_proto', + 'type': 'static_library', + 'sources': [ 'browser/net/encrypted_cert_logger.proto', ], + 'variables': { + 'proto_in_dir': 'browser/net', + 'proto_out_dir': 'chrome/browser/net', + }, + 'includes': [ '../build/protoc.gypi', ], + }, + { # Protobuf compiler / generator for Probe Message. # GN version: //chrome/browser/net:probe_message_proto 'target_name': 'probe_message_proto', diff --git a/chrome/chrome_browser_chromeos.gypi b/chrome/chrome_browser_chromeos.gypi index 1af1359..e9b7962 100644 --- a/chrome/chrome_browser_chromeos.gypi +++ b/chrome/chrome_browser_chromeos.gypi @@ -1079,6 +1079,7 @@ 'attestation_proto', 'browser/extensions/api/api_registration.gyp:chrome_api_registration', 'browser_extensions', + 'cert_logger_proto', 'chrome_resources.gyp:chrome_extra_resources', 'chrome_resources.gyp:chrome_resources', 'chrome_resources.gyp:platform_locale_settings', @@ -1088,6 +1089,7 @@ 'common_net', 'debugger', 'device_policy_proto', + 'encrypted_cert_logger_proto', 'installer_util', 'safe_browsing_chunk_proto', 'safe_browsing_proto', @@ -1101,7 +1103,6 @@ # browser_chromeos #includes power_supply_properties.pb.h directly. '../chromeos/chromeos.gyp:power_manager_proto', '../chromeos/ime/input_method.gyp:gencode', - '../components/components.gyp:certificate_reporting', '../components/components.gyp:cloud_policy_proto', '../components/components.gyp:drive', '../components/components.gyp:login', diff --git a/chrome/chrome_browser_ui.gypi b/chrome/chrome_browser_ui.gypi index 39dc3ce..f35800a 100644 --- a/chrome/chrome_browser_ui.gypi +++ b/chrome/chrome_browser_ui.gypi @@ -2720,6 +2720,7 @@ 'dependencies': [ # NOTE: New dependencies should generally be added in the OS!="ios" # dependencies block below, rather than here. + 'cert_logger_proto', 'chrome_browser_ui_views.gyp:browser_ui_views', 'chrome_resources.gyp:chrome_extra_resources', 'chrome_resources.gyp:chrome_resources', @@ -2727,8 +2728,8 @@ 'chrome_resources.gyp:platform_locale_settings', 'chrome_resources.gyp:theme_resources', 'common', + 'encrypted_cert_logger_proto', '../components/components.gyp:auto_login_parser', - '../components/components.gyp:certificate_reporting', '../components/components.gyp:device_event_log_component', '../components/components.gyp:dom_distiller_core', '../components/components.gyp:dom_distiller_webui', diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index 5069370d..cd0211d 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -2049,7 +2049,6 @@ '../components/components.gyp:autofill_content_risk_proto', '../components/components.gyp:autofill_content_test_support', '../components/components.gyp:captive_portal_test_support', - '../components/components.gyp:certificate_reporting', '../components/components.gyp:dom_distiller_content_browser', '../components/components.gyp:dom_distiller_test_support', '../components/components.gyp:guest_view_test_support', diff --git a/chrome/chrome_tests_unit.gypi b/chrome/chrome_tests_unit.gypi index 1a1d36e..c04ffe5 100644 --- a/chrome/chrome_tests_unit.gypi +++ b/chrome/chrome_tests_unit.gypi @@ -145,6 +145,7 @@ 'browser/metrics/time_ticks_experiment_unittest.cc', 'browser/metrics/variations/generated_resources_map_lookup_unittest.cc', 'browser/mod_pagespeed/mod_pagespeed_metrics_unittest.cc', + 'browser/net/certificate_error_reporter_unittest.cc', 'browser/net/chrome_network_delegate_unittest.cc', 'browser/net/dns_probe_runner_unittest.cc', 'browser/net/dns_probe_service_unittest.cc', @@ -225,6 +226,7 @@ 'browser/signin/signin_manager_unittest.cc', 'browser/signin/signin_tracker_unittest.cc', 'browser/signin/test_signin_client_builder.cc', + 'browser/ssl/certificate_error_report_unittest.cc', 'browser/ssl/ssl_error_classification_unittest.cc', 'browser/ssl/ssl_error_handler_unittest.cc', 'browser/status_icons/status_icon_menu_model_unittest.cc', diff --git a/components/BUILD.gn b/components/BUILD.gn index 40a3be5..766620f 100644 --- a/components/BUILD.gn +++ b/components/BUILD.gn @@ -28,7 +28,6 @@ group("all_components") { "//components/cdm/browser", "//components/cdm/common", "//components/cdm/renderer", - "//components/certificate_reporting", "//components/cloud_devices/common", "//components/chrome_apps", "//components/component_updater", diff --git a/components/certificate_reporting.gypi b/components/certificate_reporting.gypi deleted file mode 100644 index 87f9f50..0000000 --- a/components/certificate_reporting.gypi +++ /dev/null @@ -1,57 +0,0 @@ -# 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. - -{ - 'targets': [ - { - # GN version: //components/certificate_reporting - 'target_name': 'certificate_reporting', - 'type': 'static_library', - 'dependencies': [ - '../base/base.gyp:base', - '../crypto/crypto.gyp:crypto', - '../net/net.gyp:net', - '../url/url.gyp:url_lib', - 'cert_logger_proto', - 'encrypted_cert_logger_proto', - ], - 'include_dirs': [ - '..', - ], - 'sources': [ - # Note: sources list duplicated in GN build. - "certificate_reporting/error_report.cc", - "certificate_reporting/error_report.h", - "certificate_reporting/error_reporter.cc", - "certificate_reporting/error_reporter.h", - ] - }, - { - # Protobuf compiler / generator for the certificate error reporting - # protocol buffer. - # GN version: //components/certificate_reporting:cert_logger_proto - 'target_name': 'cert_logger_proto', - 'type': 'static_library', - 'sources': [ 'certificate_reporting/cert_logger.proto', ], - 'variables': { - 'proto_in_dir': 'certificate_reporting/', - 'proto_out_dir': 'components/certificate_reporting/', - }, - 'includes': [ '../build/protoc.gypi', ], - }, - { - # Protobuf compiler / generator for the encrypted certificate - # reports protocol buffer. - # GN version: //components/certificate_reporting:encrypted_cert_logger_proto - 'target_name': 'encrypted_cert_logger_proto', - 'type': 'static_library', - 'sources': [ 'certificate_reporting/encrypted_cert_logger.proto', ], - 'variables': { - 'proto_in_dir': 'certificate_reporting/', - 'proto_out_dir': 'components/certificate_reporting/', - }, - 'includes': [ '../build/protoc.gypi', ], - }, - ] -} diff --git a/components/certificate_reporting/BUILD.gn b/components/certificate_reporting/BUILD.gn deleted file mode 100644 index c175e6c..0000000 --- a/components/certificate_reporting/BUILD.gn +++ /dev/null @@ -1,55 +0,0 @@ -# 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. - -import("//third_party/protobuf/proto_library.gni") - -# GYP version: components/certificate_reporting.gyp:certificate_reporting -static_library("certificate_reporting") { - sources = [ - "cert_logger.proto", - "encrypted_cert_logger.proto", - "error_report.cc", - "error_report.h", - "error_reporter.cc", - "error_reporter.h", - ] - - deps = [ - ":cert_logger_proto", - ":encrypted_cert_logger_proto", - "//base", - "//crypto", - "//net", - "//url", - ] -} - -# GYP version: components/certificate_reporting.gypi:cert_logger_proto -proto_library("cert_logger_proto") { - sources = [ - "cert_logger.proto", - ] -} - -# GYP version: components/certificate_reporting.gypi:encrypted_cert_logger_proto -proto_library("encrypted_cert_logger_proto") { - sources = [ - "encrypted_cert_logger.proto", - ] -} - -source_set("unit_tests") { - testonly = true - sources = [ - "error_report_unittest.cc", - "error_reporter_unittest.cc", - ] - - deps = [ - ":certificate_reporting", - "//base", - "//net:test_support", - "//testing/gtest", - ] -} diff --git a/components/certificate_reporting/DEPS b/components/certificate_reporting/DEPS deleted file mode 100644 index 8078553..0000000 --- a/components/certificate_reporting/DEPS +++ /dev/null @@ -1,4 +0,0 @@ -include_rules = [ - "+crypto", - "+net" -]
\ No newline at end of file diff --git a/components/certificate_reporting/OWNERS b/components/certificate_reporting/OWNERS deleted file mode 100644 index e99de876..0000000 --- a/components/certificate_reporting/OWNERS +++ /dev/null @@ -1,4 +0,0 @@ -estark@chromium.org -felt@chromium.org -palmer@chromium.org -rsleevi@chromium.org
\ No newline at end of file diff --git a/components/components.gyp b/components/components.gyp index abd3e5e..1d10c7e 100644 --- a/components/components.gyp +++ b/components/components.gyp @@ -16,7 +16,6 @@ 'bookmarks.gypi', 'bubble.gypi', 'captive_portal.gypi', - 'certificate_reporting.gypi', 'cloud_devices.gypi', 'component_updater.gypi', 'compression.gypi', diff --git a/components/components_tests.gyp b/components/components_tests.gyp index 6f63437..fb0c636 100644 --- a/components/components_tests.gyp +++ b/components/components_tests.gyp @@ -87,10 +87,6 @@ 'captive_portal_unittest_sources': [ 'captive_portal/captive_portal_detector_unittest.cc', ], - 'certificate_reporting_unittest_sources': [ - 'certificate_reporting/error_report_unittest.cc', - 'certificate_reporting/error_reporter_unittest.cc', - ], 'certificate_transparency_unittest_sources': [ 'certificate_transparency/log_proof_fetcher_unittest.cc', ], @@ -778,7 +774,6 @@ '<@(browser_watcher_unittest_sources)', '<@(bubble_unittest_sources)', '<@(captive_portal_unittest_sources)', - '<@(certificate_reporting_unittest_sources)', '<@(cloud_devices_unittest_sources)', '<@(component_updater_unittest_sources)', '<@(compression_unittest_sources)', @@ -873,7 +868,6 @@ 'components.gyp:bookmarks_test_support', 'components.gyp:bubble', 'components.gyp:captive_portal_test_support', - 'components.gyp:certificate_reporting', 'components.gyp:cloud_devices_common', 'components.gyp:component_updater', 'components.gyp:compression', @@ -1123,7 +1117,6 @@ 'action_name': 'copy_test_data', 'variables': { 'test_data_files': [ - '../net/data', 'test/data', ], 'test_data_prefix': 'components', diff --git a/components/components_unittests.isolate b/components/components_unittests.isolate index 6682b8c..dda3761 100644 --- a/components/components_unittests.isolate +++ b/components/components_unittests.isolate @@ -37,7 +37,6 @@ ['OS=="android" or OS=="linux" or OS=="mac" or OS=="win"', { 'variables': { 'files': [ - '../net/data/', 'test/data/', '<(PRODUCT_DIR)/components_tests_resources.pak', '<(PRODUCT_DIR)/ui_test.pak', |