Chromium Code Reviews| Index: chrome/browser/safe_browsing/ping_manager.cc |
| diff --git a/chrome/browser/safe_browsing/ping_manager.cc b/chrome/browser/safe_browsing/ping_manager.cc |
| index 04783410fcef1f848ef6e6dd4a0d51160d14c223..72f55a0e9734147d4208677123635d5a2e12fa07 100644 |
| --- a/chrome/browser/safe_browsing/ping_manager.cc |
| +++ b/chrome/browser/safe_browsing/ping_manager.cc |
| @@ -8,17 +8,27 @@ |
| #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 "content/public/browser/browser_thread.h" |
| #include "google_apis/google_api_keys.h" |
| #include "net/base/escape.h" |
| #include "net/base/load_flags.h" |
| +#include "net/ssl/ssl_info.h" |
| #include "net/url_request/url_fetcher.h" |
| #include "net/url_request/url_request_context_getter.h" |
| #include "net/url_request/url_request_status.h" |
| +#include "url/gurl.h" |
| +using chrome_browser_net::CertificateErrorReporter; |
| using content::BrowserThread; |
| +namespace { |
| +// URL to upload invalid certificate chain reports |
| +// TODO(estark): Fill this in with the real URL when live. |
| +const char kExtendedReportingUploadUrl[] = "http://example.test"; |
|
Ryan Sleevi
2015/03/25 04:49:45
What will ensure this gets fixed? This seems like
estark
2015/03/25 05:34:33
Done. Changed to an empty URL, and moved the DCHEC
|
| +} // namespace |
| + |
| // SafeBrowsingPingManager implementation ---------------------------------- |
| // static |
| @@ -34,7 +44,11 @@ SafeBrowsingPingManager::SafeBrowsingPingManager( |
| const SafeBrowsingProtocolConfig& config) |
| : client_name_(config.client_name), |
| request_context_getter_(request_context_getter), |
| - url_prefix_(config.url_prefix) { |
| + url_prefix_(config.url_prefix), |
| + certificate_error_reporter_(new CertificateErrorReporter( |
| + request_context_getter->GetURLRequestContext(), |
| + GURL(kExtendedReportingUploadUrl), |
| + CertificateErrorReporter::SEND_COOKIES)) { |
|
Ryan Sleevi
2015/03/25 04:49:45
o_O
(Edit: ;( )
|
| DCHECK(!url_prefix_.empty()); |
| version_ = SafeBrowsingProtocolManagerHelper::Version(); |
| @@ -95,6 +109,19 @@ void SafeBrowsingPingManager::ReportMalwareDetails( |
| safebrowsing_reports_.insert(fetcher); |
| } |
| +void SafeBrowsingPingManager::ReportInvalidCertificateChain( |
| + const std::string& hostname, |
| + const net::SSLInfo& ssl_info) { |
| + certificate_error_reporter_->SendReport( |
| + CertificateErrorReporter::REPORT_TYPE_EXTENDED_REPORTING, hostname, |
| + ssl_info); |
| +} |
| + |
| +void SafeBrowsingPingManager::SetCertificateErrorReporterForTesting( |
| + scoped_ptr<CertificateErrorReporter> certificate_error_reporter) { |
| + certificate_error_reporter_ = certificate_error_reporter.Pass(); |
| +} |
| + |
| GURL SafeBrowsingPingManager::SafeBrowsingHitUrl( |
| const GURL& malicious_url, const GURL& page_url, |
| const GURL& referrer_url, bool is_subresource, |