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

Unified Diff: chrome/browser/safe_browsing/certificate_reporting_service.h

Issue 2503243003: Wire up CertificateReportingService to handle report uploads (Closed)
Patch Set: Rebase onto crrev/2543523002 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
Index: chrome/browser/safe_browsing/certificate_reporting_service.h
diff --git a/chrome/browser/safe_browsing/certificate_reporting_service.h b/chrome/browser/safe_browsing/certificate_reporting_service.h
index 3cc2416e5f3ffa2a76318a70add5c198ac93f981..54a3260bff9643d04dee1d685e68f1aae43ca55f 100644
--- a/chrome/browser/safe_browsing/certificate_reporting_service.h
+++ b/chrome/browser/safe_browsing/certificate_reporting_service.h
@@ -19,6 +19,8 @@
#include "components/keyed_service/core/keyed_service.h"
#include "net/url_request/url_request_context_getter.h"
+class Profile;
+
namespace base {
class Clock;
}
@@ -28,6 +30,10 @@ class URLRequestContext;
class URLRequestContextGetter;
}
+namespace safe_browsing {
+class SafeBrowsingService;
+}
+
// This service initiates uploads of invalid certificate reports and retries any
// failed uploads. Each report is retried until it's older than a certain time
// to live (TTL). Reports older than this TTL are dropped and no more retried,
@@ -163,8 +169,26 @@ class CertificateReportingService : public KeyedService {
DISALLOW_COPY_AND_ASSIGN(Reporter);
};
+ // Observes SafeBrowsing preference changes. An instance of this is created by
+ // ChromeContentBrowserClient to notify the service when SafeBrowsing
+ // or extended reporting is enabled/disabled. This class is introduced to
+ // decouple chrome/browser/ssl from SafeBrowsing.
+ class PreferenceObserver {
+ public:
+ // Called when SafeBrowsing preference changes.
+ virtual void OnPreferenceChanged() = 0;
+
+ virtual ~PreferenceObserver() {}
+ };
+
+ static CertificateReportingService* Create(
+ safe_browsing::SafeBrowsingService* safe_browsing_service,
+ Profile* profile);
+ // Constructor for unit tests:
CertificateReportingService(
+ safe_browsing::SafeBrowsingService* safe_browsing_service,
scoped_refptr<net::URLRequestContextGetter> url_request_context_getter,
+ Profile* profile,
std::unique_ptr<EventObserver> event_observer,
size_t max_queued_report_count,
base::TimeDelta max_report_age,
@@ -236,6 +260,10 @@ class CertificateReportingService : public KeyedService {
std::unique_ptr<Reporter> reporter_;
+ // Observes SafeBrowsing preference changes (SB is enabled/disabled, extended
+ // reporting is enabled/disabled).
+ std::unique_ptr<PreferenceObserver> preference_observer_;
+
// Subscription for url request context shutdowns. When this subscription is
// notified, it means that the SafeBrowsing service is shutting down, and this
// service must also shut down.

Powered by Google App Engine
This is Rietveld 408576698