Implement SCT auditing cache

This adds a SCT auditing cache to the NetworkService, and integrates it
with TransportSecurityState so that new SCT reports are sent to the
cache during CT policy verification. This also adds feature flags and
params to control SCT auditing behavior, and unit tests covering the
cache implementation.

Bug: 1082860
Change-Id: I24b53c655d960390089e7746e116c9978a4b3a28
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2248862
Reviewed-by: Ryan Sleevi <[email protected]>
Reviewed-by: Joe Downing <[email protected]>
Reviewed-by: Robbie McElrath <[email protected]>
Reviewed-by: Tsuyoshi Horo <[email protected]>
Commit-Queue: Christopher Thompson <[email protected]>
Cr-Commit-Position: refs/heads/master@{#790253}
diff --git a/net/url_request/url_request_context.h b/net/url_request/url_request_context.h
index c1d5609..df16d1fa 100644
--- a/net/url_request/url_request_context.h
+++ b/net/url_request/url_request_context.h
@@ -48,6 +48,7 @@
 class ProxyDelegate;
 class ProxyResolutionService;
 class QuicContext;
+class SCTAuditingDelegate;
 class SSLConfigService;
 class URLRequest;
 class URLRequestJobFactory;
@@ -207,6 +208,13 @@
     ct_policy_enforcer_ = enforcer;
   }
 
+  SCTAuditingDelegate* sct_auditing_delegate() const {
+    return sct_auditing_delegate_;
+  }
+  void set_sct_auditing_delegate(SCTAuditingDelegate* delegate) {
+    sct_auditing_delegate_ = delegate;
+  }
+
   const URLRequestJobFactory* job_factory() const { return job_factory_; }
   void set_job_factory(const URLRequestJobFactory* job_factory) {
     job_factory_ = job_factory;
@@ -331,6 +339,7 @@
   TransportSecurityState* transport_security_state_;
   CTVerifier* cert_transparency_verifier_;
   CTPolicyEnforcer* ct_policy_enforcer_;
+  SCTAuditingDelegate* sct_auditing_delegate_;
   HttpTransactionFactory* http_transaction_factory_;
   const URLRequestJobFactory* job_factory_;
   URLRequestThrottlerManager* throttler_manager_;