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

Unified Diff: chrome/browser/chrome_content_browser_client.cc

Issue 2503243003: Wire up CertificateReportingService to handle report uploads (Closed)
Patch Set: Rebase Created 4 years 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
« no previous file with comments | « no previous file | chrome/browser/metrics/chrome_metrics_service_client.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chrome_content_browser_client.cc
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index 7bfe7f132a103cd7f7d1ae8e2c075f57265ef5a0..365f80caf02360491c4c9320b205db06e2900af9 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -73,8 +73,8 @@
#include "chrome/browser/renderer_host/chrome_navigation_ui_data.h"
#include "chrome/browser/renderer_host/chrome_render_message_filter.h"
#include "chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.h"
-#include "chrome/browser/safe_browsing/safe_browsing_service.h"
-#include "chrome/browser/safe_browsing/ui_manager.h"
+#include "chrome/browser/safe_browsing/certificate_reporting_service.h"
+#include "chrome/browser/safe_browsing/certificate_reporting_service_factory.h"
#include "chrome/browser/search/instant_service.h"
#include "chrome/browser/search/instant_service_factory.h"
#include "chrome/browser/search/search.h"
@@ -144,6 +144,7 @@
#include "components/rappor/public/rappor_utils.h"
#include "components/rappor/rappor_recorder_impl.h"
#include "components/rappor/rappor_service_impl.h"
+#include "components/safe_browsing_db/safe_browsing_prefs.h"
#include "components/security_interstitials/core/ssl_error_ui.h"
#include "components/signin/core/common/profile_management_switches.h"
#include "components/spellcheck/spellcheck_build_features.h"
@@ -671,28 +672,26 @@ void HandleFlashDownloadActionOnUIThread(int render_process_id,
#endif // BUILDFLAG(ENABLE_PLUGINS)
// An implementation of the SSLCertReporter interface used by
-// SSLErrorHandler. Uses the SafeBrowsing UI manager to send invalid
-// certificate reports.
-class SafeBrowsingSSLCertReporter : public SSLCertReporter {
+// SSLErrorHandler. Uses CertificateReportingService to send reports. The
+// service handles queueing and re-sending of failed reports. Each certificate
+// error creates a new instance of this class.
+class CertificateReportingServiceCertReporter : public SSLCertReporter {
public:
- explicit SafeBrowsingSSLCertReporter(
- const scoped_refptr<safe_browsing::SafeBrowsingUIManager>&
- safe_browsing_ui_manager)
- : safe_browsing_ui_manager_(safe_browsing_ui_manager) {}
- ~SafeBrowsingSSLCertReporter() override {}
+ explicit CertificateReportingServiceCertReporter(
+ CertificateReportingService* service)
+ : service_(service) {}
+ ~CertificateReportingServiceCertReporter() override {}
// SSLCertReporter implementation
void ReportInvalidCertificateChain(
const std::string& serialized_report) override {
- if (safe_browsing_ui_manager_) {
- safe_browsing_ui_manager_->ReportInvalidCertificateChain(
- serialized_report, base::Bind(&base::DoNothing));
- }
+ service_->Send(serialized_report);
}
private:
- const scoped_refptr<safe_browsing::SafeBrowsingUIManager>
- safe_browsing_ui_manager_;
+ CertificateReportingService* service_;
+
+ DISALLOW_COPY_AND_ASSIGN(CertificateReportingServiceCertReporter);
};
#if BUILDFLAG(ANDROID_JAVA_UI)
@@ -2201,12 +2200,12 @@ void ChromeContentBrowserClient::AllowCertificateError(
if (expired_previous_decision)
options_mask |= SSLErrorUI::EXPIRED_BUT_PREVIOUSLY_ALLOWED;
- safe_browsing::SafeBrowsingService* safe_browsing_service =
- g_browser_process->safe_browsing_service();
- std::unique_ptr<SafeBrowsingSSLCertReporter> cert_reporter(
- new SafeBrowsingSSLCertReporter(safe_browsing_service
- ? safe_browsing_service->ui_manager()
- : nullptr));
+ CertificateReportingService* cert_reporting_service =
+ CertificateReportingServiceFactory::GetForBrowserContext(
+ web_contents->GetBrowserContext());
+ std::unique_ptr<CertificateReportingServiceCertReporter> cert_reporter(
+ new CertificateReportingServiceCertReporter(cert_reporting_service));
+
SSLErrorHandler::HandleSSLError(web_contents, cert_error, ssl_info,
request_url, options_mask,
std::move(cert_reporter), callback);
« no previous file with comments | « no previous file | chrome/browser/metrics/chrome_metrics_service_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698