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

Unified Diff: net/cert/sth_observer.h

Issue 1845113003: Certificate Transparency: Start tracking logs' state (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « net/cert/sth_distributor.cc ('k') | net/cert/sth_observer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cert/sth_observer.h
diff --git a/net/cert/sth_observer.h b/net/cert/sth_observer.h
new file mode 100644
index 0000000000000000000000000000000000000000..009ef8e03c993c4c7a4301525b2e0345c4351f43
--- /dev/null
+++ b/net/cert/sth_observer.h
@@ -0,0 +1,60 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef NET_CERT_STH_OBSERVER_H_
+#define NET_CERT_STH_OBSERVER_H_
+
+#include <set>
+
+#include "net/base/net_export.h"
+
+namespace net {
+
+namespace ct {
+
+struct SignedTreeHead;
+
+class NET_EXPORT STHObserver {
+ public:
+ virtual ~STHObserver() {}
+
+ virtual void NewSTHObserved(const SignedTreeHead& sth) = 0;
+};
+
+class NET_EXPORT STHReporter {
+ public:
+ virtual ~STHReporter() {}
+
+ virtual void RegisterObserver(STHObserver* observer) = 0;
+ virtual void UnregisterObserver(STHObserver* observer) = 0;
+};
+
+class NET_EXPORT STHReporterRegistrar {
+ public:
+ STHReporterRegistrar();
+ ~STHReporterRegistrar();
+
+ // Stores the |observer| for later registration when a reporter
+ // is provided, or registers it immediately if one was already
+ // provided via AssignReporter.
+ void SignUpForRegistration(STHObserver* observer);
+ // Can only be called once; Calls STHReporter::RegisterObserver
+ // for each of the observers registered with SignUpForRegistration
+ void AssignReporter(STHReporter* reporter);
+ // Calls STHReporter::UnregisterObserver for all observers
+ // registered with SignUpForRegistration
+ void UnregisterAll();
+ // Unregisters an individual reporter.
+ void UnregisterObserver(STHObserver* observer);
+
+ private:
+ STHReporter* reporter_;
+ std::set<STHObserver*> pending_observers_;
+};
+
+} // namespace ct
+
+} // namespace net
+
+#endif // NET_CERT_STH_OBSERVER_H_
« no previous file with comments | « net/cert/sth_distributor.cc ('k') | net/cert/sth_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698