Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(607)

Unified Diff: chrome/browser/safe_browsing/ping_manager.cc

Issue 935663004: Add checkbox for reporting invalid TLS/SSL cert chains (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: revert accidental deletion (fixes failing CaptivePortal tests) Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..947d8910e31387bed7172221af23cc62b08ef941 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[] = "";
+} // namespace
+
// SafeBrowsingPingManager implementation ----------------------------------
// static
@@ -34,7 +44,14 @@ 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_(
+ request_context_getter
+ ? new CertificateErrorReporter(
+ request_context_getter->GetURLRequestContext(),
+ GURL(kExtendedReportingUploadUrl),
+ CertificateErrorReporter::SEND_COOKIES)
+ : nullptr) {
DCHECK(!url_prefix_.empty());
version_ = SafeBrowsingProtocolManagerHelper::Version();
@@ -95,6 +112,20 @@ void SafeBrowsingPingManager::ReportMalwareDetails(
safebrowsing_reports_.insert(fetcher);
}
+void SafeBrowsingPingManager::ReportInvalidCertificateChain(
+ const std::string& hostname,
+ const net::SSLInfo& ssl_info) {
+ DCHECK(certificate_error_reporter_);
+ 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,
« no previous file with comments | « chrome/browser/safe_browsing/ping_manager.h ('k') | chrome/browser/safe_browsing/safe_browsing_blocking_page.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698