Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef NET_CERT_STH_DISTRIBUTOR_H_ | 5 #ifndef NET_CERT_STH_DISTRIBUTOR_H_ |
| 6 #define NET_CERT_STH_DISTRIBUTOR_H_ | 6 #define NET_CERT_STH_DISTRIBUTOR_H_ |
| 7 | 7 |
| 8 #include <vector> | |
| 9 | |
| 8 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
| 9 #include "net/base/net_export.h" | 11 #include "net/base/net_export.h" |
| 12 #include "net/cert/signed_tree_head.h" | |
| 10 #include "net/cert/sth_observer.h" | 13 #include "net/cert/sth_observer.h" |
| 11 #include "net/cert/sth_reporter.h" | 14 #include "net/cert/sth_reporter.h" |
| 12 | 15 |
| 13 namespace net { | 16 namespace net { |
| 14 | 17 |
| 15 namespace ct { | 18 namespace ct { |
| 16 | 19 |
| 17 // A proxy for delegating new STH notifications to all registered | 20 // A proxy for delegating new STH notifications to all registered |
| 18 // observers. | 21 // observers. |
| 19 // For each |observer| registered with RegisterObserver, the | 22 // For each |observer| registered with RegisterObserver, the |
| 20 // NewSTHObserved method will be called whenever the STHDistributor's | 23 // NewSTHObserved method will be called whenever the STHDistributor's |
| 21 // NewSTHObserved method is invoked. | 24 // NewSTHObserved method is invoked. |
| 22 class NET_EXPORT STHDistributor : public STHObserver, public STHReporter { | 25 class NET_EXPORT STHDistributor : public STHObserver, public STHReporter { |
| 23 public: | 26 public: |
| 24 STHDistributor(); | 27 STHDistributor(); |
| 25 ~STHDistributor() override; | 28 ~STHDistributor() override; |
| 26 | 29 |
| 27 // STHObserver implementation. | 30 // STHObserver implementation. |
| 28 void NewSTHObserved(const SignedTreeHead& sth) override; | 31 void NewSTHObserved(const SignedTreeHead& sth) override; |
| 29 | 32 |
| 30 // STHReporter implementation | 33 // STHReporter implementation |
| 34 // Registers |observer| for new STH notifications and invokes the | |
| 35 // new STH notification of this |observer| with observed STHs (one | |
| 36 // per log). | |
| 31 void RegisterObserver(STHObserver* observer) override; | 37 void RegisterObserver(STHObserver* observer) override; |
| 38 | |
| 39 // Unregisters |observer|, should only be called with observers | |
| 40 // that were previously registered via RegisterObserver; | |
| 32 void UnregisterObserver(STHObserver* observer) override; | 41 void UnregisterObserver(STHObserver* observer) override; |
| 33 | 42 |
| 34 private: | 43 private: |
| 44 // STHs from logs, one for each log. | |
| 45 std::vector<SignedTreeHead> observed_sths_; | |
|
Ryan Sleevi
2016/05/16 19:19:01
FWIW you can still forward declare this (because t
Eran Messeri
2016/05/17 09:51:03
Done.
| |
| 46 | |
| 47 // The observers for new STH notifications. | |
| 35 base::ObserverList<STHObserver> observer_list_; | 48 base::ObserverList<STHObserver> observer_list_; |
| 36 }; | 49 }; |
| 37 | 50 |
| 38 } // namespace ct | 51 } // namespace ct |
| 39 | 52 |
| 40 } // namespace net | 53 } // namespace net |
| 41 | 54 |
| 42 #endif // NET_CERT_STH_DISTRIBUTOR_H_ | 55 #endif // NET_CERT_STH_DISTRIBUTOR_H_ |
| OLD | NEW |